Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 425
forrert Avatar asked Aug 01 '18 06:08

forrert


People also ask

How do I use ESLint in node JS?

While ESLint is designed to be run on the command line, it's possible to use ESLint programmatically through the Node. js API. The purpose of the Node. js API is to allow plugin and tool authors to use the ESLint functionality directly, without going through the command line interface.

How do I change my ESLint settings?

There are two primary ways to configure ESLint: Configuration Comments - use JavaScript comments to embed configuration information directly into a file. Configuration Files - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories.

How do I check ESLint version?

Go to C:\Users\\{YourWindowsUsername}\AppData\Local\Microsoft\TypeScript\ESLint . Open the package. json file. You should see the version of ESLint that is installed, in my case it is "eslint": "4.19.

Does ESLint support ES6?

ESLint is a JavaScript linter (static analysis tool) that offers full support for ES6, JSX, and other modern tools via plugins.


1 Answers

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.

like image 99
forrert Avatar answered Sep 27 '22 19:09

forrert