1.1.0 • Published 3 years ago
@smartclip/eslint-plugin-react v1.1.0
Installation
npm i -D @smartclip/eslint-plugin-reactUsage
Add @smartclip/react to the plugins section of your .eslintrc configuration file. You
can omit the eslint-plugin- prefix:
{
"plugins": ["@smartclip/react"]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"@smartclip/react/tests-use-aaa": "error",
}
}Or extend from the preconfigured configs:
{
"extends": [
"plugin:@smartclip/react/all",
]
}Running rules only on test-related files
Some of the rules provided by this plugin assume that the files they are checking are test-related. This means it's generally not suitable to include them in your top-level configuration as that applies to all files being linted which can include source files.
You can use overrides to have ESLint apply additional rules to specific files:
{
"overrides": [
{
"files": ["**/*.test.ts"],
"extends": ["plugin:@smartclip/react/all"],
}
],
}Shareable configurations
All
If you want to enable all rules instead of only some you can do so by adding the
all configuration to your .eslintrc config file:
{
"extends": ["plugin:@smartclip/react/all"]
}Development
- Rules get automatically sourced from the src/rules folder -> make sure to default export them in there
- Every rule should have tests that assure this rule applies correctly to the code
- If your done developing your new rule run
npm run buildto compile the code in thelibfolder