Skip to content

Commit d82ebf4

Browse files
committed
fix(lint): 测试文件的相对导入补 .js 后缀,消除 TS2835 及其 TS7006 级联
`check:type-check-debt`(TypeScript Type Check job 的最后一步)红: @objectstack/lint 的 TEST_DEBT 实测 42 → 47(+5)。 根因是一处**既有**缺陷,被本单新增的测试放大:测试文件第 10 行 `from './validate-visibility-predicates'` 缺 `.js` 后缀。在 NodeNext 下这是 TS2835,且该模块因此解析为 `any`,于是文件里每一个 `.map((f) => …)` / `.filter((f) => …)` 回调都级联出 TS7006(`f` 隐式 any)。本单新增的断言带来 更多这类回调,把既有级联乘大了。 补上 `.js` 后(与同包所有测试文件、以及本文件自己的第二条 import `./authoring-rules.js` 一致),该文件的测试层错误 28 → **0**, 整包 47 → **19**,低于台账记录的 42。 **台账未抬**(棘轮只减不增,#5278):entry 仍是 42,门现在把它报成 改进(`ℹ TEST_DEBT records 42, tsc now reports 19 (-23)`)。 **测试未削弱**:本次改动是 1 增 1 删的单行 import,断言一条未动 —— 118 处 expect、86 条用例(其中本单新增 32 条)全绿。 本地未复现是因为检查面不同:@objectstack/lint 的 tsconfig 把 `*.test.ts` 排除在外,所以 `pnpm --filter @objectstack/lint typecheck` 根本不读测试文件, 而该门会解除排除后重测。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BDmDsu2575gDxeMCxXhDE3
1 parent 43d5ced commit d82ebf4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/lint/src/validate-visibility-predicates.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
VISIBILITY_ROOT_MISLAYERED,
88
VISIBILITY_BARE_IDENTIFIER,
99
VISIBILITY_PREDICATE_SYNTAX,
10-
} from './validate-visibility-predicates';
10+
} from './validate-visibility-predicates.js';
1111
import { AUTHORING_RULES } from './authoring-rules.js';
1212

1313
describe('validateVisibilityPredicates (ADR-0089 D3b)', () => {

0 commit comments

Comments
 (0)