Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 21, 2021

No description provided.

@sbc100 sbc100 requested review from aheejin and kripken December 21, 2021 23:26
@sbc100 sbc100 force-pushed the acorn_optimizer branch 3 times, most recently from 03c3c2d to 34ea81d Compare December 21, 2021 23:40
// Check for an array of children.
if (Array.isArray(child)) {
child.forEach(maybeChild);
if (Object.prototype.hasOwnProperty.call(node, key)) {
Copy link
Member

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)

Copy link
Collaborator Author

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) {
Copy link
Member

Choose a reason for hiding this comment

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

Does eslint rename functions?

Copy link
Collaborator Author

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).

@sbc100 sbc100 force-pushed the acorn_optimizer branch 2 times, most recently from 7daef3c to 4a41a5c Compare December 22, 2021 15:50
@sbc100 sbc100 enabled auto-merge (squash) December 22, 2021 18:06
Copy link
Member

@aheejin aheejin left a 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?

@sbc100 sbc100 merged commit ad6bc46 into main Dec 22, 2021
@sbc100 sbc100 deleted the acorn_optimizer branch December 22, 2021 20:43
@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 22, 2021

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 eslint <filename>.js if is lint is in your path... or npx esling <filename>.js if its not. Or even ./node_modules/.bin/eslint <filename>.js (assuming your have already run npm install).

sbc100 added a commit that referenced this pull request Dec 23, 2021
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.
sbc100 added a commit that referenced this pull request Dec 23, 2021
sbc100 added a commit that referenced this pull request Dec 23, 2021
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.
sbc100 added a commit that referenced this pull request Dec 23, 2021
sbc100 added a commit that referenced this pull request Dec 23, 2021
sbc100 added a commit that referenced this pull request Dec 26, 2021
sbc100 added a commit that referenced this pull request Dec 26, 2021
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.
sbc100 added a commit that referenced this pull request Dec 26, 2021
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.
sbc100 added a commit that referenced this pull request Dec 27, 2021
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.
sbc100 added a commit that referenced this pull request Dec 27, 2021
sbc100 added a commit that referenced this pull request Dec 28, 2021
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.
sbc100 added a commit that referenced this pull request Dec 29, 2021
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.
mmarczell-graphisoft pushed a commit to GRAPHISOFT/emscripten that referenced this pull request Jan 5, 2022
…-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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants