[flat config] rules do not support `languageOptions.ecmaVersion`
See original GitHub issueEnvironment
Node version: v18.10.0 npm version: v8.19.2 Local ESLint version: v8.24.0 (Currently used) Global ESLint version: Not found Operating System: linux 5.19.0-2-amd64
What parser are you using?
Default (Espree)
What did you do?
use comma-dangle
with new flat config with languageOptions.ecmaVersion = 'latest'
and comma-dangle
configured as ['error', 'always-multiline']
What did you expect to happen?
comma-dangle
would impart 'error'
for 'functions'
What actually happened?
comma-dangle
does not impart 'error'
for 'functions'
, due to failing ecmaVersion
check
Participation
- I am willing to submit a pull request for this issue.
Additional comments
other rules suffer similarly, expecting ecmaVersion
to be a Number
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
[flat config] ecmaVersion: "latest" #15366 - eslint/eslint - GitHub
An in-range version of espree can support ecmaVersion that is not supported by currently used version of ESLint. If we use espree.
Read more >Language Options - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >How to correctly configure the parser & plugins with ESLint's ...
Im using flat config with typescript. Heres what I think are the important parts of the config:
Read more >Troubleshoot AWS Config rules that don't work
Various issues can cause managed AWS Config rules to not work, including permissions, resource scope, or configuration change items.
Read more >eslint - Awesome JS
1a327aa fix: Ensure flat config unignores work consistently like eslintrc (#16579) ... 75276c9 docs: reorder options in no-unused-vars (#16625) (Milos ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, so
'latest'
itself is not the problem. The problem is thatcomma-dangle
and a few other core rules are usingcontext.parserOptions.ecmaVersion
, which isn’t set in the flat config mode.Possible solutions are:
context.languageOptions.ecmaVersion
instead.Linter
to setcontext.parserOptions.ecmaVersion
(based oncontext.languageOptions.ecmaVersion
).I think we should do
1.
even if we later decide to implement2.
for backward compatibility, so updating rules seems like the right fix for this problem.Option 1 is the intended way to fix this. It should work for
eslintrc
configurations as well.