@empiricalrun/eslint-config

中文文档
0.9.0发布于 2026/11/10ES Module近 30 天下载 8880

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

中文使用文档
文档目录5 节
  1. 安装
  2. 类型脚本配置
  3. 使用量
  4. 自定义规则
  5. Repo 版式

@empiricrun/ eslint- config

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

安装

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 没有船.

类型脚本配置

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

使用量

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

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 共发布 15 个版本,首次发布于 2024/09/09;过去 12 个月发布了 8 个版本。

版本发布日期距今
0.9.0latest2026/11/103 天前
0.8.12026/11/094 天前
0.8.02026/11/076 天前
0.7.02026/11/049 天前
0.6.22026/11/049 天前
0.6.12026/10/1430 天前

关于 @empiricalrun/eslint-config 的常见问题

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