# @dr\.pogodin/eslint-configs 中文文档

规范地址：https://npmcn.com/package/%40dr.pogodin/eslint-configs/

版本：0\.3\.11
npm 元数据更新时间：2026-11-07T20:00:30.700Z
中文译文更新时间：2026-11-12T21:53:03.160Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40dr.pogodin/eslint-configs
原文对照：https://npmcn.com/package/%40dr.pogodin/eslint-configs/?lang=original
项目主页：https://dr.pogodin.studio/docs/eslint-configs
源码仓库：https://github.com/birdofpreyru/eslint-configs

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

- 包体积（解压后）：33.3 kB，10 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：16 个
- peer 依赖：eslint-import-resolver-typescript ^4\.4\.5
- 首次发布：2025-04-07T15:48:35.507Z
- 最新版本发布：2026-11-07T20:00:30.536Z
- 近 30 天下载量：4429（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：45（近 12 个月 31 个）

## 中文简介

TypeScript 和/或反应项目的 ESLint 配置

## 安装

```sh
npm install @dr.pogodin/eslint-configs
```

也可以使用：`pnpm add @dr.pogodin/eslint-configs`、`yarn add @dr.pogodin/eslint-configs`、`bun add @dr.pogodin/eslint-configs`

## README

# ESLint 配置

[![Latest NPM Release](https://img.shields.io/npm/v/@dr.pogodin/eslint-configs.svg)](https://www.npmjs.com/package/@dr.pogodin/eslint-configs) [![NPM monthly downloads](https://img.shields.io/npm/dm/@dr.pogodin/eslint-configs)](https://www.npmjs.com/package/@dr.pogodin/eslint-configs) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/birdofpreyru/eslint-configs/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/birdofpreyru/eslint-configs) [![GitHub Repo stars](https://img.shields.io/github/stars/birdofpreyru/eslint-configs?style=social)](https://github.com/birdofpreyru/eslint-configs) [![Dr. Pogodin Studio](https://raw.githubusercontent.com/birdofpreyru/eslint-configs/master/.README/logo-dr-pogodin-studio.svg)](https://dr.pogodin.studio/docs/eslint-configs)

[ESLint 语录](https://eslint.org/) javaScript, TypeScript 和/或反应项目的配置. 这个项目被设想为替代 AirBnB ESLint 配置 (单位:千美元)[eslint - 配置 - 空降](https://www.npmjs.com/package/eslint-config-airbnb))),由AirBnB不再维护. 我们的目标是:

-   类似于 AirBnB 配置的代码样式和规则 + 上面有些进步.
    
-   及时支持最新的ESLint和插件发布.
    

[![Sponsor](https://raw.githubusercontent.com/birdofpreyru/eslint-configs/master/.README/sponsor.svg)](https://github.com/sponsors/birdofpreyru)

## 内容

-   [开始](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-getting-started)
-   [提供配置](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-provided-configs)
    -   [`configs.javascript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjavascript)
    -   [`configs.javascriptNoPerf`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjavascriptnoperf)
    -   [`configs.jest`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjest)
    -   [`configs.react`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsreact)
    -   [`configs.typescript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configstypescript)
    -   [`configs.typescriptNoPerf`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configstypescriptnoperf)

## 开始

-   以开发依赖方式安装此软件包 :
    
    ```sh
    npm install --save-dev @dr.pogodin/eslint-configs
    ```
    
-   我们使用的一些插件规则( R) [宝贝](https://babeljs.io/)。如果你没有明确拥有它 在您的工程中安装和配置 `requireConfigFile` 选项 `false`, (中文(简体) ), _譬如说._数字 :
    
    ```js
    // eslint.config.mjs
    
    import { defineConfig } from 'eslint/config';
    import eslintConfigs from '@dr.pogodin/eslint-configs';
    
    export default defineConfig([
      {
        languageOptions: {
          parserOptions: {
            requireConfigFile: false,
          },
        },
      },
      eslintConfigs.config.javascript,
    ]);
    ```
    
-   在您的平面 ESLint 配置文件中添加必要的配置, 例如 (另见 [提供配置](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-provided-configs) 详细情况如下:
    
    ```js
    // eslint.config.mjs
    
    /* eslint-disable import/no-extraneous-dependencies */
    
    // defineConfig() is an optional helper provided by ESLint
    import { defineConfig } from 'eslint/config';
    
    import eslintConfigs from '@dr.pogodin/react-utils';
    
    export default defineConfig([
      {
        // Global ignore rules: an array of path patterns to be ignored by ESLint
        // for all other objects included into this configuration, in addition to
        // "**/node_modules/" and ".git/" paths which are always ignored; see:
        // https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores 
        ignores: ['build/'],
      },
      // Apply JavaScript, TypeScript, and React configs to all files matched by
      // those configs by default.
      eslintConfigs.configs.javascript,
      eslintConfigs.configs.typescript,
      eslintConfigs.configs.react,
      {
        // Additionally apply Jest config to the folder with Jest-based unit
        // tests.
        extends: [eslintConfigs.configs.jest],
        files: ['__tests__/**'],
      },
    ]);
    ```
    
-   [完美主义者](https://perfectionist.dev/) 规则包含在默认 JavaScript 和 TypeScript 中 配置会让起伏速度明显缓慢( 而不是没有起伏的起伏) (规则)。 考虑使用 [\-- 缓存](https://eslint.org/docs/latest/use/command-line-interface#--cache) 选项 .
    

## 提供配置

此软件包提供以下基础配置,即: 根据东道项目的需要,将项目合并和扩展.

### `configs.javascript`

用于 JavaScript 代码, 它适用于文件 [ESLint 语录](https://eslint.org/) 视为 默认 JavaScript : `**/*.js`, (中文(简体) ), `**/*.cjs`, (中文(简体) ), `**/*.mjs`,以及任何 与配置中的其他配置对象相匹配的其他文件(_即说._ 没有 包含 `files` 键,参见 [用于相关配置细节的 ESLint 文件](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-and-ignores)(三); 并且适用于下列规则:

-   [ESLint核心规则](https://eslint.org/docs/latest/rules) —— 说 页:1 `recommended` 规则设定, 附带次要规则和许多附加规则 启用 .
    
-   [@babel/eslint-plugin (英语)](https://www.npmjs.com/package/@babel/eslint-plugin) —— 说 所有规则都启用,但默认设置有小处被取消.
    
-   [@stylistic/slint-plugin (英语)](https://eslint.style/rules) —— 说 页:1 `recommended` 规则设定, 附带次要规则和许多附加规则 启用 .
    
-   [埃斯林特-插头-进口](https://www.npmjs.com/package/eslint-plugin-import) —— 说 页:1 `recommended` 规则设定, 附带次要规则和许多附加规则 启用 .
    
-   [完美主义者](https://perfectionist.dev/) ——建议的规则集,有小的上下划线, 例如将大写字符放在小写前的自定义字母表 ,并允许使用空行将实体分割成不同的 排序组.
    

### `configs.javascriptNoPerf`

一样 [`configs.javascript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjavascript) 以上,但没有 [完美主义者](https://perfectionist.dev/) 规则. 基本上,这相当于 [`configs.javascript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjavascript) 从此库前 联合国 [页:1](https://github.com/birdofpreyru/eslint-configs/releases/tag/v0.2.0) 释放.

### `configs.jest`

用于 [欢乐](https://jestjs.io/)\-基于单位测试代码,适用于所有 文件(假设消费者自己将配置正确的路径来应用) 它适用于它们,并适用下列规则:

-   [埃斯林特- 插座- 捷运](https://www.npmjs.com/package/eslint-plugin-jest) —— 说 页:1 `recommended` 财务报告和审定财务报表 `style` 规则集,还有一堆附加规则 启用 .

### `configs.react`

用于反应代码,适用于 `**/*.jsx` 财务报告和审定财务报表 `**/*.tsx` 文档; 并且适用于下列规则:

-   [埃斯林特-插头-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) —— 说 页:1 `recommended` 规则设置,并启用一些附加规则.
    
-   [eslint- 插件反应](https://www.npmjs.com/package/eslint-plugin-react) —— 说 页:1 `recommended` 规则设定, 附带次要规则和许多附加规则 启用 .
    

此外,它适用于所有其他文件 [ESLint 语录](https://eslint.org/) 配置对象; 并适用于下列规则集:

-   [eslint-plugin- react-hooks (英语)](https://www.npmjs.com/package/eslint-plugin-react-hooks) ——推荐的规则集(它必须适用于所有文件,如同钩子一样) 不必在JSX或TSX文件内独活.
    
-   该规则禁止在与扩展词不同的文件中使用JSX语法 `.jsx` 或者说 `.tsx`。 。 。 .
    

### `configs.typescript`

用于类型脚本代码,适用于 `**/*.ts` 财务报告和审定财务报表 `**/*.tsx` 文档; 并且适用于下列规则:

-   我们的一切 [`configs.javascript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configsjavascript),带有次要的必要重置.
    
-   [类型标记- slint](https://typescript-eslint.io/rules) —— 说 页:1 `strictTypeChecked` 财务报告和审定财务报表 `stylisticTypeChecked` 规则集, 次要 覆盖, 并启用了许多附加规则 .
    

### `configs.typescriptNoPerf`

一样 [`configs.typescript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configstypescript) 以上,但没有 [完美主义者](https://perfectionist.dev/) 规则. 基本上,这相当于 [`configs.typescript`](https://npmcn.com/package/%40dr.pogodin/eslint-configs/#readme-configstypescript) 从此库前 联合国 [页:1](https://github.com/birdofpreyru/eslint-configs/releases/tag/v0.2.0) 释放.

## 常见问题

### @dr\.pogodin/eslint-configs 是什么？

TypeScript 和/或反应项目的 ESLint 配置

### 如何安装 @dr\.pogodin/eslint-configs？

在项目目录运行 npm install @dr\.pogodin/eslint-configs，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint-import-resolver-typescript（^4\.4\.5）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @dr\.pogodin/eslint-configs 支持 TypeScript 吗？

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

### @dr\.pogodin/eslint-configs 支持 ESM 还是 CommonJS？

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

### @dr\.pogodin/eslint-configs 可以商用吗？

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

### @dr\.pogodin/eslint-configs 的下载量有多少？

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

### @dr\.pogodin/eslint-configs 还在维护吗？

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

