[eslint] Allow "latest" as ecmaVersion#13638
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48262/ |
| return { | ||
| babelOptions: { cwd: process.cwd(), ...babelOptions }, | ||
| ecmaVersion, | ||
| ecmaVersion: ecmaVersion === 'latest' ? 2020 : ecmaVersion, |
There was a problem hiding this comment.
Does it throw if we just directly pass "latest"?
There was a problem hiding this comment.
I don't know, I can't find where it's used.
There was a problem hiding this comment.
But yes, if we use "latest", the parser throws https://github.com/sindresorhus/eslint-plugin-unicorn/pull/1465/checks?check_run_id=3248815028#step:5:18825
There was a problem hiding this comment.
eslint-scope does not support 'latest' as valid. Does is make more sense to update it there?
There was a problem hiding this comment.
eslint-scope suggest handling on parser side. eslint/eslint-scope#74 (comment)
|
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:
|
| return { | ||
| babelOptions: { cwd: process.cwd(), ...babelOptions }, | ||
| ecmaVersion, | ||
| ecmaVersion: ecmaVersion === "latest" ? 2020 : ecmaVersion, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
See you again in 99997979 years to update this!
There was a problem hiding this comment.
I won't miss the date.
"latest" as ecmaVersion"latest" as ecmaVersion
Ref eslint/eslint#14720