eslint-config-endouble
Endouble's Javascript ESLint configuration, based on AirBnB's
Install and Usage
1. Installing
Make sure you have Node (>=6) installed
yarn add --dev @endouble.com/eslint-config-endouble
2. Using
Create an .eslintrc.json
file at the root of your project and add the following configuration:
2.1. Simple setup
For vanilla Javascript code
{
"extends": "@endouble.com/eslint-config-endouble"
}
2.2. React setup
For React based apps
{
"extends": "@endouble.com/eslint-config-endouble/react"
}
2.3. CSB setup
For CSB websites
{
"extends": "@endouble.com/eslint-config-endouble/csb"
}
3. Extra configuration
Add to package.json
a script to lint your desired files:
{
"scripts": {
"lint": "eslint js/*.js"
}
}
Rules
Please refer to AirBnB's Styleguide for more information about the linter's rules.
Custom rules
This rules overwrite the ones inherited from AirBnB Styleguide
setup | rule | setting |
---|---|---|
all | indent | 4 spaces, { SwitchCase: 1 } |
all | max-len | 120 characters |
all | object-curly-newline | error, { consistent: true } |
react | react/jsx-indent | 4 spaces |
react | react/jsx-indent-props | 4 spaces |
react | react/jsx-filename-extension | off |
react | react-hooks/rules-of-hooks | error |
react | react-hooks/exhaustive-deps | warn |
react | jsx-a11y/href-no-hash | off |
react | jsx-a11y/label-has-for | error, { allowChildren: true } |
react | jsx-a11y/anchor-is-valid | error, { specialLink: ['to'] } |
react | import/no-extraneous-dependencies | error, { devDependencies: true } |
react | import/no-unresolved | error, { commonjs: true, amd: true } |
Tests
yarn test
Maintainers
License
MIT