Search code examples
javascriptnode.jseslint

Specify node version for eslint


I'm using eslint for a Node.js application. I'm running node version v10.6.0, but when I run eslint in the root directory of my project, I get error messages like the following:

The 'URL' is not supported until Node.js 10.0.0. The configured version range is '>=6.0.0'

My .eslintrc.json looks like this:

{
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended",
  ],
  "parserOptions": {
    "sourceType": "module"
  }
}

and my package.json contains:

"engine": {
    "node": ">=10.6.0"
}

How can I tell eslint that I'm using a newer node version? I'm using eslint v5.2.0.


Solution

  • The engine property in the package.json file is incorrect and should be engines instead. This is the property that eslint uses to determine the node version.