Repository navigation
Commit 2db6086
committed
refactor(lint): retire the facade closure test for a lint rule plus budget rows
`contracts-entry-closure.test.ts` (from #1959) carried two assertions. Neither
replacement subsumes it alone; together they do, on two different axes.
Its whole-tree scan parsed ~490 candidate files to prove nothing value-imports
the two wide facades. `eslint/no-restricted-imports` states exactly that, and
`allowTypeImports` draws the one distinction that made a custom walker look
necessary: `import type` is erased, so it stays legal. The rule covers every
file rather than the four hubs the deleted test named, and it reaches dynamic
imports too.
Its hub pin checked that four named hubs never reach either facade. The lint
rule forbids the import edge that was the only way that could happen, and
#1960's rows add an axis the old test never had: closure SIZE drift. That
cardinality check is deliberately not described here as strictly stronger,
because it is not — an equal-size graph substitution leaves the count intact and
passes. Size drift and forbidden edges are different properties, and the two
gates own one each.
The override semantics are not additive, so the rule was verified per zone
rather than assumed. A same-rule override REPLACES the parent, so a top-level
rule would have been silently dropped for `src/**`; and the existing blanket
`"off"` for `exec.ts` and the test tree would have exempted the files that
carried most of the cost #1959 removed. The paths are therefore added per zone,
and that `"off"` becomes a facade-only config that keeps the
`node:child_process` exemption it existed for.
Planted red in all three zones — `src/core/capabilities.ts`, a `src/__tests__`
file, and `packages/capture-kit/src` — each flagged, while a type-only import in
the same probe file was not. The first packages probe read as a pass because the
sed that built it produced a type-only import; that zone was re-probed with a
real value import rather than trusting the green.
Relying on config is safe here because misconfiguration fails loudly: a typo'd
rule name makes oxlint exit 1 with "Rule not found in plugin", rather than pass
silently the way the `rg` assertions in #1976 did.
The budgets stay for what no linter can express: a transitive weight property,
where a module already imported grows an import and the cost arrives without any
single file's import list changing. Per-file rules cannot see that, and
`no-restricted-imports` can only ban specifiers named in advance — exactly what
#1950/#1956/#1959 could not have named.1 parent 2baf7ef commit 2db6086
2 files changed
Lines changed: 59 additions & 101 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
41 | 59 | | |
42 | 60 | | |
43 | 61 | | |
| |||
47 | 65 | | |
48 | 66 | | |
49 | 67 | | |
50 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
51 | 107 | | |
52 | 108 | | |
53 | 109 | | |
| |||
This file was deleted.
0 commit comments