Installation and Usage
There are two ways to install ESLint: globally and locally.
Local Installation and Usage
If you want to include ESLint as part of your project’s build system, we recommend installing it locally. You can do so using npm:1
$ npm install eslint --save-dev
You should then setup a configuration file:1
$ ./node_modules/.bin/eslint --init
After that, you can run ESLint on any file or directory like this:1
$ ./node_modules/.bin/eslint yourfile.js
Any plugins or shareable configs that you use must also be installed locally to work with a locally-installed ESLint.
Global Installation and Usage
If you want to make ESLint available to tools that run across all of your projects, we recommend installing ESLint globally. You can do so using npm:1
$ npm install -g eslint
You should then setup a configuration file:1
$ eslint --init
After that, you can run ESLint on any file or directory like this:1
$ eslint yourfile.js
Any plugins or shareable configs that you use must also be installed globally to work with a globally-installed ESLint.