@code-pushup/eslint-config

中文文档
0.17.3发布于 2026/11/03MITES Module零依赖构建来源已验证近 30 天下载 4362

Recommended ESLint presets by Code PushUp

原始使用文档
文档目录3 节
  1. ⚙️ Configs
  2. 🏗️ Setup
  3. 🧪 Test overrides

@code-pushup/eslint-config

npm downloads dependencies license

Recommended ESLint presets by Code PushUp.

⚙️ Configs

StackConfigDescription
javascriptjavascriptDefault config, suitable for any JavaScript/TypeScript project.
typescripttypescriptConfig for strict TypeScript projects.
nodejsnodeConfig for Node.js projects.
angularangularConfig for Angular projects.
ngrxngrxConfig for Angular projects using NgRx library.
reactreactConfig for React projects.
graphqlgraphqlConfig for GraphQL servers implemented in Node.js.
jestjestConfig for projects using Jest for testing.
vitestvitestConfig for projects using Vitest for testing.
cypresscypressConfig for projects using Cypress for testing.
playwrightplaywrightConfig for projects using Playwright for testing.
storybookstorybookConfig for projects using Storybook for UI components.
testing-libraryreact-testing-libraryConfig for projects using React Testing Library for testing.

Some configs extend other configs, as illustrated below. So, for example, extending angular config implicitly extends typescript and javascript configs as well.

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

🏗️ Setup

To use the default config, follow these steps:

  1. You must first install all the required peer dependencies (if you haven't already):

    npm install -D eslint @eslint/js eslint-plugin-{functional,import,promise,sonarjs,unicorn} globals typescript-eslint
    
  2. Install @code-pushup/eslint-config with:

    npm install -D @code-pushup/eslint-config
    
  3. Include default config in your ESLint configuration file (usually eslint.config.js):

    import javascript from '@code-pushup/eslint-config/javascript.js';
    import { defineConfig } from 'eslint/config';
    
    export default defineConfig(...javascript);
    

Depending on your tech stack, you may wish to extend other configs as well (listed above). This will require installing additional peer dependencies. For more details, refer to setup docs for the configs you're interested in using.

📦 Peer dependencies

All peer dependencies used by @code-pushup/eslint-config are listed below, along with their supported versions. Only the default config's dependencies are required, others are optional.

NPM packageVersionRequired
eslinteslint^9.0.0✅
eslint@eslint/js^9.0.0✅
lambdaeslint-plugin-functional^7.0.0 || ^8.0.0 || ^9.0.0✅
importeslint-plugin-import^2.31.0✅
importeslint-import-resolver-typescript^3.0.0 || ^4.0.0
promiseeslint-plugin-promise>=6.4.0✅
sonareslint-plugin-sonarjs^1.0.4✅
unicorneslint-plugin-unicorn>=50.0.0✅
globalglobals>=14.0.0✅
typescripttypescript-eslint^8.0.0✅
graphql@graphql-eslint/eslint-plugin^3.0.0 || ^4.0.0
ngrx@ngrx/eslint-plugin^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0
vitest@vitest/eslint-plugin^1.1.9
angularangular-eslint^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0
cypresseslint-plugin-cypress>=3.3.0
jesteslint-plugin-jest^28.8.0 || ^29.0.0
accessibilityeslint-plugin-jsx-a11y^6.10.0
nodejseslint-plugin-n>=17.0.0
playwrighteslint-plugin-playwright^2.1.0
reacteslint-plugin-react^7.36.0
react_tseslint-plugin-react-hooks>=5.0.0
rxjseslint-plugin-rxjs-x>=0.6.0
storybookeslint-plugin-storybook>=0.10.0
testing-libraryeslint-plugin-testing-library^7.1.1

🧪 Test overrides

For non-production code, some rules are disabled (or downgraded from errors to warnings).

This applies to file paths matching any of the following globs:

  • **/*.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 共发布 57 个版本,首次发布于 2023/11/24;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.17.3latest2026/11/036 天前
0.17.22026/07/084 个月前
0.17.12026/06/244 个月前
0.17.02026/05/155 个月前
0.16.32026/05/135 个月前
0.16.22026/05/115 个月前

关于 @code-pushup/eslint-config 的常见问题

@code-pushup/eslint-config 是什么?

Recommended ESLint presets by Code PushUp

如何安装 @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 和提交记录判断。