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
Update: ecmaVersion defaults to 5, and allows "latest" #14622
Conversation
c7003b9
to
99604d4
Compare
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.
We also need to update the docs to mention that “latest” is allowed.
f1d06b9
to
807ac44
Compare
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.
LGTM
0c4cf30
to
033f080
Compare
There seems to be some confusion about how ecmaVersion currently works and it seems like some folks are assuming everyone understands already. Can someone outline the various scenarios, including when |
well, I will try. the current ecmaVersion normalization is simple:
That's say, eslint depends on the parser's defaults option. In the PR, it changed the normalization to:
it will be a breaking change, when all the following conditions are met:
|
@aladdin-add and also, when that parser actually pays attention to the ecmaVersion? |
ESLint currently doesn't automatically set Espree's default is Espree is about to change its default Ideally, ESLint should automatically set The problem is: it seems difficult for |
Thanks everyone, so I think what we want is this:
Can we compare that object to |
I just thought a very edge case: someone might want to use a different version of espree. node_modules
├── espree
└── eslint
└── node_modules
└── espree But I think it's fine to not normalize it - espree was used as a 3rd-party parser in this case. will update as @nzakas suggested (if no objections). |
Sounds good to me!
I agree. If someone explicitly installs another version of espree, then it's like they're using a third-party parser with its own defaults. Though this might also happen unintentionally when another dependency has espree as a dependency, and the other version of espree ends up in the top |
033f080
to
8a7c41b
Compare
8a7c41b
to
ea46670
Compare
I had a realization: So, at this point, I think the path of least resistance is to leave the Espree default Thoughts> |
do you mean using |
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.
Ah ok. LGTM. 👍
ea46670
to
c80c037
Compare
c80c037
to
2b82bad
Compare
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.
LGTM, thanks!
I just realized that this can be included before v8, do we want to merge now? |
Yes, I also think this doesn't depend on eslint/espree@b068cea. We can merge this for an ESLint v7 minor version. |
yes, and eslint/espree@b068cea depends on this one(set ecmaVersion defaults to 5) :) |
eslint#14622)" (eslint#14711)" This reverts commit 97d9bd2.
eslint#14622)" (eslint#14711)" This reverts commit 97d9bd2.
* Revert "Revert "Update: ecmaVersion defaults to 5, and allows "latest" (#14622)" (#14711)" This reverts commit 97d9bd2. * chore: use parser.$parser to check if it's espree * chore: add some tests * chore: not set default 5 * chore: make the $parser non-enumerable * chore: use symbol * chore: a small refactor
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ x] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Is there anything you'd like reviewers to focus on?
all these changes should not affect 3rd-party parsers.