# @duro-app/eslint-config 中文文档

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

版本：6\.1\.0
npm 元数据更新时间：2026-11-12T13:45:09.792Z
中文译文更新时间：2026-11-13T00:40:52.870Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40duro-app/eslint-config
原文对照：https://npmcn.com/package/%40duro-app/eslint-config/?lang=original
项目主页：https://github.com/fredericrous/duro-design-system
源码仓库：https://github.com/fredericrous/duro-design-system

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

- 包体积（解压后）：10.5 kB，5 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：^18\.18\.0 \|\| ^20\.9\.0 \|\| \>=21\.1\.0
- 运行依赖：3 个
- peer 依赖：eslint ^9\.0\.0 \|\| ^10\.0\.0，@aval-adr/eslint-config \>=0\.16\.0 \<1
- 首次发布：2026-08-19T08:23:06.645Z
- 最新版本发布：2026-11-12T13:45:09.400Z
- 近 30 天下载量：6425（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：79（近 12 个月 79 个）

## 中文简介

可共享的 ESLint 平面配置 Duro 设计系统: React Apps 的设计-系统规则和UI-图书馆政策,上方为 @aval-adr/eslint-config.

## 安装

```sh
npm install @duro-app/eslint-config
```

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

## README

# @duro-app/slint-config

用于 Duro 堆栈的可共享的 ESLint 平面配置 — CLAUDE.md 和 代理记忆只能暗示, 连接到电线, 所以每个消费者的回波 (通过amont的内置) `pre-commit-lint-js`,哪个 在根 ESLint 配置( root ESLint config) 和 CI 中激活.

需要 ESLint 9 或 10 (平面配置) 。 它只保留设计系统 UI - 图书馆政策, 如 `react`A. 一般性公约`base`, (中文(简体) ), `effect`, (中文(简体) ), `tests`)和决定规则桥(`adrLint`)来自 [`@aval-adr/eslint-config`](https://www.npmjs.com/package/@aval-adr/eslint-config), (中文(简体) ), 此软件包将扩展并声明为对等点:安装两者.

```sh
pnpm add -D @duro-app/eslint-config @aval-adr/eslint-config
```

## 使用量

```js
// eslint.config.js (repo root — amont only detects a ROOT config)
import {react} from '@duro-app/eslint-config'
import {effect, tests} from '@aval-adr/eslint-config'

export default [
  {ignores: ['**/dist/**', '**/build/**']},
  ...react,
  ...tests,
  // Server-only packages in a monorepo can scope the effect preset:
  ...effect.map((c) => ({...c, files: ['apps/api/**/*.ts']})),
]
```

## 预设

| 预设 | 从 | 编曲 | 对于 |
| --- | --- | --- | --- |
| `react` | `@duro-app/eslint-config` | 月球 `base` + 经典反应- 呼 + duro 插件 + UI 政策 | 确定定义/ `@duro-app/ui` 应用程序 |
| `base` | `@aval-adr/eslint-config` | `@eslint/js` + 键 `typescript-eslint` 推荐, 更美的间距 | 每个类型脚本包 |
| `effect` | `@aval-adr/eslint-config` | `base` + 键 `@effect` 插件 + 服务器存储策略 | 效果服务 |
| `tests` | `@aval-adr/eslint-config` | 可访问性第一选择器(自测到测试/e2e文件) | 任何带有测试的重播 |

`react` 报告其进口禁令为: `duro/no-restricted-imports`,除 `effect`是因为 `@typescript-eslint/no-restricted-imports` 和adr -lint's (英语) `adr-lint/no-restricted-imports`,所以编织它们 保持每一个禁令: 三个比另一个强.

## 政策的执行

-   **`react`**:UI原始人来自 `@duro-app/ui` 只有反应, 光谱、MUI、Radix、Chakra、头部收缩、蚂蚁和 `@frontjutsu/ui` 为: 禁用信件, 并注明添加缺失组件的位置 。 富有 文本通过 `@fredericrous/lexical-multi`从不生 `lexical`。 也带着一切 `@duro-app/eslint-plugin`: html.\* 元素, 深信使导入、信使值和窗体包.
-   `effect` 财务报告和审定财务报表 `tests` 记录 `@aval-adr/eslint-config`。 。 。 .

塞克瑞特是一条线: `error` 在犯罪门和CI, `warn` 到处通知 别加 `--max-warnings=0` - 促进一项规则 `error` 换句话说,如果能赚到钱的话.

### 3.0 采用现有债务

3.0 促进 `duro/no-raw-design-values` 改为 `error` 添加 `duro/no-raw-breakpoint-query`。已经包含原始值的还本存出 每扇门 **新设** 将旧的用一个 清晰的文件列表 — 从不 glob, 从不 `--max-warnings`数字 :

```js
// eslint.duro-baseline.js — delete a line when its file is migrated. Never add one.
export const RAW_VALUES_BASELINE = [
  'app/routes/legacy-dashboard.tsx',
  'app/components/OldChart/OldChart.tsx',
]
```

```js
// eslint.config.js — after the presets, so last-wins downgrades only these
import {RAW_VALUES_BASELINE} from './eslint.duro-baseline.js'
export default [
  ...react,
  {files: RAW_VALUES_BASELINE, rules: {'duro/no-raw-design-values': 'warn'}},
]
```

大多数结论都附有建议;ESLint API可以批量应用 (单位:千美元)`message.suggestions[0].fix`) (中文(简体) ). 剩下的是那些需要 人类选择——一种非平面颜色,一种非平面相距.

## 逃生舱

平面配置是最后的胜负——范围是预设之后的覆盖:

```js
...react,
{
  // The one file allowed to import the raw engine reset:
  files: ['packages/editor/src/usePageNode.ts'],
  rules: {'duro/no-restricted-imports': 'off'},
}
```

## adr-lint 规则 (opt- in)

`adrLint` 财务报告和审定财务报表 `adrLintTyped` 添加决定的代码规则 : 没错 从 `@aval-adr/eslint-config` 把它们放在最后 他们 禁令有自己的规则 id,所以没有 `stack` 选项( 6. 0 放弃) :

```js
import {react} from '@duro-app/eslint-config'
import {adrLint} from '@aval-adr/eslint-config'

export default [...react, ...adrLint()]
```

## 从 5.x 移动

-   添加 `@aval-adr/eslint-config` (单位:千美元)`^0.16.0`在这个包裹旁边.
-   导入 `base`, (中文(简体) ), `effect`, (中文(简体) ), `tests` 财务报告和审定财务报表 `adrLint` 从它; 保留 `react` 从这里.
-   丢弃 `stack` 从一个 `adrLint` 电话.
-   覆盖 `no-restricted-imports` 因为UI禁令变成 `duro/no-restricted-imports`。 。 。 .

## 常见问题

### @duro-app/eslint-config 是什么？

可共享的 ESLint 平面配置 Duro 设计系统: React Apps 的设计-系统规则和UI-图书馆政策,上方为 @aval-adr/eslint-config\.

### 如何安装 @duro-app/eslint-config？

在项目目录运行 npm install @duro-app/eslint-config，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（^9\.0\.0 \|\| ^10\.0\.0）、@aval-adr/eslint-config（\>=0\.16\.0 \<1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @duro-app/eslint-config 支持 TypeScript 吗？

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

### @duro-app/eslint-config 支持 ESM 还是 CommonJS？

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

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

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

### @duro-app/eslint-config 可以商用吗？

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

### @duro-app/eslint-config 的下载量有多少？

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

### @duro-app/eslint-config 还在维护吗？

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

