@ compriled/eslint- plugin (英语)
此插件包含规则, 用于工作时 @compiled/react。 。 。 .
安装
npm install @compiled/eslint-plugin --save-dev
使用量
平面配置
导入 @compiled/eslint-plugin 并添加到您这样的插件中,然后在“支持规则”栏下配置您想要使用的规则.
import compiled from '@compiled/eslint-plugin';
export default [
{
plugins: {
'@compiled': compiled,
},
rules: {
'@compiled/no-js-xcss': 'error',
},
},
];
通过扩展 flat/recommended 这样配置 :
import compiled from '@compiled/eslint-plugin';
export default [compiled.configs['flat/recommended']];
遗产配置( E).eslintrc(中文(简体) )
添加 @compiled 到您的插件区 .eslintrc 配置文件,然后在规则节下配置您想要使用的规则.
{
"plugins": ["@compiled"],
"rules": {
"@compiled/no-js-xcss": "error"
}
}
您也可以通过添加来启用推荐的规则进行编译 plugin:@compiled/recommended 扩展中:
{
+ "extends": ["plugin:@compiled/recommended"],
- "plugins": ["@compiled"]
}
支持的规则
* 包括在建议的配置中.
自动修复 --fix CLI 选项。
| 名称 | 说明 | 建议 | 可修复 |
|---|---|---|---|
| @ 编译/jsx-pragma | 使用时执行 jsx pragma css 道具 | 🔧 | |
| @ 编译/ local- cx- xss | 确保 cx() 函数仅在 xcss 道具 | ✅ | |
| @ compiled/ no- css- prof- unite- cs- 函数 | 否定 css 道具用途,如果它不是包裹在 css 从 @compiled/react 或在何处 @compiled 无法确定是否 css 导入包含在构建时间. | ✅ | 🔧 |
| @ compiled/ no- css- tagn- template- expression (没有标记) @ info: whatsthis | 放弃 css 标记模板表达式 | ✅ | 🔧 |
| @ 编译/ 否情感- css | 否定 @emotion 用途 | 🔧 | |
| @ compiled/ no- 空- speating- speating | 拒绝任何 styled 表达式,用于通过空参数时 @compiled/react | ✅ | |
| @ 编译/ 不出口- css | 否定 css 从导出用途 | ✅ | |
| @ 编译/ 不导出键框 | 否定 keyframes 从导出用途 | ✅ | |
| @ 编译/ 无效- css- map | 检查通过 assMap 创建的 CSS 映射的有效性。 此功能意在与 TypeScript 的类型检查同时使用 . | ✅ | |
| @ 编译/ no-js- xcs | Xcss道具的前提是遵守类型合同。 在不使用TypeScript的情况下使用它会打破这个合同,因此是不允许的. | ✅ | |
| @ compiled/ no- keyframes- tagn- template- expression 翻译/ 无键框- template- 表达式 | 放弃 keyframes 标记模板表达式 | ✅ | 🔧 |
| @ 编译/ 无类标记- template- expression | 放弃 styled 标记模板表达式 | ✅ | 🔧 |
| @ compriled/ no- suppress- xcss (英语) | Xcss道具的前提是遵守类型合同。 扣压它违反合同,因此不允许. | ✅ | |
| @ 编译/ 短手财产类型 | 通过确保短手属性在相应的长手属性之前总是被定义来防止不必要的副作用. | ✅ |