# @empiricalrun/eslint-config 中文文档

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

版本：0\.9\.0
npm 元数据更新时间：2026-11-10T05:40:15.033Z
中文译文更新时间：2026-11-13T15:48:22.992Z
软件包许可：未声明

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

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

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

- 包体积（解压后）：18.5 kB，13 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=22
- 运行依赖：11 个
- 首次发布：2024-09-09T00:26:35.012Z
- 最新版本发布：2026-11-10T05:40:14.888Z
- 近 30 天下载量：8880（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：15（近 12 个月 8 个）

## 中文简介

用于 Playwright 测试寄存器(ESLint 9,平面配置)的ESLint配置.

## 安装

```sh
npm install @empiricalrun/eslint-config
```

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

## README

# @empiricrun/ eslint- config

用于 Playwright 测试寄存器(ESLint 9,平面配置)的ESLint配置.

## 安装

```bash
npm install @empiricalrun/eslint-config --save-dev
```

该套件提供了repo的工具链: `eslint`, (中文(简体) ), `prettier` 财务报告和审定财务报表 `typescript` (钉入一个精确 )),所以," version"," version"等 `npx eslint` 财务报告和审定财务报表 `npx tsc` 工作不需要单独的安装。 不添加 `typescript` 改为 重案组自己的 `package.json`;通过升级此软件包来升级.

`typescript` 留在5.x上是因为打字机-slint需要TypeScript JS API,而TypeScript 7 没有船.

## 类型脚本配置

```json
{
  "extends": "@empiricalrun/eslint-config/tsconfig.json"
}
```

## 使用量

创建一个 `eslint.config.mjs` 在项目根中的文件 :

```js
export { default } from "@empiricalrun/eslint-config/playwright";
```

TypeScript 文件被以类型信息嵌入, 使用最近的 `tsconfig.json`。 。 。 .

## 自定义规则

-   `empirical/no-tags-in-name`: 标记进入 `tag` 选项,而不是标题. `test("login @smoke", ...)` 是错误; 使用 `test("login", { tag: ["@smoke"] }, ...)`。 。 。 .
-   `empirical/no-hooks-in-shared-modules`: 无 `test.beforeEach/afterEach/beforeAll/afterAll` 在模块中 范围外部测试文件( e)`*.spec.*`, (中文(简体) ), `*.test.*`, (中文(简体) ), `*.setup.*`, (中文(简体) ), `*.teardown.*`) (中文(简体) ). 共享模块,例如: `fixtures.ts` 所以它的钩子只能跑到第一个测试文件上 每个工人 进口。 用固定器 `{ auto: true }` 换句话说.
-   `empirical/no-describe-mode-shorthand`: 无 `test.describe.serial(...)` 或者说 `test.describe.parallel(...)`。 。 。 . 在块内设置模式 `test.describe.configure({ mode: "serial" })`: 经验读取 模式从 `describe.configure` 以单位形式重试并恢复序列组.

## Repo 版式

配置执行标准测试回波布局 :

```
tests/   *.spec.ts, *.setup.ts and *.teardown.ts only
pages/   code that knows the app under test: functions, no classes
lib/     the test repo's machinery shared by all tests: fixtures, test data, utilities
```

-   `empirical/repo-layout`数字 : `tests/` 仅持有 `*.spec.ts`, (中文(简体) ), `*.setup.ts` 财务报告和审定财务报表 `*.teardown.ts`任意 其他文件在 `tests/` 错误: 匹配文件夹收集的 Playwright 工程 文件为测试文件,因此导入文件失败的规格。 外部文件夹 `tests/`, (中文(简体) ), `pages/` 财务报告和审定财务报表 `lib/` (例如: `scripts/` 或者说 `unit/`未检查.
-   `empirical/no-helpers-in-specs`:测试文件中没有顶级功能或类. 移动到 `pages/` 如果他们驱动应用程序,或 `lib/` 如果他们不这样做.
-   `empirical/no-classes-in-pages`数字 : `pages/` 输出功能.
-   `import/no-restricted-paths`: 其余部分 `lib/` 从未导入 `pages/`, (中文(简体) ), `pages/` 从未导入 `lib/fixtures/` (固定页被导入,因此是一个周期),没有进口 `tests/`。 。 。 .

## 常见问题

### @empiricalrun/eslint-config 是什么？

用于 Playwright 测试寄存器\(ESLint 9,平面配置\)的ESLint配置\.

### 如何安装 @empiricalrun/eslint-config？

在项目目录运行 npm install @empiricalrun/eslint-config，或使用 pnpm add / yarn add / bun add。

### @empiricalrun/eslint-config 支持 TypeScript 吗？

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

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

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

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

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

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

@empiricalrun/eslint-config 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

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

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

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

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

