# @dendavidov/eslint-config-react 中文文档

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

版本：2\.2\.31
npm 元数据更新时间：2026-11-02T19:25:09.675Z
中文译文更新时间：2026-11-12T10:14:32.144Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：15.9 kB，5 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=24\.0\.0 \<25
- 运行依赖：2 个
- peer 依赖：eslint-plugin-jest ^29\.15\.0，eslint-plugin-react ^7\.37\.5，eslint-plugin-import ^2\.32\.0，eslint-config-prettier ^10\.1\.8，eslint-plugin-jsx-a11y ^6\.10\.2，eslint-plugin-security ^4\.0\.0，@typescript-eslint/parser ^8\.56\.0，eslint-plugin-testing-library ^7\.15\.4，@typescript-eslint/eslint-plugin ^8\.56\.0，eslint-import-resolver-typescript ^4\.4\.4
- 首次发布：2023-02-19T08:44:56.058Z
- 最新版本发布：2026-11-02T19:25:09.300Z
- 近 30 天下载量：2596（2026-10-12 至 2026-11-10，npm 官方下载统计）
- 已发布版本数：157（近 12 个月 61 个）

## 中文简介

用于React + TypeScript(ESLint 9+平面配置)的可共享的ESLint配置,支持Node.js 24.x.

## 安装

```sh
npm install @dendavidov/eslint-config-react
```

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

## README

[![npm version](https://img.shields.io/npm/v/@dendavidov/eslint-config-react.svg)](https://www.npmjs.com/package/@dendavidov/eslint-config-react) [![Downloads](https://img.shields.io/npm/dm/@dendavidov/eslint-config-react.svg)](https://www.npmjs.com/package/@dendavidov/eslint-config-react) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdendavidov%2Feslint-config-react.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdendavidov%2Feslint-config-react?ref=badge_shield) [![CodeQL](https://github.com/dendavidov/eslint-config-react/actions/workflows/codeql.yml/badge.svg)](https://github.com/dendavidov/eslint-config-react/actions/workflows/codeql.yml) [![checks](https://github.com/dendavidov/eslint-config-react/actions/workflows/test.yml/badge.svg)](https://github.com/dendavidov/eslint-config-react/actions/workflows/test.yml)

# @ dendavidov/eslint-config- react

对 React.js SPA 与 ESLint 9+(平面配置)的意见 eslint-config. 包括通过 `eslint-plugin-security`。 。 。 .

-   **ESLint 9+ 平面配置** 页:1 `eslint` + 键 `@eslint/js`;插件生态系统还没有完全在 ESLint 10 上,所以这个软件包目前解决了 ESLint 9.x)
-   **需要节点.js 24.x** (单位:千美元)`engines.node`);这回波将精确的补丁钉入 `.nvmrc` 编号 : `Dockerfile` 用于CI
-   **ESLint 已捆绑** 作为正常的依赖关系——您不添加 `eslint` (b) 以 `npx eslint`, (中文(简体) ), `pnpm exec eslint`,或一个 `lint` 脚本

## 安装

安装此软件包 **财务报告和审定财务报表** 其端口依赖性( ESLint 插件和解析此配置所期望的) :

```bash
pnpm add -D @dendavidov/eslint-config-react @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-security eslint-plugin-testing-library
```

(或同等数额) `npm i -D …` 使用相同的软件包列表。 )

`eslint` 本身与 `@dendavidov/eslint-config-react`; 使用 `npx eslint` 或者说 `pnpm exec eslint` 所以二进制来自您的安装树.

## 使用量

创建 `eslint.config.js` 在您的项目根中:

```javascript
import config from '@dendavidov/eslint-config-react';

export default config;
```

或者用你自己的规则延伸:

```javascript
import config from '@dendavidov/eslint-config-react';

export default [
  ...config,
  {
    rules: {
      // Your custom rules
    },
  },
];
```

添加脚本到软件包. json:

```json
{
  "scripts": {
    "lint": "eslint './src/**/*.{ts,tsx,js,jsx}'"
  }
}
```

## 节点.js 版本

这个配置需要 **节点.js 24.x** (见 `engines.node` 时间。 开发该套软件采用 **被绑定的补丁** 内 `.nvmrc` (和 `Dockerfile`所以CI和Deptabot保持对齐.

## 捐款

欢迎拉动请求。 如需更改,请先开出一期 讨论你想改变什么.

## 许可证

[麻省理工学院](https://dendavidov.mit-license.org/)

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdendavidov%2Feslint-config-react.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdendavidov%2Feslint-config-react?ref=badge_large)

## 常见问题

### @dendavidov/eslint-config-react 是什么？

用于React \+ TypeScript\(ESLint 9\+平面配置\)的可共享的ESLint配置,支持Node\.js 24\.x\.

### 如何安装 @dendavidov/eslint-config-react？

在项目目录运行 npm install @dendavidov/eslint-config-react，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint-plugin-jest（^29\.15\.0）、eslint-plugin-react（^7\.37\.5）、eslint-plugin-import（^2\.32\.0）、eslint-config-prettier（^10\.1\.8）、eslint-plugin-jsx-a11y（^6\.10\.2）、eslint-plugin-security（^4\.0\.0）、@typescript-eslint/parser（^8\.56\.0）、eslint-plugin-testing-library（^7\.15\.4）、@typescript-eslint/eslint-plugin（^8\.56\.0）、eslint-import-resolver-typescript（^4\.4\.4）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @dendavidov/eslint-config-react 支持 TypeScript 吗？

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

### @dendavidov/eslint-config-react 支持 ESM 还是 CommonJS？

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

### @dendavidov/eslint-config-react 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=24\.0\.0 \<25。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @dendavidov/eslint-config-react 可以商用吗？

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

### @dendavidov/eslint-config-react 的下载量有多少？

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

### @dendavidov/eslint-config-react 还在维护吗？

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

