@sul/eslint-config v1.0.0
SUL ESLint
ESLint configuration for SUL projects.
Usage:
First install the rules:
npm install --save-dev eslint @sul/eslint-config
Then extend in your .eslintrc
:
{
"extends": "@sul/eslint-config",
"rules": {
// overrides
}
}
Configuration Customization
The default configuration is composed of several sub-configuration modules and can be used individually to customize your build:
possible-errors.js
best-practices.js
stylistic.js
es6/index.js
import/index.js
The es6
and import
configurations each have their own sub-configuration modules to futher customize your build.
Customization Example:
{
"extends": [
"@sul/eslint-config/possible-errors",
"@sul/eslint-config/best-practices",
"@sul/eslint-config/es6/possible-errors",
"@sul/eslint-config/import",
],
"rules": { /* custom rules */ }
}
Extended Configuration
This package also exposes a number of extended configurations for additional packages or modules. Pull in these configurations as needed.
Standalone:
{
"extends": "@sul/eslint-config/<config-name>"
}
Or in combination with the base configuration (recommended).
{
"extends": [
"@sul/eslint-config",
"@sul/eslint-config/<config-name>"
]
}
The following are available as extended configurations:
jest
: jest testing frameworkjsx-a11y
: eslint-plugin-jsx-a11y for rules regarding accessibility with JSX (eslint-plugin-jsx-a11y)react
: React JS library (eslint-plugin-react)webpack
: Webpack for the import plugin to work with webpack overloaded imports/requires (eslint-plugin-import and eslint-import-resolver-webpack)
Note: Sometimes you need to have the associated plugins installed to make things work. We recommend adding them as dependencies to your project if you're going to use the config for it.
Validate
To validate that all rules are being used:
npm run validate
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Please read CHANGELOG.md for detailed changes to this project.
Authors
- Andrew Smith - Initial work - Stiff Upper Lip
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgements
This package is heavily inspired by (and mostly stolen from) Kent C. Dodds.
5 years ago