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

[eslint] Allow "latest" as ecmaVersion #13638

Merged
merged 4 commits into from Aug 30, 2021

Conversation

fisker
Copy link
Contributor

@fisker fisker commented Aug 5, 2021

Q                       A
Fixed Issues? Closes #13699
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Ref eslint/eslint#14720

@babel-bot
Copy link
Collaborator

babel-bot commented Aug 5, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48262/

@@ -11,7 +11,7 @@ exports.normalizeESLintConfig = function (options) {

return {
babelOptions: { cwd: process.cwd(), ...babelOptions },
ecmaVersion,
ecmaVersion: ecmaVersion === 'latest' ? 2020 : ecmaVersion,
Copy link
Member

Choose a reason for hiding this comment

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

Does it throw if we just directly pass "latest"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know, I can't find where it's used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

eslint-scope does not support 'latest' as valid. Does is make more sense to update it there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint-scope suggest handling on parser side. eslint/eslint-scope#74 (comment)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 5, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit fb7cdea:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@fedeci fedeci added area: eslint PR: New Feature 🚀 A type of pull request used for our changelog categories labels Aug 7, 2021
@@ -11,7 +11,7 @@ exports.normalizeESLintConfig = function (options) {

return {
babelOptions: { cwd: process.cwd(), ...babelOptions },
ecmaVersion,
ecmaVersion: ecmaVersion === "latest" ? 2020 : ecmaVersion,
Copy link
Contributor

Choose a reason for hiding this comment

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

The latest is 2022 as of August 2021. I think we can normalize "latest" to 1e8 like acorn did (https://github.com/acornjs/acorn/blob/691a31b1e3d6936f4e6991da3d81c1a6b06610cf/acorn/src/options.js#L109) so we don't have to update it every year.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea.

Copy link
Member

Choose a reason for hiding this comment

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

See you again in 99997979 years to update this!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I won't miss the date.

@nicolo-ribaudo nicolo-ribaudo changed the title Allow "latest" as ecmaVersion [eslint] Allow "latest" as ecmaVersion Aug 30, 2021
@nicolo-ribaudo nicolo-ribaudo merged commit c1f5ca6 into babel:main Aug 30, 2021
@fisker fisker deleted the ecma-version-latest branch August 30, 2021 10:20
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: eslint outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@babel/eslint-parser should support ecmaVersion: latest
5 participants