# @code-pushup/eslint-config 中文文档

规范地址：https://npmcn.com/package/%40code-pushup/eslint-config/

版本：0\.17\.3
npm 元数据更新时间：2026-11-03T12:37:53.425Z
中文译文更新时间：2026-11-10T06:13:56.283Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40code-pushup/eslint-config
原文对照：https://npmcn.com/package/%40code-pushup/eslint-config/?lang=original
项目主页：https://github.com/code-pushup/eslint-config/tree/main/packages/eslint-config#readme
源码仓库：https://github.com/code-pushup/eslint-config

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：66.6 kB，20 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：0 个
- peer 依赖：eslint ^9\.0\.0，globals \>=14\.0\.0，@eslint/js ^9\.0\.0，angular-eslint ^18\.0\.0 \|\| ^19\.0\.0 \|\| ^20\.0\.0 \|\| ^21\.0\.0，eslint-plugin-n \>=17\.0\.0，typescript-eslint ^8\.0\.0，eslint-plugin-jest ^28\.8\.0 \|\| ^29\.0\.0，@ngrx/eslint-plugin ^18\.0\.0 \|\| ^19\.0\.0 \|\| ^20\.0\.0 \|\| ^21\.0\.0，eslint-plugin-react ^7\.36\.0，eslint-plugin-import ^2\.31\.0，eslint-plugin-rxjs-x \>=0\.6\.0，@vitest/eslint-plugin ^1\.1\.9，eslint-plugin-cypress \>=3\.3\.0，eslint-plugin-promise \>=6\.4\.0，eslint-plugin-sonarjs ^1\.0\.4，eslint-plugin-unicorn \>=50\.0\.0，eslint-plugin-jsx-a11y ^6\.10\.0，eslint-plugin-storybook \>=0\.10\.0，eslint-plugin-functional ^7\.0\.0 \|\| ^8\.0\.0 \|\| ^9\.0\.0，eslint-plugin-playwright ^2\.1\.0，eslint-plugin-react-hooks \>=5\.0\.0，@graphql-eslint/eslint-plugin ^3\.0\.0 \|\| ^4\.0\.0，eslint-plugin-testing-library ^7\.1\.1，eslint-import-resolver-typescript ^3\.0\.0 \|\| ^4\.0\.0
- 首次发布：2023-11-23T17:19:11.504Z
- 最新版本发布：2026-11-03T12:37:53.026Z
- 近 30 天下载量：4362（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：57（近 12 个月 10 个）

## 中文简介

通过代码 PushUp 推荐的 ESLint 预设

## 安装

```sh
npm install @code-pushup/eslint-config
```

也可以使用：`pnpm add @code-pushup/eslint-config`、`yarn add @code-pushup/eslint-config`、`bun add @code-pushup/eslint-config`

## README

# @ code- pushup/ eslint- config

[![npm](https://img.shields.io/npm/v/%40code-pushup%2Feslint-config.svg)](https://www.npmjs.com/package/@code-pushup/eslint-config) [![downloads](https://img.shields.io/npm/dm/%40code-pushup%2Feslint-config)](https://npmtrends.com/@code-pushup/eslint-config) [![dependencies](https://img.shields.io/librariesio/release/npm/%40code-pushup/eslint-config)](https://www.npmjs.com/package/@code-pushup/eslint-config?activeTab=dependencies) [![license](https://img.shields.io/npm/l/%40code-pushup%2Feslint-config)](https://opensource.org/licenses/MIT)

建议的 ESLint 预设 [代码推进](https://github.com/code-pushup/cli/tree/main/packages/cli)。 。 。 .

## 组合

| 堆栈 | 配置 | 说明 |
| :-: | :-- | :-: |
| ![javascript](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/javascript.png) | [日记](https://npmcn.com/package/%40code-pushup/eslint-config/docs/javascript.md) | 默认配置, 适合任意 **Java 脚本/ Type 脚本** 项目. |
| ![typescript](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/typescript.png) | [类型标记](https://npmcn.com/package/%40code-pushup/eslint-config/docs/typescript.md) | 严格配置 **类型脚本** 项目. |
| ![nodejs](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/nodejs.png) | [节点](https://npmcn.com/package/%40code-pushup/eslint-config/docs/node.md) | 配置 **节点.js** 项目. |
| ![angular](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/angular.png) | [角线](https://npmcn.com/package/%40code-pushup/eslint-config/docs/angular.md) | 配置 **角质** 项目. |
| ![ngrx](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/ngrx.png) | [ngrx (韩语)](https://npmcn.com/package/%40code-pushup/eslint-config/docs/ngrx.md) | 配置 **角质** 使用 **NgRx 函数** 图书馆. |
| ![react](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/react.png) | [反应](https://npmcn.com/package/%40code-pushup/eslint-config/docs/react.md) | 配置 **反应** 项目. |
| ![graphql](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/graphql.png) | [图表ql](https://npmcn.com/package/%40code-pushup/eslint-config/docs/graphql.md) | 配置 **图QL 服务器** 在Node.js执行. |
| ![jest](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/jest.png) | [欢笑](https://npmcn.com/package/%40code-pushup/eslint-config/docs/jest.md) | 使用的项目配置 **欢乐** 测试. |
| ![vitest](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/vitest.png) | [测试](https://npmcn.com/package/%40code-pushup/eslint-config/docs/vitest.md) | 使用的项目配置 **维特** 测试. |
| ![cypress](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/cypress.png) | [锡压](https://npmcn.com/package/%40code-pushup/eslint-config/docs/cypress.md) | 使用的项目配置 **齐压** 测试. |
| ![playwright](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/playwright.png) | [剧作家](https://npmcn.com/package/%40code-pushup/eslint-config/docs/playwright.md) | 使用的项目配置 **剧作家** 测试. |
| ![storybook](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/storybook.png) | [故事书](https://npmcn.com/package/%40code-pushup/eslint-config/docs/storybook.md) | 使用的项目配置 **故事书** 用于UI组件. |
| ![testing-library](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/testing-library.png) | [反应-测试-图书馆](https://npmcn.com/package/%40code-pushup/eslint-config/docs/react-testing-library.md) | 使用的项目配置 **反应测试库** 测试. |

一些配置扩展了其他配置,如下文所说明. 所以,例如,扩展 `angular` 默认扩展配置 `typescript` 财务报告和审定财务报表 `javascript` 况相也.

```mermaid
  graph BT;
    typescript --extends--> javascript
    node --extends--> javascript
    angular --extends--> typescript
    ngrx --extends--> angular
    react --extends--> javascript
    graphql --extends--> node
```

### QQ 设置

要使用默认配置, 请遵循这些步骤 :

1.  您必须首先安装所有所需的对等关系依赖( 如果您还没有) :
    
    ```sh
    npm install -D eslint @eslint/js eslint-plugin-{functional,import,promise,sonarjs,unicorn} globals typescript-eslint
    ```
    
2.  安装 `@code-pushup/eslint-config` 改为:
    
    ```sh
    npm install -D @code-pushup/eslint-config
    ```
    
3.  在您的配置中包含默认配置 [ESLint 配置文件](https://eslint.org/docs/latest/use/configure/configuration-files) (通常情况) `eslint.config.js`:
    
    ```js
    import javascript from '@code-pushup/eslint-config/javascript.js';
    import { defineConfig } from 'eslint/config';
    
    export default defineConfig(...javascript);
    ```
    

取决于您的技术堆栈, 您可能也想要扩展其他配置( E) :[以上所列](https://npmcn.com/package/%40code-pushup/eslint-config/#readme-%E2%9A%99%EF%B8%8F-configs)) (中文(简体) ). 这将需要安装额外的同伴依赖。 更多细节,请参考您感兴趣的配置设置文件 .

#### \* 同行依赖关系

使用的所有对等依赖性 `@code-pushup/eslint-config` 现将其及其支持的版本列出如下。 只要求默认配置的依赖性,其他的则是可选的.

|  | 国家防范机制一揽子计划 | 版本 | 需求 |
| :-: | :-- | :-: | :-: |
| ![eslint](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/eslint.png) | [埃斯林特语name](https://www.npmjs.com/package/eslint) | `^9.0.0` | ✅ |
| ![eslint](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/eslint.png) | [@slint/js (英语)](https://www.npmjs.com/package/@eslint/js) | `^9.0.0` | ✅ |
| ![lambda](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/lambda.png) | [eslint- 插件功能](https://www.npmjs.com/package/eslint-plugin-functional) | `^7.0.0 || ^8.0.0 || ^9.0.0` | ✅ |
| ![import](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/import.png) | [埃斯林特-插头-进口](https://www.npmjs.com/package/eslint-plugin-import) | `^2.31.0` | ✅ |
| ![import](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/import.png) | [eslint- import- resolver- 类型标记](https://www.npmjs.com/package/eslint-import-resolver-typescript) | `^3.0.0 || ^4.0.0` |  |
| ![promise](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/promise.png) | [埃斯林特- 插座- 保证](https://www.npmjs.com/package/eslint-plugin-promise) | `>=6.4.0` | ✅ |
| ![sonar](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/sonar.png) | [埃斯林特- 插孔- sonarjs](https://www.npmjs.com/package/eslint-plugin-sonarjs) | `^1.0.4` | ✅ |
| ![unicorn](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/unicorn.png) | [斯林特-插孔-独角兽](https://www.npmjs.com/package/eslint-plugin-unicorn) | `>=50.0.0` | ✅ |
| ![global](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/global.png) | [全球](https://www.npmjs.com/package/globals) | `>=14.0.0` | ✅ |
| ![typescript](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/typescript.png) | [类型标记- slint](https://www.npmjs.com/package/typescript-eslint) | `^8.0.0` | ✅ |
| ![graphql](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/graphql.png) | [@graphql-eslint/eslint-插件](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin) | `^3.0.0 || ^4.0.0` |  |
| ![ngrx](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/ngrx.png) | [@ngrx/slint-plugin (英语)](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0` |  |
| ![vitest](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/vitest.png) | [@vitest/eslint-plugin (英语)](https://www.npmjs.com/package/@vitest/eslint-plugin) | `^1.1.9` |  |
| ![angular](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/angular.png) | [角叶林特](https://www.npmjs.com/package/angular-eslint) | `^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0` |  |
| ![cypress](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/cypress.png) | [斯林特-插平-圆压](https://www.npmjs.com/package/eslint-plugin-cypress) | `>=3.3.0` |  |
| ![jest](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/jest.png) | [埃斯林特- 插座- 捷运](https://www.npmjs.com/package/eslint-plugin-jest) | `^28.8.0 || ^29.0.0` |  |
| ![accessibility](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/icons8/accessibility.png) | [埃斯林特-插头-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) | `^6.10.0` |  |
| ![nodejs](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/nodejs.png) | [埃斯林特-插头-n](https://www.npmjs.com/package/eslint-plugin-n) | `>=17.0.0` |  |
| ![playwright](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/playwright.png) | [埃斯林特- 插座- 播放器](https://www.npmjs.com/package/eslint-plugin-playwright) | `^2.1.0` |  |
| ![react](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/react.png) | [eslint- 插件反应](https://www.npmjs.com/package/eslint-plugin-react) | `^7.36.0` |  |
| ![react\_ts](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/react_ts.png) | [eslint-plugin- react-hooks (英语)](https://www.npmjs.com/package/eslint-plugin-react-hooks) | `>=5.0.0` |  |
| ![rxjs](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/rxjs.png) | [埃斯林特-插头-rxjs-x](https://www.npmjs.com/package/eslint-plugin-rxjs-x) | `>=0.6.0` |  |
| ![storybook](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/material/storybook.png) | [埃斯林特-插图-故事手册](https://www.npmjs.com/package/eslint-plugin-storybook) | `>=0.10.0` |  |
| ![testing-library](https://npmcn.com/package/%40code-pushup/eslint-config/docs/icons/other/testing-library.png) | [eslint-plugin-测试-图书馆](https://www.npmjs.com/package/eslint-plugin-testing-library) | `^7.1.1` |  |

### QQ 测试覆盖

对于非生产代码,一些规则被禁用(或从错误降级到警告).

这适用于匹配以下任何一格的文件路径 :

-   `**/*.spec.?(c|m)[jt]s?(x)`
-   `**/*.test.?(c|m)[jt]s?(x)`
-   `**/__tests__/**/*.?(c|m)[jt]s?(x)`
-   `**/__mocks__/**/*.?(c|m)[jt]s?(x)`
-   `**/*.cy.?(c|m)[jt]s?(x)`
-   `**/*.stories.?(c|m)[jt]s?(x)`
-   `**/*.e2e.?(c|m)[jt]s?(x)`
-   `**/*.mock.?(c|m)[jt]s?(x)`
-   `**/*.mocks.?(c|m)[jt]s?(x)`
-   `**/test/**/*.?(c|m)[jt]s?(x)`
-   `**/tests/**/*.?(c|m)[jt]s?(x)`
-   `**/mocks/**/*.?(c|m)[jt]s?(x)`
-   `**/testing-utils/**/*.?(c|m)[jt]s?(x)`
-   `**/test-utils/**/*.?(c|m)[jt]s?(x)`
-   `**/fixtures/**/*.?(c|m)[jt]s?(x)`
-   `**/*.config.?(c|m)[jt]s`
-   `**/.prettierrc.?(c|m)[jt]s`
-   `**/codegen.?(c|m)[jt]s`
-   `**/test-setup.?(c|m)[jt]s`

## 常见问题

### @code-pushup/eslint-config 是什么？

通过代码 PushUp 推荐的 ESLint 预设

### 如何安装 @code-pushup/eslint-config？

在项目目录运行 npm install @code-pushup/eslint-config，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（^9\.0\.0）、globals（\>=14\.0\.0）、@eslint/js（^9\.0\.0）、typescript-eslint（^8\.0\.0）、eslint-plugin-import（^2\.31\.0）、eslint-plugin-promise（\>=6\.4\.0）、eslint-plugin-sonarjs（^1\.0\.4）、eslint-plugin-unicorn（\>=50\.0\.0）、eslint-plugin-functional（^7\.0\.0 \|\| ^8\.0\.0 \|\| ^9\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @code-pushup/eslint-config 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/code-pushup\_\_eslint-config 是否存在。

### @code-pushup/eslint-config 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @code-pushup/eslint-config 可以商用吗？

@code-pushup/eslint-config 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @code-pushup/eslint-config 的下载量有多少？

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

### @code-pushup/eslint-config 还在维护吗？

最新版本 0\.17\.3 发布于 2026/11/03（6 天前）；至今共发布 57 个版本，其中过去 12 个月发布了 10 个；首次发布于 2023/11/24。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

