npmnode.js95% confidence\u2191 87

eslint - Optional chaining error with vscode

Full error message
I am seeing a a red underline when I'm using an optional chain, but the code runs fine as I am on node 14

Here's my setup:

node 14.1.0
eslint "^6.8.0"

.eslintrc.js

module.exports = {
    "env": {
        "node": true
    },
    "extends": [
        "eslint:recommended",
    ],
    "parserOptions": {
        "sourceType": "module",
        "ecmaVersion": 2020
    },
    "rules": {
    },
}

You no longer need @babel/eslint-parser as eslint@^7.5 now supports optional chaining. Run the following to update eslint within your project: npm npm install --save-dev eslint@^7.5 yarn yarn add -D eslint@^7.5 And then, ensure your config is as follows: .eslintrc { "parserOptions": { "ecmaVersion": 2020 } } .eslint.js module.exports = { "parserOptions": { "ecmaVersion": 2020 } } See https://eslint.org/blog/2020/07/eslint-v7.5.0-released#optional-chaining-support for more information.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/713a7c0ddc21ba2dab3d79cd131813dd33a3b5800435c7eecbb0924ba1000c31
hash \u00b7 713a7c0ddc21ba2dab3d79cd131813dd33a3b5800435c7eecbb0924ba1000c31
eslint - Optional chaining error with vscode — DepScope fix | DepScope