@dr.pogodin/eslint-configs

中文文档
0.3.11发布于 2026/11/08MITES Module近 30 天下载 4429

ESLint configurations for TypeScript and/or React projects

原始使用文档
文档目录9 节
  1. Content
  2. Getting Started
  3. Provided Configs
  4. configs.javascript
  5. configs.javascriptNoPerf
  6. configs.jest
  7. configs.react
  8. configs.typescript
  9. configs.typescriptNoPerf

ESLint Configs

Latest NPM Release NPM monthly downloads CircleCI GitHub Repo stars Dr. Pogodin Studio

ESLint configurations for JavaScript, TypeScript and/or React projects. This project is invisioned as a replacement for AirBnB ESLint configurations (eslint-config-airbnb), which are no longer maintained by AirBnB. Our aims are:

  • Code style and rules similar to that of the original AirBnB configs + Some opinionated improvements on top them.

  • Timely support of the latest ESLint and plugin releases.

Sponsor

Content

Getting Started

  • Install this package as developement dependency:

    npm install --save-dev @dr.pogodin/eslint-configs
    
  • Some plugins & rules we use depend on Babel. If you don't have it explicitly installed and configured in your project you should set requireConfigFile option of parser to false, e.g.:

    // 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,
    ]);
    
  • Add necessary configurations into your flat ESLint config file, for example (also see Provided Configs section below for further details):

    // 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__/**'],
      },
    ]);
    
  • Perfectionist rules included into our default JavaScript and TypeScript configs make the linting noticeably slow (compared to linting without these rules). Consider using --cache option of ESLint to speed-up repeated linting of your codebase.

Provided Configs

This package provides the following base configurations, that are meant to be combined and extended as necessary for the needs of host projects.

configs.javascript

Intended for JavaScript code, it applies to the files ESLint considers as JavaScript by default: **/*.js, **/*.cjs, **/*.mjs, as well as to any other files matched by other config objects in your config (i.e. it does not include files key, see ESLint docs for related configuration details); and it applies to them the following rule sets:

  • ESLint Core Rules — the recommended rule set, with minor overrides, and many additional rules enabled.

  • @babel/eslint-plugin — all rules enabled, with minor overrides of their default settings.

  • @stylistic/eslint-plugin — the recommended rule set, with minor overrides, and many additional rules enabled.

  • eslint-plugin-import — the recommended rule set, with minor overrides, and many additional rules enabled.

  • Perfectionist — the recommended rule set, with minor overrides, such as the custom alphabet that places uppercase characters before lowercase ones, and allowance to use empty lines to separate entities into different sorting groups.

configs.javascriptNoPerf

The same as configs.javascript above, but without Perfectionist rules. Essentially, it is equivalent to configs.javascript from this library prior to its v0.2.0 release.

configs.jest

Intended for Jest-based unit test code, it applies to all files (assuming the consumer himself will configure the correct paths to apply it to); and it applies to them the following rule sets:

  • eslint-plugin-jest — the recommended and style rule sets, with a bunch of additional rules enabled.

configs.react

Intended for React code, it applies to **/*.jsx and **/*.tsx files; and it applies to them the following rule sets:

Additionally, it applies to all other files matched by any other ESLint configuration object; and it applies to them the following rule sets:

  • eslint-plugin-react-hooks — the recommended rule set (it has to apply to all files, as hooks do not have to live ony inside JSX or TSX files exclusively).

  • the rule that forbids using JSX syntax in files with extensions different from .jsx or .tsx.

configs.typescript

Intended for TypeScript code, it applies to **/*.ts and **/*.tsx files; and it applies to them the following rule sets:

  • Everything from our configs.javascript, with minor necessary overrides.

  • typescript-eslint — the strictTypeChecked and stylisticTypeChecked rule sets, with minor overrides, and many additional rules enabled.

configs.typescriptNoPerf

The same as configs.typescript above, but without Perfectionist rules. Essentially, it is equivalent to configs.typescript from this library prior to its v0.2.0 release.

版本与发布记录

@dr.pogodin/eslint-configs 共发布 45 个版本,首次发布于 2025/04/07;过去 12 个月发布了 31 个版本。

版本发布日期距今
0.3.11latest2026/11/085 天前
0.3.102026/10/2915 天前
0.3.92026/10/2420 天前
0.3.82026/10/2123 天前
0.3.72026/09/122 个月前
0.3.62026/08/292 个月前

其他发布通道:alpha → 0.3.0-alpha.3。

关于 @dr.pogodin/eslint-configs 的常见问题

@dr.pogodin/eslint-configs 是什么?

ESLint configurations for TypeScript and/or React projects

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