Skip to content
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 allows "latest" #14720

Merged
merged 7 commits into from Jun 26, 2021

Conversation

aladdin-add
Copy link
Member

@aladdin-add aladdin-add commented Jun 18, 2021

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)

this is to reland 831f6b3.
I kept the ecmaVersion defaults to 5, in case we want to change espree's defaults later.

Is there anything you'd like reviewers to focus on?

but for linter/rule-tester, anything else needs to be updated?

@eslint-github-bot eslint-github-bot bot added the triage An ESLint team member will look at this issue soon label Jun 18, 2021
@aladdin-add aladdin-add changed the title Update: ecmaVersion defaults to 5, and allows "latest" Update: reland ecmaVersion defaults to 5, and allows "latest" Jun 18, 2021
lib/linter/linter.js Outdated Show resolved Hide resolved
@aladdin-add aladdin-add requested review from mdjermanovic and nzakas Jun 18, 2021
@aladdin-add aladdin-add changed the title Update: reland ecmaVersion defaults to 5, and allows "latest" Update: reland ecmaVersion allows "latest" Jun 18, 2021
@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint and removed triage An ESLint team member will look at this issue soon labels Jun 18, 2021
Copy link
Member

@nzakas nzakas left a comment

Overall question: do we really need to detect if the parser is Espree anymore? The only change I think we need is to normalize “latest” if found.

lib/linter/linter.js Outdated Show resolved Hide resolved
@aladdin-add aladdin-add marked this pull request as draft Jun 19, 2021
@aladdin-add aladdin-add marked this pull request as ready for review Jun 20, 2021
@aladdin-add aladdin-add requested a review from nzakas Jun 20, 2021
lib/linter/linter.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
Copy link
Member

@mdjermanovic mdjermanovic left a comment

LGTM, thanks!

@mdjermanovic mdjermanovic changed the title Update: reland ecmaVersion allows "latest" Update: ecmaVersion allows "latest" Jun 25, 2021
nzakas
nzakas approved these changes Jun 25, 2021
Copy link
Member

@nzakas nzakas left a comment

LGTM. Thanks!

@mdjermanovic mdjermanovic merged commit ed1da5d into eslint:master Jun 26, 2021
14 checks passed
@aladdin-add aladdin-add deleted the update/ecma-latest branch Jun 26, 2021
@bricss
Copy link

bricss commented Jul 3, 2021

Unfortunately, this new feature won't work with @babel/eslint-parser (most likely any 3rd-party) unless env is set manually to es2021: true 😬

@mdjermanovic
Copy link
Member

mdjermanovic commented Jul 4, 2021

Unfortunately, this new feature won't work with @babel/eslint-parser (most likely any 3rd-party) unless env is set manually to es2021: true

Yes, this feature is available only with the default parser (as noted in the release blog post).

Specifying Parser Options in ESLint documentation describes parser options for the default parser. 3rd-party parsers have different options:

@bricss
Copy link

bricss commented Jul 5, 2021

Yeah, make sense, but isn't it possible to read this property no matter what parser is used? 🤔

@mdjermanovic
Copy link
Member

mdjermanovic commented Jul 5, 2021

Yeah, make sense, but isn't it possible to read this property no matter what parser is used?

"latest" should be normalized to a number that represents the latest version supported by the parser, but ESLint doesn't require parsers to provide an interface to get the latest version.

https://eslint.org/docs/developer-guide/working-with-custom-parsers

Only Espree (the default parser) provides latestEcmaVersion.

@bricss
Copy link

bricss commented Jul 5, 2021

Ok, I see, than maybe it might be possible to add property like ESlatest: true into env? 🤔

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 24, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants