ESLint¶
ESLint is an open-source project originally created by Nicholas C. Zakas in June 2013. Its goal is to provide a pluggable linting utility for Javascript.
http://eslint.org/
Enabling ESLint¶
If you have a .eslintrc
file in your repository, you can configure ESLint by adding the following lines to your configuration:
build:
nodes:
analysis:
tests:
override:
- eslint-run [file|dir|glob]
Please note that when passing a glob
as a parameter, it will be expanded by the shell.
If you want to use node glob
syntax, you have to quote your parameter, as follows:
eslint-run "lib/**"
eslint-run
is a built-in wrapper for ESLint which takes care of results and output format,
however all the options of ESLint are supported as well. For example:
eslint-run --config <config>
Custom ESLint Installation and ESLint Plugins¶
By default ESLint is already installed globally for your repository,
but if you would like to use a specific version of ESLint or a custom ESLint plugin like eslint-plugin-react
,
simply add them in the package.json
by:
$ npm install eslint-plugin-react --save-dev
$ npm install eslint --save-dev