Endouble's Javascript ESLint configuration, based on AirBnB's
Make sure you have Node (>=6) installed
yarn add --dev @endouble.com/eslint-config-endoubleCreate an .eslintrc.json file at the root of your project and add the following configuration:
For vanilla Javascript code
{
"extends": "@endouble.com/eslint-config-endouble"
}For React based apps
{
"extends": "@endouble.com/eslint-config-endouble/react"
}For CSB websites
{
"extends": "@endouble.com/eslint-config-endouble/csb"
}Add to package.json a script to lint your desired files:
{
"scripts": {
"lint": "eslint js/*.js"
}
}Please refer to AirBnB's Styleguide for more information about the linter's 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 } |
yarn testMIT