This is Algolia's ESLint configuration for es5 and es6.
We extend airbnb/javascript rules.
npm install eslint eslint-config-algolia eslint-plugin-algolia eslint-config-airbnb eslint-plugin-react babel-eslint --save-devcreate an .eslintrc file:
{
"extends": "algolia"
}If you are using any editors plugin for ESLint then it will show you warnings/errors.
Now you can create an npm lint script that will run eslint . to lint all files or eslint . --quiet to hide warnings.
The rules are the ones from the Airbnb JavaScript style guide with modifications:
- disallow space-in-brackets
var arr = [ 1 ] - disallow space-in-parens
if ( true ) { } - disable vars-on-top
- disable no-param-reassign
function(param) { param = param } - warn on long lines max-len
- enable no-use-before-define for functions
- prefer function declarations func-style
See "Ignoring Files and Directories" on ESLint website.
You can have a ~/.eslintrc config that will be used if your project has no .eslintrc.
Create a ~/.eslintrc with:
{
"extends": "algolia"
}Then:
cd ~
npm install eslint eslint-config-algolia eslint-config-airbnb eslint-plugin-react