From c9cc60f7955356b4a923a37bcad247f9b79b1325 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 14:13:13 +0000 Subject: [PATCH] =?UTF-8?q?fix(tsconfig):=20=E6=A0=B9=20tsconfig.node.json?= =?UTF-8?q?=20=E5=8A=A0=20noEmit,=E5=A0=B5=E4=BD=8F=E5=85=A8=E4=BB=93?= =?UTF-8?q?=E6=8E=92=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根 `tsconfig.node.json` 既没有 `include`(默认编译整个仓库),又从 `tsconfig.base.json` 继承了 `declaration` / `declarationMap` / `sourceMap` 且没有 `outDir`。任何一次 `tsc -p tsconfig.node.json` 都会在每个源文件旁边 写出 .js / .d.ts / .map,实测 5,850 个,且全部不在 .gitignore 里。 objectui#3515 已经踩爆过一次:一条随手的 `git add -A` 吞进 402,729 行插入; 更糟的是排放出的 .js 带 JSX(来自 .tsx 输入),rolldown 会优先解析 `src/lib/utils.js` 而不是 `src/lib/utils.tsx`,于是 `@object-ui/components:build` 报出 165 个 "Unexpected JSX expression", 读起来像"你的改动弄坏了构建",实际与任何改动无关。 修法取最小静态防线:加 `"noEmit": true`。该文件是纯编辑器/引用配置, 全仓没有任何 script 运行它;它不被任何工程 `references`,所以 TS6310 不适用 ——`tsconfig.scripts.json` 与 `tsconfig.vitest-setup.json` 各自也是这个论证。 同时补一段文件头注释说明来由,避免下一个编辑者当作冗余删掉。 只改 emit,不改检查:该工程既有的 ~23.9k 错误原样保留(那份积压按 objectui#3515 的裁定不在本次范围内)。 Fixes #3549 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt --- tsconfig.node.json | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tsconfig.node.json b/tsconfig.node.json index 2d13eba642..f89c588646 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,6 +1,33 @@ +// Editor / reference config only. NO script runs this project — not +// package.json, not turbo.json, not CI. (`apps/console/tsconfig.node.json` is a +// DIFFERENT file of the same name; that one IS built, by the console's +// `type-check`. Don't let a grep hit there convince you this one has a runner.) +// +// `noEmit` below is load-bearing, not cruft — DO NOT REMOVE IT. This file +// declares no `include`, so it compiles the ENTIRE repository, and +// `tsconfig.base.json` turns on `declaration` / `declarationMap` / `sourceMap` +// with NO `outDir`. So one stray `tsc -p tsconfig.node.json` used to write +// ~5,850 `.js` / `.d.ts` / `.map` files next to every source across +// `packages/`, `apps/`, `examples/`, `scripts/` and the repo root, none of them +// gitignored. During objectui#3515 a throwaway `git add -A` then swallowed +// 402,729 insertions across 5,838 files — and worse, the emitted `.js` carry +// JSX (they came from `.tsx` inputs) and rolldown resolves `src/lib/utils.js` +// in preference to `src/lib/utils.tsx`, so `@object-ui/components:build` failed +// with 165 "Unexpected JSX expression" errors that read like "your change broke +// the build" while having nothing to do with any change. objectui#3549. +// +// Legal here because this project is standalone: nothing `references` it, so +// TS6310 does not apply. Same argument `tsconfig.scripts.json` and +// `tsconfig.vitest-setup.json` each make for themselves. +// +// Note this changes EMIT only, not checking. The project still reports its +// pre-existing ~23.9k errors; that backlog is deliberately out of scope here +// (objectui#3515 rejected "widen the root config and give it a runner" for +// exactly that reason). { "extends": "./tsconfig.base.json", "compilerOptions": { - "lib": ["ES2020"] + "lib": ["ES2020"], + "noEmit": true } }