Apply as many of the conventions called out in Rapid7's Javascript styleguide as possible via an extensible shared ESLint config.
Install ESLint as well as the config.
$ npm install eslint eslint-config-rapid7 --save-dev
Update your .eslintrc
to extend the configs you want to apply.
{
"extends": ["rapid7/browser", "rapid7/react"]
}
If you want to override / modify specific rules, you can do so in your rules
section.
{
"extends": ["rapid7/browser", "rapid7/strict"],
"rules": {
"no-magic-numbers: 0
}
}
- rapid7: Base config, lints standard javascript for all environments
- rapid7/strict: Provides additional rules and overrides of certain base rules for a more strict linting of standard javascript for all environments
- rapid7/browser: Lints javascript specific to implementations in a browser environment
- Includes
rapid7
in rules
- Includes
- rapid7/node: Lints javascript specific to implementations in a NodeJS environment
- Includes
rapid7
in rules
- Includes
- rapid7/react: Lints javascript specific to use with ReactJS
To apply multiple configurations, pass an array of configs instead of a string to extends
in your .eslintrc
:
{
"extends": ["rapid7/browser", "rapid7/react", "rapid7/strict"]
}
See Rapid7's Javascript styleguide and the ESlint config docs for more information.