Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[flat config] rules do not support `languageOptions.ecmaVersion`

See original GitHub issue


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


  • 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:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

mdjermanoviccommented, Oct 20, 2022

Okay, so 'latest' itself is not the problem. The problem is that comma-dangle and a few other core rules are using context.parserOptions.ecmaVersion, which isn’t set in the flat config mode.

Possible solutions are:

  1. Update rules to use context.languageOptions.ecmaVersion instead.
  2. Update Linter to set context.parserOptions.ecmaVersion (based on context.languageOptions.ecmaVersion).

I think we should do 1. even if we later decide to implement 2. for backward compatibility, so updating rules seems like the right fix for this problem.

nzakascommented, Oct 24, 2022

Option 1 is the intended way to fix this. It should work for eslintrc configurations as well.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found