eslint-config-algolia
This is Algolia's ESLint configuration for es5 and es6.
We extend airbnb/javascript rules.
Usage
npm install eslint eslint-config-algolia eslint-plugin-algolia eslint-config-airbnb eslint-plugin-react babel-eslint --save-dev
create an .eslintrc
file:
{
"extends": "algolia"
}
Tips
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.
Rules
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
Ignoring files
See "Ignoring Files and Directories" on ESLint website.
Using as a global eslint config
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