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 can't recognise nullish coalescing operator with plugin:n/recommended #73

Closed
anantakrishna opened this issue Dec 6, 2022 · 1 comment

Comments

@anantakrishna
Copy link

anantakrishna commented Dec 6, 2022

"eslint": "8.24.0"
"eslint-plugin-n": "15.6.0"

.eslintrc.yml:

root: true
env:
  node: true
  es2021: true
parserOptions:
  sourceType: module
extends:
  - eslint:recommended
  - plugin:n/recommended
  - prettier

package.json:

  "engines": {
    "node": "16"
  },

VSCode shows the following error for nullish coalescing operator:

Parsing error: Unexpected token ?

image

According to node.green, this operator is supported in Node v16: https://node.green/#ES2020-features--nullish-coalescing-operator-----

Running eslint with --print-config shows:

"ecmaVersion": 2019

Perhaps, this is the cause. But why is it 2019?

Disabling plugin:n/recommended removes the above mentioned eslint error, but it brings back another error about instance class fields, which is part of ES2022. This feature is supported by Node v16, but I can't specify "ecmaVersion": 2022 because Node v16 does not support it fully. This was my motivation for using eslint-plugin-n.

@anantakrishna anantakrishna changed the title Eslint can't recognise nnullish coalescing operator with plugin:n/recommended Eslint can't recognise nullish coalescing operator with plugin:n/recommended Dec 7, 2022
@scagood
Copy link

scagood commented Nov 26, 2023

We currently support node >= v16 and eslint >= v7

Support was dropped in #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants