-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Modernize and run eslint on tools/acorn-optimizer.js. NFC #15836
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
Conversation
03c3c2d to
34ea81d
Compare
| // Check for an array of children. | ||
| if (Array.isArray(child)) { | ||
| child.forEach(maybeChild); | ||
| if (Object.prototype.hasOwnProperty.call(node, key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does lint auto-change code in LHS to RHS by adding these lines? (Not very familiar with eslint myself)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the linter complains that when you iterate through an object with for in you need to include an inner check for hasOwnProperty:
Here is the rule: https://eslint.org/docs/rules/guard-for-in
| // analysis here. | ||
|
|
||
| function JSDCE(ast, aggressive) { | ||
| function runJSDCE(ast, aggressive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does eslint rename functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a rule that says that any function that starts with a Capital letter must be a constructor function (and this isn't one).
7daef3c to
4a41a5c
Compare
4a41a5c to
276d4bc
Compare
aheejin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't check each change in detail, but LGTM if this is what eslint tells to do. By the way, does eslint fix things by itself, or we need fix it manually? How can I run eslint on a specific js file based on our configuration?
|
Yes, eslint can fix some/all of the issue it finds automatically, but I have no yet chosen to use that feature, preferring to do it myself so that I internalize the rules and can understand the changes being made. So this change, for example, was fully hand rolled. To run eslint you can just run |
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to #15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
…-core#15845) This change does not effect the JS that we output, only the the internal JS tooling. This is a followup to emscripten-core#15836 which did this cleanup just for a single file. The long list of exclusions in `.eslintrc.yml` is because these files are part of the JS library code which we ship and we a lot of that cannot be run though the lint tool because it uses our speciall pre-processing techniques.
No description provided.