Skip to content

Add missing semicolons for 'const' and 'let' #35540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fredden
Copy link
Member

@fredden fredden commented May 25, 2022

Description

Semicolons are required according to the Magento coding standard:
https://github.com/magento/magento-coding-standard/blob/50e7c2ad3d7110b06527d75a1aa954b7c20f6ea1/eslint/.eslintrc-magento#L89

While there are many missing semicolons in these files, I have only fixed the const and let statements as these are causing problems for users in the admin - see #35325

Ideally these files would conform to the Magento coding standard. Applying the auto-fix feature of eslint produced a much larger set of changes.

Related Pull Requests

Fixed Issues

  1. Fixes Magento 2.4.4 admin panel - Uncaught SyntaxError: Unexpected token 'const' #35325

Manual testing scenarios

See #35325

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Add missing semicolons for 'const' and 'let' #35711: Add missing semicolons for 'const' and 'let'

Ideally these files would conform to the coding standards.
@m2-assistant
Copy link

m2-assistant bot commented May 25, 2022

Hi @fredden. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 25, 2022
@m2-github-services m2-github-services added Partner: Fisheye partners-contribution Pull Request is created by Magento Partner labels May 25, 2022
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@ihor-sviziev
Copy link
Contributor

I guess it was partly fixed in faa7e0e

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@ihor-sviziev ihor-sviziev added Award: bug fix Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jun 9, 2022
Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔ Approved.

Failing tests look not related to changes from this PR.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE , Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Lima
Copy link
Contributor

Hi @fredden

Our internal team informed me this issue has been fixed and committed . Hence, issue not reproducible to me in local 2.4-develop.

As per your comment you have mentioned that this PR fixes other issue as well. Kindly provide me the information about the issue along with steps to reproduce, expected and actual result so, that we will be able to carry forward in our testing.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Alfa
Copy link
Contributor

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Alfa
Copy link
Contributor

Hi @fredden & @ihor-sviziev Thanks for your contribution and collaboration!
Can you please help us by responding on above-comment.
Your precious input will help us take this PR ticket ahead.
Thanks in advance!

@fredden
Copy link
Member Author

fredden commented Jun 29, 2022

@engcom-Lima this pull request was created in response to the error/issue that you have linked. The error message suggested that the built-in JavaScript minification was unable to support the const keyword when semicolons are also missing in the source file. The linked commits are a minimal change to make the specific symptom go away, but do not fully fix the problem.

To fix the problem, the JavaScript minification process could be updated to support this combination, or the source files could be updated to no longer trigger this incompatibility (or both). The Magento coding standard already requires semicolons in all cases, so the best way forward in my opinion would be to apply the Magento coding standard to the source files, which is what this pull request does.

As noted in the pull request description, there are other violations of the Magento coding standard in these files, but I have opted to not fix those in scope of this pull request.

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Preconditions:

  1. make sure Magento instance running with PHP 8.1 version.
  2. Magento instance should be in default/ production mode

Manual testing scenario:

  1. Enable JS bundling using command: php bin/magento config:set dev/js/enable_js_bundling 1
  2. Minify the JS files using command: php bin/magento config:set dev/js/minify_files 1
  3. Run deployment command
  4. Login to the admin panel and check JS errors in developer tool's console output.

Before: ✖️ We were getting the error as shown in the below screenshot.
image

After: ✔️ We are not getting any errors and application is running smooth.
image

Since it is an error in the console output based on specific pre-conditions, there is no additional regression test case is required.

@engcom-Alfa
Copy link
Contributor

@magento create issue

@vandijkstef
Copy link

Semicolons are required according to the Magento coding standard: https://github.com/magento/magento-coding-standard/blob/50e7c2ad3d7110b06527d75a1aa954b7c20f6ea1/eslint/.eslintrc-magento#L89

If that is the case, how did this get in here in the first place? Don't we have linting/syntax testing in place for JS? This something worth raising a new issue for?

@fredden
Copy link
Member Author

fredden commented Sep 14, 2022

Adobe staff do not follow the same workflow that is enforced for community contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: bug fix Partner: Fisheye partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Add missing semicolons for 'const' and 'let' Magento 2.4.4 admin panel - Uncaught SyntaxError: Unexpected token 'const'
7 participants