@compiled/eslint-plugin
This plugin contains rules that should be used when working with @compiled/react
.
Installation
npm install @compiled/eslint-plugin --save-dev
Usage
Flat Config
Import the @compiled/eslint-plugin
and add it to your plugins like so, then configure the rules you want to use under the "Supported rules" section.
import compiled from '@compiled/eslint-plugin';
export default [
{
plugins: {
'@compiled': compiled,
},
rules: {
'@compiled/no-js-xcss': 'error',
},
},
];
You can also enable the recommended rules for compiled by extending the flat/recommended
config like so:
import compiled from '@compiled/eslint-plugin';
export default [compiled.configs['flat/recommended']];
Legacy Config (.eslintrc
)
Add @compiled
to the plugins section of your .eslintrc
configuration file, then configure the rules you want to use under the rules section.
{
"plugins": ["@compiled"],
"rules": {
"@compiled/no-js-xcss": "error"
}
}
You can also enable the recommended rules for compiled by adding plugin:@compiled/recommended
in extends:
{
+ "extends": ["plugin:@compiled/recommended"],
- "plugins": ["@compiled"]
}
Supported rules
✅ Included in the recommended configuration.
🔧 Automatically fixable by the --fix
CLI option.\