@nielspeter/eess-ts 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/builders/class-rule-builder.d.ts +0 -7
  3. package/dist/builders/class-rule-builder.d.ts.map +1 -1
  4. package/dist/builders/class-rule-builder.js +27 -1
  5. package/dist/builders/class-rule-builder.js.map +1 -1
  6. package/dist/builders/cross-layer-builder.d.ts.map +1 -1
  7. package/dist/builders/cross-layer-builder.js +6 -8
  8. package/dist/builders/cross-layer-builder.js.map +1 -1
  9. package/dist/builders/slice-rule-builder.d.ts.map +1 -1
  10. package/dist/builders/slice-rule-builder.js +7 -1
  11. package/dist/builders/slice-rule-builder.js.map +1 -1
  12. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  13. package/dist/conditions/body-analysis-module.js +37 -4
  14. package/dist/conditions/body-analysis-module.js.map +1 -1
  15. package/dist/conditions/call.d.ts +4 -3
  16. package/dist/conditions/call.d.ts.map +1 -1
  17. package/dist/conditions/call.js +40 -17
  18. package/dist/conditions/call.js.map +1 -1
  19. package/dist/conditions/function.d.ts.map +1 -1
  20. package/dist/conditions/function.js +22 -8
  21. package/dist/conditions/function.js.map +1 -1
  22. package/dist/conditions/reverse-dependency.d.ts.map +1 -1
  23. package/dist/conditions/reverse-dependency.js +16 -14
  24. package/dist/conditions/reverse-dependency.js.map +1 -1
  25. package/dist/conditions/structural.d.ts.map +1 -1
  26. package/dist/conditions/structural.js +28 -11
  27. package/dist/conditions/structural.js.map +1 -1
  28. package/dist/core/disk-set.d.ts.map +1 -1
  29. package/dist/core/disk-set.js +37 -2
  30. package/dist/core/disk-set.js.map +1 -1
  31. package/dist/core/object-literal-functions.d.ts +4 -1
  32. package/dist/core/object-literal-functions.d.ts.map +1 -1
  33. package/dist/core/object-literal-functions.js +27 -5
  34. package/dist/core/object-literal-functions.js.map +1 -1
  35. package/dist/core/project-relative.d.ts +108 -0
  36. package/dist/core/project-relative.d.ts.map +1 -1
  37. package/dist/core/project-relative.js +179 -2
  38. package/dist/core/project-relative.js.map +1 -1
  39. package/dist/core/through-wrappers.d.ts +24 -0
  40. package/dist/core/through-wrappers.d.ts.map +1 -0
  41. package/dist/core/through-wrappers.js +36 -0
  42. package/dist/core/through-wrappers.js.map +1 -0
  43. package/dist/core/vacuity-diagnosis.d.ts.map +1 -1
  44. package/dist/core/vacuity-diagnosis.js +11 -3
  45. package/dist/core/vacuity-diagnosis.js.map +1 -1
  46. package/dist/helpers/body-traversal.d.ts +14 -14
  47. package/dist/helpers/body-traversal.d.ts.map +1 -1
  48. package/dist/helpers/body-traversal.js +111 -35
  49. package/dist/helpers/body-traversal.js.map +1 -1
  50. package/dist/helpers/callback-extractor.d.ts +6 -1
  51. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  52. package/dist/helpers/callback-extractor.js +45 -10
  53. package/dist/helpers/callback-extractor.js.map +1 -1
  54. package/dist/helpers/global-binding.d.ts +11 -0
  55. package/dist/helpers/global-binding.d.ts.map +1 -0
  56. package/dist/helpers/global-binding.js +232 -0
  57. package/dist/helpers/global-binding.js.map +1 -0
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +2 -2
  61. package/dist/index.js.map +1 -1
  62. package/dist/models/arch-function.d.ts +2 -2
  63. package/dist/models/arch-function.d.ts.map +1 -1
  64. package/dist/models/arch-function.js +138 -41
  65. package/dist/models/arch-function.js.map +1 -1
  66. package/dist/models/slice.d.ts.map +1 -1
  67. package/dist/models/slice.js +20 -16
  68. package/dist/models/slice.js.map +1 -1
  69. package/dist/predicates/identity.d.ts +2 -1
  70. package/dist/predicates/identity.d.ts.map +1 -1
  71. package/dist/predicates/identity.js +37 -38
  72. package/dist/predicates/identity.js.map +1 -1
  73. package/dist/presets/agent-guardrails.d.ts.map +1 -1
  74. package/dist/presets/agent-guardrails.js +65 -14
  75. package/dist/presets/agent-guardrails.js.map +1 -1
  76. package/dist/presets/boundaries.js +58 -16
  77. package/dist/presets/boundaries.js.map +1 -1
  78. package/dist/presets/recommended.d.ts +29 -6
  79. package/dist/presets/recommended.d.ts.map +1 -1
  80. package/dist/presets/recommended.js +30 -11
  81. package/dist/presets/recommended.js.map +1 -1
  82. package/dist/rules/errors.d.ts +17 -0
  83. package/dist/rules/errors.d.ts.map +1 -1
  84. package/dist/rules/errors.js +48 -8
  85. package/dist/rules/errors.js.map +1 -1
  86. package/dist/rules/security.d.ts +6 -0
  87. package/dist/rules/security.d.ts.map +1 -1
  88. package/dist/rules/security.js +59 -5
  89. package/dist/rules/security.js.map +1 -1
  90. package/dist/smells/duplicate-bodies.d.ts +1 -1
  91. package/dist/smells/duplicate-bodies.d.ts.map +1 -1
  92. package/dist/smells/duplicate-bodies.js +12 -11
  93. package/dist/smells/duplicate-bodies.js.map +1 -1
  94. package/dist/smells/sibling-files.d.ts.map +1 -1
  95. package/dist/smells/sibling-files.js +16 -7
  96. package/dist/smells/sibling-files.js.map +1 -1
  97. package/dist/smells/smell-builder.d.ts.map +1 -1
  98. package/dist/smells/smell-builder.js +15 -1
  99. package/dist/smells/smell-builder.js.map +1 -1
  100. package/package.json +1 -1
@@ -1,3 +1,46 @@
1
+ /**
2
+ * Make a project-relative glob work, instead of failing loudly — plan 0067 C.
3
+ *
4
+ * Globs are matched against **absolute** file paths, so `'src/domain/**'`
5
+ * matches nothing. That is the single commonest real mistake with this library:
6
+ * it is the shape 0.18.1 was released for, and as of **0.34.0** it is a hard
7
+ * build failure telling the author to prefix `'**\/'`.
8
+ *
9
+ * Prefixing works but says something different. `'**\/src/domain/**'` matches a
10
+ * `src/domain` **anywhere** — including `vendor/thing/src/domain`, and
11
+ * including a second `src/` nested inside a monorepo package. What the author
12
+ * meant was the one at the project root. 0067 called normalization "the root
13
+ * cause" fix for that reason, and 0069 sequenced it directly after R3b.
14
+ *
15
+ * So an unanchored glob is matched against the path **relative to the
16
+ * tsconfig's directory**, in addition to the absolute path. Both spellings keep
17
+ * working and they mean different things:
18
+ *
19
+ * | glob | matches |
20
+ * | --------------------- | ------------------------------------------- |
21
+ * | `'src/domain/**'` | that folder **at the project root** |
22
+ * | `'**\/src/domain/**'` | a `src/domain` **anywhere** in the project |
23
+ * | `'/abs/src/domain/**'`| exactly that absolute path |
24
+ *
25
+ * ## Why the root comes from the element, not from the builder
26
+ *
27
+ * A predicate is constructed two ways that must not diverge:
28
+ * `.that().resideInFolder(g)`, where the builder knows the project, and
29
+ * `.that().satisfy(resideInFolder(g))`, where nothing does.
30
+ * `tests/core/glob-declaration.test.ts` exists to assert the two spellings
31
+ * agree, and threading the root through only the first would break that.
32
+ *
33
+ * Every `Located` element can reach its own `SourceFile`, and ts-morph carries
34
+ * the tsconfig it was loaded from on the project's compiler options. So the
35
+ * root is derived where the match happens, from the element itself, and both
36
+ * spellings get it for free.
37
+ *
38
+ * `configFilePath` is `undefined` for a project built in memory or without a
39
+ * tsconfig. That is a genuine "no root known" and normalization is skipped —
40
+ * the glob keeps its absolute-only meaning rather than being matched against
41
+ * something invented.
42
+ */
43
+ import picomatch from 'picomatch';
1
44
  /**
2
45
  * Whether a glob can already match an absolute path, so the `**\/` hint would
3
46
  * be a no-op (or worse). Covers POSIX-absolute and Windows drive-absolute
@@ -8,7 +51,31 @@
8
51
  * under the one that diagnoses.
9
52
  */
10
53
  export function isAnchored(glob) {
11
- return glob.startsWith('**/') || glob.startsWith('/') || /^[A-Za-z]:\//.test(glob);
54
+ return isGlobstarLed(glob) || glob.startsWith('/') || /^[A-Za-z]:\//.test(glob);
55
+ }
56
+ /**
57
+ * A glob that opens with `'**\/'` — "anywhere", the spelling `FAULT_ADVICE`
58
+ * recommends.
59
+ *
60
+ * Named rather than inlined because two predicates in this file read it and they
61
+ * must not become two lists: `isAnchored`, where it is one of three cases, and
62
+ * `readsRootRelativePath`, where it is the case bug 0339 found missing. Not
63
+ * exported — `isAnchored` is the answer any other module wants.
64
+ */
65
+ function isGlobstarLed(glob) {
66
+ return glob.startsWith('**/');
67
+ }
68
+ /**
69
+ * A glob carrying a `./` or `../` segment, anywhere in it.
70
+ *
71
+ * Extracted so `isProjectRelative` and `readsRootRelativePath` test it with ONE
72
+ * regex. They are the two callers and they must agree: the whole point of the
73
+ * exclusion is that `syntacticFault` reports `dot-segment` for such a glob, so a
74
+ * second copy that drifted would let it match at runtime while the gate still
75
+ * called it dead.
76
+ */
77
+ function hasRelativeSegment(glob) {
78
+ return /(?:^|\/)\.\.?\//.test(glob);
12
79
  }
13
80
  /**
14
81
  * Does this glob name a location relative to the project root?
@@ -35,7 +102,7 @@ export function isProjectRelative(glob) {
35
102
  // `undefined` for anything above the root, deliberately, so a `../`
36
103
  // glob would normalize to nothing and be reported dead with three false
37
104
  // causes. Excluded alongside `./` — both are mistakes in both readings.
38
- if (/(?:^|\/)\.\.?\//.test(glob))
105
+ if (hasRelativeSegment(glob))
39
106
  return false;
40
107
  // Derived from `isAnchored`, not restated. They were two lists and disagreed:
41
108
  // `isAnchored` recognises a drive-absolute `C:/x/**` and this did not, so a
@@ -182,4 +249,114 @@ export function relativeToRoot(sourceFile, absolutePath, fallbackTsConfigPath) {
182
249
  const prefix = prefixOf(root);
183
250
  return absolutePath.startsWith(prefix) ? absolutePath.slice(prefix.length) : undefined;
184
251
  }
252
+ /**
253
+ * Is this glob matched against the path named from the project root, as well as
254
+ * the absolute path?
255
+ *
256
+ * ## The case that was missing — bug 0339
257
+ *
258
+ * This used to be `isProjectRelative` alone, so `'**\/src/**'` — the one
259
+ * spelling `FAULT_ADVICE` tells the author to write — was the one spelling that
260
+ * never got the second view. picomatch's default `dot: false` stops `**`
261
+ * crossing a segment that begins with `.`, and these globs are matched against
262
+ * an ABSOLUTE path, so a checkout under `~/.tool/worktrees/app` (a worktree
263
+ * manager's layout, a cache directory, some CI workspaces) selected **nothing**
264
+ * for every rule. Measured on 0.7.0 over one fixture copied to two paths:
265
+ * `resideInFile('**\/src/**')` examined 0 subjects under a dot-segment and 1
266
+ * beside it, and ADR-010's guard then reported correct rules as enforcing
267
+ * nothing — with a remedy that says to widen the selector or declare it empty.
268
+ *
269
+ * It was also the last disagreement with the DIAGNOSIS: `viewsFor` takes
270
+ * satisfiability against the **union** of the absolute and tsconfig-relative
271
+ * views, unconditionally. So a `'**\/src/**'` under a dot-directory was live to
272
+ * `isDeadSite` and dead at runtime — two derivations disagreeing about one glob,
273
+ * which is the failure this file spends most of its guards on.
274
+ *
275
+ * ## Why this is not simply "every glob"
276
+ *
277
+ * Removing the gate outright was tried, and this repository's own controls
278
+ * refused it — both exclusions `isProjectRelative` makes are load-bearing, and
279
+ * neither is about anchoring:
280
+ *
281
+ * - a `./` segment stays excluded, because `syntacticFault` reports
282
+ * `dot-segment` for it. picomatch matches `'./src/domain/**'` against
283
+ * `src/domain`, so offering the view reinstates exactly the split verdict
284
+ * `isProjectRelative`'s own comment records: 3 subjects selected AND a dead
285
+ * selector reported, in one run. `../` is excluded alongside it and is a
286
+ * DIFFERENT fault — `syntacticFault`'s dot-segment test is `/(?:^|\/)\.\//`,
287
+ * which `'../src/**'` does not match, so it is reported `unanchored` instead.
288
+ * The exclusion is right either way (nothing above the root has a second view,
289
+ * so no match is forged); it is the fault name that differs, and this comment
290
+ * claimed one rule for two shapes.
291
+ * - `'*\/x/**'` stays excluded, because it is the last reachable `unanchored`
292
+ * fault for a path glob. Normalizing it made the anchor advice and the whole
293
+ * `ANCHOR_ADVICE` grouping unreachable — measured as seven failures in
294
+ * `tests/builders/slice-rule-builder.test.ts`, whose subject is that each
295
+ * remedy is TRUE.
296
+ *
297
+ * `'/abs/x'` and a drive-absolute `'C:/x'` are excluded too, and there it makes
298
+ * no behavioural difference — neither can match a relative path — but the
299
+ * declaration stays honest about what is tried.
300
+ *
301
+ * So the rule is: the root-relative view is offered to a glob that names a
302
+ * location relative to the root, and to one that says "anywhere". Both readings
303
+ * are location-independent, which is the property the bug was about.
304
+ */
305
+ export function readsRootRelativePath(glob) {
306
+ if (hasRelativeSegment(glob))
307
+ return false;
308
+ return isProjectRelative(glob) || isGlobstarLed(glob);
309
+ }
310
+ /** Compile one path glob. */
311
+ export function pathGlobMatcher(glob) {
312
+ return { glob, isMatch: picomatch(glob), readsRootRelative: readsRootRelativePath(glob) };
313
+ }
314
+ /** Compile several path globs, in order. */
315
+ export function pathGlobMatchers(globs) {
316
+ return globs.map((glob) => pathGlobMatcher(glob));
317
+ }
318
+ /**
319
+ * Does this glob match this path — absolutely, or named from the project root?
320
+ *
321
+ * The one place a path glob meets a path **where a `SourceFile` is in hand**.
322
+ * `disk-set.ts` reimplements the decision inline over walked disk paths, which
323
+ * have no `SourceFile` and are named from a root of their own — that copy is
324
+ * deliberate and is marked as such there, so this is not "the only place" and
325
+ * saying so would leave the next reader trusting a claim with a second copy
326
+ * behind it.
327
+ *
328
+ * Every site that matched a file path against a glob had its own copy of this
329
+ * three-line decision and they disagreed. Over the ten that carry a sabotage row
330
+ * in bug 0339, measured at 0.7.0: **three** offered the second view only for a
331
+ * project-relative glob (`predicates/identity.ts`, `cross-layer-builder.ts`,
332
+ * `slice.ts`'s `resolveByDefinition`), **one** offered it always
333
+ * (`duplicate-bodies.ts`), and **six** never offered it at all. Bug 0339 was in
334
+ * the last group's shape and bug 0036 in the first's.
335
+ * `conditions/reverse-dependency.ts` also offered it always and needed no
336
+ * change, so it has no row.
337
+ *
338
+ * `undefined` from `relativeToRoot` (no root known, or a file above the root) is
339
+ * a genuine "there is no second view" and yields the absolute answer rather than
340
+ * an invented one.
341
+ */
342
+ export function matchesPath(matcher, sourceFile, absolutePath, fallbackTsConfigPath) {
343
+ if (matcher.isMatch(absolutePath))
344
+ return true;
345
+ if (!matcher.readsRootRelative)
346
+ return false;
347
+ const fromRoot = relativeToRoot(sourceFile, absolutePath, fallbackTsConfigPath);
348
+ return fromRoot !== undefined && matcher.isMatch(fromRoot);
349
+ }
350
+ /**
351
+ * Does ANY of these globs match this path?
352
+ *
353
+ * Never `matchers.some(isMatch)` at a call site: picomatch takes the array index
354
+ * as its second argument and returns a truthy object from index 1 onwards, so
355
+ * the shorthand reports a match for every path in a list of two or more. Four
356
+ * files in `src/` carry a comment warning about it; this is the version that
357
+ * cannot be written the other way.
358
+ */
359
+ export function anyMatchesPath(matchers, sourceFile, absolutePath, fallbackTsConfigPath) {
360
+ return matchers.some((matcher) => matchesPath(matcher, sourceFile, absolutePath, fallbackTsConfigPath));
361
+ }
185
362
  //# sourceMappingURL=project-relative.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-relative.js","sourceRoot":"","sources":["../../src/core/project-relative.ts"],"names":[],"mappings":"AA4CA;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACpF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,6EAA6E;IAC7E,wDAAwD;IACxD,EAAE;IACF,6EAA6E;IAC7E,6EAA6E;IAC7E,+CAA+C;IAC/C,4EAA4E;IAC5E,oEAAoE;IACpE,wEAAwE;IACxE,wEAAwE;IACxE,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9C,8EAA8E;IAC9E,4EAA4E;IAC5E,8EAA8E;IAC9E,2EAA2E;IAC3E,kCAAkC;IAClC,6EAA6E;IAC7E,sEAAsE;IACtE,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAClC,yEAAyE;IACzE,6EAA6E;IAC7E,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,kCAAkC;IAClC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAA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A;AAC3F,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,gBAAgB,CAAC,KAAwB;IACvD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;AACnD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,WAAW,CACzB,OAAwB,EACxB,UAAsB,EACtB,YAAoB,EACpB,oBAA6B;IAE7B,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9C,IAAI,CAAC,OAAO,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAA;IAC5C,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAA;IAC/E,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAoC,EACpC,UAAsB,EACtB,YAAoB,EACpB,oBAA6B;IAE7B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAC/B,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,oBAAoB,CAAC,CACrE,CAAA;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Node } from 'ts-morph';
2
+ /**
3
+ * The value a node holds at run time, read through the wrappers that leave it unchanged —
4
+ * parentheses, `as`, `<T>`, `satisfies` and `!`.
5
+ *
6
+ * **One list, every reader.** It began in `models/arch-function.ts` for a variable's initializer
7
+ * (bugs 0306, 0315). Bug 0324 gave the callback extractor a second copy of the decision, and the
8
+ * enforcement review of that fix measured what two copies cost: `use({ handler: (() => x) })` was
9
+ * read by neither the callback conditions nor `functions({ includeObjectLiteralFunctions: true })`,
10
+ * because the extractor unwrapped the ARGUMENT while the object-literal traversal tested the raw
11
+ * property value. The unwrapping and the object-literal walk are both in `core/`, so the list lives
12
+ * here, below both, and `models/` and `helpers/` import it rather than restating it.
13
+ *
14
+ * This module imports nothing but ts-morph, as its neighbour `object-literal-functions.ts` does, so
15
+ * `models → core` and `helpers → core` both stay permitted directions.
16
+ */
17
+ export declare function throughWrappers(node: Node | undefined): Node | undefined;
18
+ /**
19
+ * Whether a node IS one of those wrappers — the same question, derived from the same list rather
20
+ * than restating it. A reader that must know whether a value was reached THROUGH a wrapper, to keep
21
+ * a newly reachable finding numbered after the ones read before it, asks this.
22
+ */
23
+ export declare function isValueWrapper(node: Node): boolean;
24
+ //# sourceMappingURL=through-wrappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"through-wrappers.d.ts","sourceRoot":"","sources":["../../src/core/through-wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAYxE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAElD"}
@@ -0,0 +1,36 @@
1
+ import { Node } from 'ts-morph';
2
+ /**
3
+ * The value a node holds at run time, read through the wrappers that leave it unchanged —
4
+ * parentheses, `as`, `<T>`, `satisfies` and `!`.
5
+ *
6
+ * **One list, every reader.** It began in `models/arch-function.ts` for a variable's initializer
7
+ * (bugs 0306, 0315). Bug 0324 gave the callback extractor a second copy of the decision, and the
8
+ * enforcement review of that fix measured what two copies cost: `use({ handler: (() => x) })` was
9
+ * read by neither the callback conditions nor `functions({ includeObjectLiteralFunctions: true })`,
10
+ * because the extractor unwrapped the ARGUMENT while the object-literal traversal tested the raw
11
+ * property value. The unwrapping and the object-literal walk are both in `core/`, so the list lives
12
+ * here, below both, and `models/` and `helpers/` import it rather than restating it.
13
+ *
14
+ * This module imports nothing but ts-morph, as its neighbour `object-literal-functions.ts` does, so
15
+ * `models → core` and `helpers → core` both stay permitted directions.
16
+ */
17
+ export function throughWrappers(node) {
18
+ let current = node;
19
+ while (Node.isParenthesizedExpression(current) ||
20
+ Node.isAsExpression(current) ||
21
+ Node.isTypeAssertion(current) ||
22
+ Node.isSatisfiesExpression(current) ||
23
+ Node.isNonNullExpression(current)) {
24
+ current = current.getExpression();
25
+ }
26
+ return current;
27
+ }
28
+ /**
29
+ * Whether a node IS one of those wrappers — the same question, derived from the same list rather
30
+ * than restating it. A reader that must know whether a value was reached THROUGH a wrapper, to keep
31
+ * a newly reachable finding numbered after the ones read before it, asks this.
32
+ */
33
+ export function isValueWrapper(node) {
34
+ return throughWrappers(node) !== node;
35
+ }
36
+ //# sourceMappingURL=through-wrappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"through-wrappers.js","sourceRoot":"","sources":["../../src/core/through-wrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,IAAsB;IACpD,IAAI,OAAO,GAAG,IAAI,CAAA;IAClB,OACE,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EACjC,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAA;IACnC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAU;IACvC,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;AACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3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SAAS,GAAG,aAAa,CAAA;CACvE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,EAAE,CAmCtE;AA6FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,aAAa,EAAE,EAC3B,QAAQ,EAAE,MAAM,GACf,aAAa,EAAE,GAAG,SAAS,CA4B7B;AAmCD;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CA2C7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG;IACtD,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,SAAS,EAAE,aAAa,EAAE,CAAA;CAC3B,CAsCA;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAgC7D;AAED,kEAAkE;AAClE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,WAAW,GAAG,SAAS,GAC/B,aAAa,CA4Bf"}
@@ -272,9 +272,17 @@ export function expiredDeclarationViolation(facts, examined) {
272
272
  const name = described.id || described.rule || facts.ruleClass.name;
273
273
  const declaration = facts.emptyDeclarationAdvice();
274
274
  const message = `${declaration} asserted this rule examines nothing, and it examined ${String(examined)} ${singularise(facts.examinedUnitNoun(), examined)}.`;
275
- const suggestion = `Remove ${declaration} and let the rule enforce itself — the thing you were waiting for has ` +
276
- `appeared, and the rule now has something to check. If instead the selection is wider than you ` +
277
- `meant, narrow it and keep the declaration. ` +
275
+ const suggestion =
276
+ // No CAUSE is asserted here on purpose. This said "the thing you were waiting for has appeared",
277
+ // which names one reason among several and is wrong for the others: the rule may examine
278
+ // something now because the code changed, because the selection widened, or because an upgrade
279
+ // changed what the rule READS — measured on bug 0333's upgrade, where a floor rule moved from
280
+ // function subjects to module subjects and this line sent the reader hunting their own diff for
281
+ // code they had not written. ADR-009 rule 2: a wrong attribution sends you in circles.
282
+ `Remove ${declaration} and let the rule enforce itself — it has something to check now, whether ` +
283
+ `because the code changed, because the selection widened, or because an upgrade changed what ` +
284
+ `this rule reads. If instead the selection is wider than you meant, narrow it and keep the ` +
285
+ `declaration. ` +
278
286
  `The rule's own violations are reported as separate findings under the same rule id. ` +
279
287
  UNSUPPRESSABLE;
280
288
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"vacuity-diagnosis.js","sourceRoot":"","sources":["../../src/core/vacuity-diagnosis.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE7E;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,CAAS;IAC1C,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAChF,CAAC;AAED;;;;;;;GAOG;AACH,iFAAiF;AACjF,2EAA2E;AAC3E,mDAAmD;AACnD,0D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AAM;QACf,iDAAiD;QACjD,UAAU,EAAE,MAAM;QAClB,aAAa,EAAE,IAAI;KACpB,CAAA;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Node, type ClassDeclaration, type SourceFile } from 'ts-morph';
1
+ import { type Node, type ClassDeclaration, type SourceFile, type ParameterDeclaration } from 'ts-morph';
2
2
  import type { ExpressionMatcher } from './matchers.js';
3
3
  import type { ArchFunction } from '../models/arch-function.js';
4
4
  /**
@@ -89,16 +89,26 @@ type ClassBodyReach = 'member-code' | 'all-code';
89
89
  * (`bindingPatternMatches`).
90
90
  *
91
91
  * Overload signatures have no body, defaults or decorators, so walking every constructor is the
92
- * same as walking the implementation. `implements` is type-only and docstrings are not code, so
92
+ * same as walking the implementation. An overload's parameter LIST does hold comments, which that
93
+ * rationale does not cover — but ts-morph's `getClasses().getMethods()` yields only the
94
+ * implementation (measured), so neither this search nor the function search reads them, and the
95
+ * two agree. Named in bug 0329 rather than closed here. `implements` is type-only and docstrings are not code, so
93
96
  * neither is read, and a `comment()` rule reads code, not documentation.
94
97
  */
95
98
  export declare function searchClassBody(cls: ClassDeclaration, matcher: ExpressionMatcher, reach: ClassBodyReach): MatchResult;
99
+ /**
100
+ * The code a function's parameters run (bug 0314): for each parameter, its default, then the code of
101
+ * its destructured binding, if it has one. A default runs whenever its argument is omitted — like a
102
+ * class member's parameter default, it is read as the function's code. A parameter without a default
103
+ * or a pattern runs nothing.
104
+ */
105
+ export declare function codeOfParameters(parameters: readonly ParameterDeclaration[]): Node[];
96
106
  /**
97
107
  * Matches in what a call condition searches — an argument, or a callback's body — including the
98
108
  * node itself unless it is a block (bug 0323).
99
109
  *
100
- * An argument can BE the match — `use(legacy(1))` — and so can a concise callback's body, which
101
- * `getFunctionBody` returns as the expression itself: `use(() => legacy(1))`. With
110
+ * An argument can BE the match — `use(legacy(1))` — and so can a concise callback's body, which is
111
+ * the expression itself: `use(() => legacy(1))`. With
102
112
  * `findMatchesInNode` alone neither was tested, under `call()` as under `expression()`. A block is
103
113
  * searched below its root, as `searchFunctionBody` searches a function's own: tested itself, a
104
114
  * block would match a broad pattern against the whole body.
@@ -122,16 +132,6 @@ export declare function findMatchesInEach(roots: readonly Node[], matcher: Expre
122
132
  * still works — it walks the expression subtree.
123
133
  */
124
134
  export declare function searchFunctionBody(fn: ArchFunction, matcher: ExpressionMatcher): MatchResult;
125
- /**
126
- * Extract the body from a function-like argument node.
127
- *
128
- * Handles:
129
- * - ArrowFunction: () => { ... } or () => expr
130
- * - FunctionExpression: function() { ... }
131
- *
132
- * Returns undefined if the node is not a function-like expression.
133
- */
134
- export declare function getFunctionBody(node: Node): Node | undefined;
135
135
  export declare function searchModuleBody(sourceFile: SourceFile, matcher: ExpressionMatcher, options?: ModuleBodyOptions): MatchResult;
136
136
  export {};
137
137
  //# sourceMappingURL=body-traversal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"body-traversal.d.ts","sourceRoot":"","sources":["../../src/helpers/body-traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAGhB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAA;IACd,qEAAqE;IACrE,aAAa,EAAE,IAAI,EAAE,CAAA;IACrB;;;;;;;OAOG;IACH,eAAe,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CACxC;AAED,uEAAuE;AACvE,UAAU,KAAK;IACb,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,SAAS,CAA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,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,iBAAiB,GAAG,WAAW,CA4D5F;AAkCD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,WAAW,CA4Bb"}
@@ -144,7 +144,10 @@ function triviaMatches(node, matcher) {
144
144
  * (`bindingPatternMatches`).
145
145
  *
146
146
  * Overload signatures have no body, defaults or decorators, so walking every constructor is the
147
- * same as walking the implementation. `implements` is type-only and docstrings are not code, so
147
+ * same as walking the implementation. An overload's parameter LIST does hold comments, which that
148
+ * rationale does not cover — but ts-morph's `getClasses().getMethods()` yields only the
149
+ * implementation (measured), so neither this search nor the function search reads them, and the
150
+ * two agree. Named in bug 0329 rather than closed here. `implements` is type-only and docstrings are not code, so
148
151
  * neither is read, and a `comment()` rule reads code, not documentation.
149
152
  */
150
153
  export function searchClassBody(cls, matcher, reach) {
@@ -203,34 +206,119 @@ export function searchClassBody(cls, matcher, reach) {
203
206
  matchingNodes.push(...bindingPatternMatches(parameter.getNameNode(), matcher));
204
207
  }
205
208
  }
209
+ matchingNodes.push(...parameterListComments(runnable, matcher, reach, matchingNodes));
206
210
  return toResult(matchingNodes);
207
211
  }
208
212
  /**
209
- * Matches in the code a destructured parameter runs at each call (bug 0309): for each binding
210
- * element, at any depth, its computed key, then its default, then the pattern it destructures into —
211
- * the order they run. A name that is not a pattern runs nothing, and a hole in an array pattern is
212
- * not an element.
213
+ * The comments written inside a member's parameter LIST that the passes above have not already
214
+ * found (bug 0325) — everything between `(` and `)`, by position.
213
215
  *
214
- * Apart from any one search, so the function search can read a function's parameters the same way
215
- * (bug 0314).
216
+ * The class search reads a parameter as CODE — its default, and a destructured parameter's defaults
217
+ * and computed keys — so a comment matcher searching those expressions misses a comment written on
218
+ * the parameter itself, and one written inline between `=` and the default, which TypeScript counts
219
+ * as leading trivia of neither. Measured before this fix: `m(g = /* TODO *\/ 1)` and a `// TODO` on its own
220
+ * line before a parameter were 0 for the class rules and 1 for the function rules, on the same
221
+ * member. A comment in a parameter list is the function search's for free — it starts a trivia
222
+ * matcher at the declaration — and a class rule that cannot see a TODO marker there is a false green.
223
+ *
224
+ * **The span, not each parameter.** A first version walked each `ParameterDeclaration`, and a
225
+ * comment on the same line as the `(` or a `,` belongs to that TOKEN rather than to the parameter
226
+ * after it — TypeScript starts collecting leading trivia only after a line break. Six placements
227
+ * stayed silent, `m(/* TODO *\/ g = 1)` and `m(a, /* TODO *\/ b)` among them, while the docs said the
228
+ * parameter list was read. So the walk takes the parens and the list, and keeps every comment
229
+ * POSITIONED inside them: the `(`'s trailing trivia and the `)`'s leading trivia are in, the
230
+ * member's docstring and anything after `)` are out, whatever node they happen to hang from.
231
+ *
232
+ * **A member's own docstring is still not read** (bug 0307): it lies before the `(`. Measured — the
233
+ * class search reports 0 for `/** TODO *\/` above a method, before this pass and after it. So does a
234
+ * comment in the return type or between `)` and `{`, which is bug 0329.
235
+ *
236
+ * Under `'member-code'` reach a comment inside a parameter's DECORATOR is left out, for the same
237
+ * reason the decorator's code is (bug 0307): a must-contain rule must not be satisfied by wiring.
238
+ * Its span covers the decorator's own leading trivia, so a comment written above `@Inject()` counts
239
+ * as the decorator's, as a docstring counts as the member's.
240
+ *
241
+ * Deduplicated by comment position against everything already found, and pushed LAST, so a comment
242
+ * inside a default keeps the ordinal a baseline accepted and a newly read one is numbered after it.
216
243
  */
217
- function bindingPatternMatches(name, matcher) {
244
+ function parameterListComments(members, matcher, reach, found) {
245
+ if (matcher.matchedTriviaPositions === undefined)
246
+ return [];
247
+ const seen = new Set(found.map((match) => match.triviaPos));
248
+ const out = [];
249
+ for (const member of members) {
250
+ const open = member.getFirstChildByKind(SyntaxKind.OpenParenToken);
251
+ const close = member.getFirstChildByKind(SyntaxKind.CloseParenToken);
252
+ if (open === undefined || close === undefined)
253
+ continue;
254
+ const wiring = reach === 'all-code'
255
+ ? []
256
+ : member
257
+ .getParameters()
258
+ .flatMap((parameter) => parameter.getDecorators())
259
+ .map((decorator) => [
260
+ decorator.getFullStart(),
261
+ decorator.getEnd(),
262
+ ]);
263
+ // The list itself carries the commas; the parens carry the trivia written against them.
264
+ const roots = [open, close, ...member.getChildrenOfKind(SyntaxKind.SyntaxList)];
265
+ const inList = (pos) => pos >= open.getEnd() && pos < close.getStart();
266
+ for (const match of roots.flatMap((root) => findMatchesInNode(root, matcher))) {
267
+ const pos = match.triviaPos;
268
+ if (pos === undefined || seen.has(pos) || !inList(pos))
269
+ continue;
270
+ if (wiring.some(([start, end]) => pos >= start && pos < end))
271
+ continue;
272
+ seen.add(pos);
273
+ out.push(match);
274
+ }
275
+ }
276
+ return out.sort((a, b) => (a.triviaPos ?? 0) - (b.triviaPos ?? 0));
277
+ }
278
+ /**
279
+ * The code a destructured binding runs (bug 0309): for each binding element, at any depth, its computed
280
+ * key, then its default, then the pattern it destructures into — the order they run. A name that is not
281
+ * a pattern runs nothing, and a hole in an array pattern is not an element.
282
+ *
283
+ * One walk for both searches: the class search reads a member's parameters with it through
284
+ * `bindingPatternMatches`, and the function search a function's through `codeOfParameters` (bug 0314).
285
+ */
286
+ function codeOfBindingPattern(name) {
218
287
  if (!NodeUtils.isObjectBindingPattern(name) && !NodeUtils.isArrayBindingPattern(name))
219
288
  return [];
220
- const matches = [];
289
+ const code = [];
221
290
  for (const element of name.getElements()) {
222
291
  if (!NodeUtils.isBindingElement(element))
223
292
  continue;
224
293
  const key = element.getPropertyNameNode();
225
- if (NodeUtils.isComputedPropertyName(key)) {
226
- matches.push(...findMatchesInExpression(key.getExpression(), matcher));
227
- }
294
+ if (NodeUtils.isComputedPropertyName(key))
295
+ code.push(key.getExpression());
228
296
  const initializer = element.getInitializer();
229
297
  if (initializer !== undefined)
230
- matches.push(...findMatchesInExpression(initializer, matcher));
231
- matches.push(...bindingPatternMatches(element.getNameNode(), matcher));
298
+ code.push(initializer);
299
+ code.push(...codeOfBindingPattern(element.getNameNode()));
232
300
  }
233
- return matches;
301
+ return code;
302
+ }
303
+ /** Matches in the code a destructured parameter of a class member runs (bug 0309). */
304
+ function bindingPatternMatches(name, matcher) {
305
+ return codeOfBindingPattern(name).flatMap((code) => findMatchesInExpression(code, matcher));
306
+ }
307
+ /**
308
+ * The code a function's parameters run (bug 0314): for each parameter, its default, then the code of
309
+ * its destructured binding, if it has one. A default runs whenever its argument is omitted — like a
310
+ * class member's parameter default, it is read as the function's code. A parameter without a default
311
+ * or a pattern runs nothing.
312
+ */
313
+ export function codeOfParameters(parameters) {
314
+ const code = [];
315
+ for (const parameter of parameters) {
316
+ const initializer = parameter.getInitializer();
317
+ if (initializer !== undefined)
318
+ code.push(initializer);
319
+ code.push(...codeOfBindingPattern(parameter.getNameNode()));
320
+ }
321
+ return code;
234
322
  }
235
323
  /**
236
324
  * Matches in an expression that is code in its own right — a property initializer or a
@@ -261,8 +349,8 @@ function findMatchesInExpression(node, matcher) {
261
349
  * Matches in what a call condition searches — an argument, or a callback's body — including the
262
350
  * node itself unless it is a block (bug 0323).
263
351
  *
264
- * An argument can BE the match — `use(legacy(1))` — and so can a concise callback's body, which
265
- * `getFunctionBody` returns as the expression itself: `use(() => legacy(1))`. With
352
+ * An argument can BE the match — `use(legacy(1))` — and so can a concise callback's body, which is
353
+ * the expression itself: `use(() => legacy(1))`. With
266
354
  * `findMatchesInNode` alone neither was tested, under `call()` as under `expression()`. A block is
267
355
  * searched below its root, as `searchFunctionBody` searches a function's own: tested itself, a
268
356
  * block would match a broad pattern against the whole body.
@@ -366,25 +454,13 @@ export function searchFunctionBody(fn, matcher) {
366
454
  if (!NodeUtils.isBlock(body) && !broadHit && matcher.matches(body)) {
367
455
  matchingNodes.push({ node: body });
368
456
  }
369
- return toResult(matchingNodes);
370
- }
371
- /**
372
- * Extract the body from a function-like argument node.
373
- *
374
- * Handles:
375
- * - ArrowFunction: () => { ... } or () => expr
376
- * - FunctionExpression: function() { ... }
377
- *
378
- * Returns undefined if the node is not a function-like expression.
379
- */
380
- export function getFunctionBody(node) {
381
- if (NodeUtils.isArrowFunction(node)) {
382
- return node.getBody();
457
+ // What the parameters run — a default, and a destructured or rest parameter's defaults and computed
458
+ // keys — is the function's code too (bug 0314). Read after the body, so within one function a finding a
459
+ // baseline accepted in the body keeps its identity and a new one is numbered after it.
460
+ for (const code of codeOfParameters(fn.getParameters())) {
461
+ matchingNodes.push(...findMatchesInExpression(code, matcher));
383
462
  }
384
- if (NodeUtils.isFunctionExpression(node)) {
385
- return node.getBody();
386
- }
387
- return undefined;
463
+ return toResult(matchingNodes);
388
464
  }
389
465
  /**
390
466
  * Search a module (SourceFile) for matches.