question-mark
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.

Bug: running eslint --init generates a .eslint.json file with parserOptions.ecmaversion set to 13

See original GitHub issue

Environment

Node version: v14.17.5 npm version: 6.14.14 Local ESLint version: 7.32.0 Global ESLint version: – Operating System: Ubuntu Linux

What parser are you using?

Default (Espree)

What did you do?

Configuration
{
    "env": {
        "commonjs": true,
        "es2021": true,
        "node": true
    },
    "extends": [
        "standard"
    ],
    "parserOptions": {
        "ecmaVersion": 13
    },
    "rules": {
    }
}
function hello() {
  console.log('hello')
}

Configuration is result from running npx eslint --init after installing eslint locally in an empty project.

Eslint shows an error at the first line of function shown saying Parsing error: Invalid ecmaVersion.

What did you expect to happen?

When running npx eslint --init I expect that it generates an .eslintrc file with valid options. According to documentation, supported options for parserOptions.ecmaVersion are 3, 5 (default), 6, 7, 8, 9, 10, 11, or 12 .

What actually happened?

npx eslint --init generated an .eslintrc file with parserOptions.ecmaVersion set to 13.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

Would love to help if anything. Just not sure where to start.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
aladdin-addcommented, Jan 8, 2022

yes, I think the issue has been fixed in the new package, and the docs will be updated in https://github.com/eslint/eslint/pull/15150 (likely to be merged soon).

1reaction
aladdin-addcommented, Dec 5, 2021

@vicasas we are working on a new cli @eslint/create-config to replace eslint --init. it will be fixed in the new repo, please follow https://github.com/eslint/eslint/issues/14768 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Options - ESLint - Pluggable JavaScript Linter
Parser options are set in your .eslintrc.* file with the parserOptions property. The available options are: ecmaVersion - set to 3, 5 (default) ......
Read more >
ESLint - Error: Must use import to load ES Module
eslintrc, add "requireConfigFile": false, to the parserOptions section (underneath "ecmaVersion": 8, ) (I needed this or babel was looking for ...
Read more >
Basic Features: ESLint - Next.js
js will automatically install eslint and eslint-config-next as development dependencies in your application and create an .eslintrc.json file in the root of ...
Read more >
parseroptions.project has been set for @typescript-eslint/parser
Create a new tsconfig.eslint.json Add .eslintrc in .eslintignore Ensure that ... been set for @typescript-eslint/parser” arises when ESLint runs into a file ......
Read more >
eslint/eslint - Gitter
Hello, any idea why I'm getting an invalid ecmaVersion when setting to 2020 ... 20 seconds to lint all our ~1.5k files. eslint...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found