From a1cf80ef89e4b05eec74116a41c56d2f2e155374 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Tue, 13 Oct 2026 13:12:04 +0800 Subject: [PATCH] =?UTF-8?q?chore(test):=20vitest/eslint=20=E6=8E=92?= =?UTF-8?q?=E9=99=A4=20.delta/=20=E6=A3=80=E5=87=BA=E2=80=94=E2=80=94?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E9=97=A8=E7=A6=81=E5=81=87=E7=BA=A2=E7=9A=84?= =?UTF-8?q?=E6=A0=B9=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `.delta/worktrees/` 是 DSH worktree 通道的陈旧检出,`.git/info/exclude` 忽略它,但 vitest 与 eslint 只读各自的配置,于是本地 `pnpm test` 会收集那些 别的分支的副本、`pnpm lint` 会走进去:实测一次 6 文件 / 7 用例假红与 1115 errors,全部来自 10 月 4–5 日的旧树,而仓库自己的代码是干净的。两处各加一条 排除项(保留既有全部条目——vitest 的 `exclude` 是整体替换语义)。 顺带订正 eslint 配置里「点开头目录默认也不进」这处注释:ESLint 只默认排除 `node_modules`,`.worktrees/` 一直是显式列出的,`.delta/` 漏了。 --- eslint.config.js | 5 ++++- vitest.config.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 1d5e10ab..70dafc8c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -10,7 +10,9 @@ import reactHooks from 'eslint-plugin-react-hooks' import tseslint from 'typescript-eslint' export default tseslint.config( - // 构建产物 / 工具目录不参与 lint(node_modules 与点开头目录默认也不进)。 + // 构建产物 / 工具目录不参与 lint(node_modules 默认不进,但**点开头目录 + // 并不自动排除**——`.worktrees/` 与 `.delta/` 都必须显式列出,否则 ESLint + // 会走进那些陈旧检出,把别的分支的错误报成我们的:实测一次 1115 errors)。 { ignores: [ 'lib/', @@ -21,6 +23,7 @@ export default tseslint.config( 'test-results/', 'node_modules/', '.worktrees/', + '.delta/', ], }, diff --git a/vitest.config.ts b/vitest.config.ts index c0608e3c..929ce12f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -49,6 +49,11 @@ export default defineConfig({ // Local dev worktrees (pnpm/DSH-style task branches) may carry stale // code against this checkout's node_modules — never collect them. '**/.worktrees/**', + // Same hazard, different directory: the DSH worktree lanes keep their + // checkouts under `.delta/`, which `.git/info/exclude` ignores but this + // list is the only thing vitest reads. Left out, `pnpm test` collects + // those stale copies and reports THEIR failures as ours. + '**/.delta/**', '**/node_modules/**', '**/dist/**', '**/cypress/**',