VSCode ESLint async functions not supported

Viewed 2363

I am trying to configure ESLint on VSCode, but I get this error when I use async/await functions:

Async functions are not supported until Node.js 7.6.0. The configured version range is '>=6.0.0'. (node/no-unsupported-features/es-syntax)"

But here is my .eslintrc.json:

{
  "root": true,
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2018
  },
  "env": {
    "node": true,
    "mocha": true
  }
}

Am I missing something?

1 Answers

Adding

  "engines": {
    "node": ">=7.6.0"
  }

to the module's package.json file should resolve these errors.

From https://github.com/mysticatea/eslint-plugin-node#readme ,

Note: It recommends a use of the "engines" field of package.json. The "engines" field is used by node/no-unsupported-features/* rules.

Related