ESLint plugin for BAM
This project is an ESLint plugin that gathers all the rules, plugins and parsers that should be used in any new BAM project.
Quick Setup
Install the plugin and its peer dependencies:
yarn add --dev @bam.tech/eslint-plugin
npx install-peerdeps --dev @bam.tech/eslint-plugin
Then update your .eslintrc
config file:
{
"extends": "plugin:@bam.tech/recommended",
"overrides": [
{
"files": ["*.test.tsx"],
"extends": "plugin:@bam.tech/tests"
}
]
}
Shareable configurations
This plugin exports multiple configurations that can be used in your .eslintrc
config file:
Name | Description |
---|
@bam.tech/recommended | The recommended config for all projects |
@bam.tech/tests | The recommended config for test files. By default this applies to every file: put it in an overrides to filter on your test files. |
These configs need some peer dependencies. You can list them with:
npm info "@bam.tech/esling-plugin" peerDependencies
If you use npm >= 5 you can automatically install them by running:
npx install-peerdeps @bam.tech/eslint-config -D
Eslint rules
This plugin exports some custom rules that you can optionally use in your project:
To use a rule, just declare it in your .eslintrc
:
{
"plugins": ["@bam.tech"],
"rules": {
"@bam.tech/require-named-effect": "error"
}
}
Tip: if your config is already extended from a @bam.tech
config, you don't need to declare the plugin.
How to customize?
You can still customize your ESLint config by adding other configurations, plugins and rules to your .eslintrc
config file.
If you find a useful rule that you feel every project at BAM should use, feel free to contribute.