@compiled/eslint-plugin

中文文档
0.20.2发布于 2026/09/16Apache-2.0TypeScriptESM + CJS近 30 天下载 1981

一个熟悉且能表演的编译时间 CSS-in-JS 库用于React.

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 平面配置
  4. 遗产配置( E) .eslintrc (中文(简体) )
  5. 支持的规则

@ 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- xcsXcss道具的前提是遵守类型合同。 在不使用TypeScript的情况下使用它会打破这个合同,因此是不允许的.✅
@ compiled/ no- keyframes- tagn- template- expression 翻译/ 无键框- template- 表达式放弃 keyframes 标记模板表达式✅🔧
@ 编译/ 无类标记- template- expression放弃 styled 标记模板表达式✅🔧
@ compriled/ no- suppress- xcss (英语)Xcss道具的前提是遵守类型合同。 扣压它违反合同,因此不允许.✅
@ 编译/ 短手财产类型通过确保短手属性在相应的长手属性之前总是被定义来防止不必要的副作用.✅

版本与发布记录

@compiled/eslint-plugin 共发布 52 个版本,首次发布于 2021/11/04;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.20.2latest2026/09/161 个月前
0.20.12026/07/283 个月前
0.20.02026/06/184 个月前
0.19.22026/03/307 个月前
0.19.12025/01/081.8 年前
0.19.02024/12/191.9 年前

关于 @compiled/eslint-plugin 的常见问题

@compiled/eslint-plugin 是什么?

一个熟悉且能表演的编译时间 CSS-in-JS 库用于React.

如何安装 @compiled/eslint-plugin?

在项目目录运行 npm install @compiled/eslint-plugin,或使用 pnpm add / yarn add / bun add。

@compiled/eslint-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@compiled/eslint-plugin 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@compiled/eslint-plugin 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^16.0.0 || >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@compiled/eslint-plugin 可以商用吗?

@compiled/eslint-plugin 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@compiled/eslint-plugin 的下载量有多少?

根据 npm 官方下载统计,@compiled/eslint-plugin 在 2026/10/11 – 2026/11/09 这 30 天内被下载 1,981 次,日均约 66 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@compiled/eslint-plugin 还在维护吗?

最新版本 0.20.2 发布于 2026/09/16(1 个月前);至今共发布 52 个版本,其中过去 12 个月发布了 4 个;首次发布于 2021/11/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。