@nielspeter/eess-ts 0.5.1 → 0.7.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 (117) hide show
  1. package/README.md +2 -2
  2. package/dist/builders/class-rule-builder.d.ts +6 -10
  3. package/dist/builders/class-rule-builder.d.ts.map +1 -1
  4. package/dist/builders/class-rule-builder.js +33 -4
  5. package/dist/builders/class-rule-builder.js.map +1 -1
  6. package/dist/builders/function-rule-builder.d.ts +29 -7
  7. package/dist/builders/function-rule-builder.d.ts.map +1 -1
  8. package/dist/builders/function-rule-builder.js +34 -8
  9. package/dist/builders/function-rule-builder.js.map +1 -1
  10. package/dist/conditions/body-analysis-function.d.ts.map +1 -1
  11. package/dist/conditions/body-analysis-function.js +19 -1
  12. package/dist/conditions/body-analysis-function.js.map +1 -1
  13. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  14. package/dist/conditions/body-analysis-module.js +37 -4
  15. package/dist/conditions/body-analysis-module.js.map +1 -1
  16. package/dist/conditions/body-analysis.d.ts +5 -2
  17. package/dist/conditions/body-analysis.d.ts.map +1 -1
  18. package/dist/conditions/body-analysis.js +9 -6
  19. package/dist/conditions/body-analysis.js.map +1 -1
  20. package/dist/conditions/call.d.ts +8 -5
  21. package/dist/conditions/call.d.ts.map +1 -1
  22. package/dist/conditions/call.js +46 -20
  23. package/dist/conditions/call.js.map +1 -1
  24. package/dist/conditions/catch-analysis.d.ts +7 -1
  25. package/dist/conditions/catch-analysis.d.ts.map +1 -1
  26. package/dist/conditions/catch-analysis.js +26 -27
  27. package/dist/conditions/catch-analysis.js.map +1 -1
  28. package/dist/conditions/class.d.ts +5 -3
  29. package/dist/conditions/class.d.ts.map +1 -1
  30. package/dist/conditions/class.js +9 -6
  31. package/dist/conditions/class.js.map +1 -1
  32. package/dist/conditions/function.d.ts +4 -4
  33. package/dist/conditions/function.js +4 -4
  34. package/dist/core/execute-rule.js +1 -1
  35. package/dist/core/object-literal-functions.d.ts +4 -1
  36. package/dist/core/object-literal-functions.d.ts.map +1 -1
  37. package/dist/core/object-literal-functions.js +27 -5
  38. package/dist/core/object-literal-functions.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/graphql/resolver-rule-builder.d.ts.map +1 -1
  47. package/dist/graphql/resolver-rule-builder.js +16 -2
  48. package/dist/graphql/resolver-rule-builder.js.map +1 -1
  49. package/dist/helpers/body-traversal.d.ts +74 -20
  50. package/dist/helpers/body-traversal.d.ts.map +1 -1
  51. package/dist/helpers/body-traversal.js +273 -48
  52. package/dist/helpers/body-traversal.js.map +1 -1
  53. package/dist/helpers/callback-extractor.d.ts +6 -1
  54. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  55. package/dist/helpers/callback-extractor.js +45 -10
  56. package/dist/helpers/callback-extractor.js.map +1 -1
  57. package/dist/helpers/global-binding.d.ts +11 -0
  58. package/dist/helpers/global-binding.d.ts.map +1 -0
  59. package/dist/helpers/global-binding.js +232 -0
  60. package/dist/helpers/global-binding.js.map +1 -0
  61. package/dist/helpers/heritage.d.ts +25 -0
  62. package/dist/helpers/heritage.d.ts.map +1 -0
  63. package/dist/helpers/heritage.js +41 -0
  64. package/dist/helpers/heritage.js.map +1 -0
  65. package/dist/index.d.ts +3 -3
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +2 -2
  68. package/dist/index.js.map +1 -1
  69. package/dist/models/arch-function.d.ts +44 -14
  70. package/dist/models/arch-function.d.ts.map +1 -1
  71. package/dist/models/arch-function.js +226 -43
  72. package/dist/models/arch-function.js.map +1 -1
  73. package/dist/predicates/class.d.ts +9 -9
  74. package/dist/predicates/class.d.ts.map +1 -1
  75. package/dist/predicates/class.js +14 -13
  76. package/dist/predicates/class.js.map +1 -1
  77. package/dist/predicates/function.d.ts +16 -4
  78. package/dist/predicates/function.d.ts.map +1 -1
  79. package/dist/predicates/function.js +56 -3
  80. package/dist/predicates/function.js.map +1 -1
  81. package/dist/predicates/type.d.ts +2 -1
  82. package/dist/predicates/type.d.ts.map +1 -1
  83. package/dist/predicates/type.js +6 -2
  84. package/dist/predicates/type.js.map +1 -1
  85. package/dist/presets/agent-guardrails.js +5 -5
  86. package/dist/presets/agent-guardrails.js.map +1 -1
  87. package/dist/presets/recommended.d.ts +14 -6
  88. package/dist/presets/recommended.d.ts.map +1 -1
  89. package/dist/presets/recommended.js +30 -11
  90. package/dist/presets/recommended.js.map +1 -1
  91. package/dist/rules/code-quality.d.ts +12 -1
  92. package/dist/rules/code-quality.d.ts.map +1 -1
  93. package/dist/rules/code-quality.js +106 -12
  94. package/dist/rules/code-quality.js.map +1 -1
  95. package/dist/rules/errors.d.ts +4 -2
  96. package/dist/rules/errors.d.ts.map +1 -1
  97. package/dist/rules/errors.js +44 -23
  98. package/dist/rules/errors.js.map +1 -1
  99. package/dist/rules/hygiene.d.ts +3 -1
  100. package/dist/rules/hygiene.d.ts.map +1 -1
  101. package/dist/rules/hygiene.js +3 -1
  102. package/dist/rules/hygiene.js.map +1 -1
  103. package/dist/rules/metrics.d.ts +6 -4
  104. package/dist/rules/metrics.d.ts.map +1 -1
  105. package/dist/rules/metrics.js +40 -20
  106. package/dist/rules/metrics.js.map +1 -1
  107. package/dist/rules/security.d.ts +19 -5
  108. package/dist/rules/security.d.ts.map +1 -1
  109. package/dist/rules/security.js +198 -19
  110. package/dist/rules/security.js.map +1 -1
  111. package/dist/rules/typescript.d.ts +2 -2
  112. package/dist/rules/typescript.js +2 -2
  113. package/dist/smells/duplicate-bodies.js +2 -2
  114. package/dist/smells/duplicate-bodies.js.map +1 -1
  115. package/dist/smells/sibling-files.js +2 -2
  116. package/dist/smells/sibling-files.js.map +1 -1
  117. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { ArchConfigError } from '@nielspeter/eess';
2
2
  import { Node as NodeClass, Scope, SyntaxKind, } from 'ts-morph';
3
3
  import { collectObjectLiteralFunctions } from '../core/object-literal-functions.js';
4
+ import { throughWrappers } from '../core/through-wrappers.js';
4
5
  /**
5
6
  * Wrap a callable node as an `ArchFunction`, taking its name from the caller.
6
7
  *
@@ -24,7 +25,10 @@ export function fromCallableNode(node, getName) {
24
25
  getName,
25
26
  getSourceFile: () => node.getSourceFile(),
26
27
  isExported: () => false,
27
- isAsync: () => node.isAsync(),
28
+ // An accessor cannot be `async`, and ts-morph gives it no `isAsync` to ask (bug 0321).
29
+ isAsync: () => NodeClass.isGetAccessorDeclaration(node) || NodeClass.isSetAccessorDeclaration(node)
30
+ ? false
31
+ : node.isAsync(),
28
32
  getParameters: () => node.getParameters(),
29
33
  getReturnType: () => node.getReturnType(),
30
34
  getBody: () => node.getBody(),
@@ -51,14 +55,14 @@ export function fromFunctionDeclaration(decl) {
51
55
  };
52
56
  }
53
57
  /**
54
- * Create an ArchFunction from a VariableDeclaration whose initializer
55
- * is an ArrowFunction.
58
+ * Create an ArchFunction from a VariableDeclaration whose initializer is a function — an arrow
59
+ * function or a function expression, directly or behind parentheses, `as`, `<T>`, `satisfies` or `!`
60
+ * (bug 0315).
56
61
  *
57
- * Precondition: caller must verify the initializer is an ArrowFunction.
62
+ * Precondition: caller must verify the initializer is one, with {@link functionValueOf}.
58
63
  */
59
64
  export function fromFunctionInitializerDeclaration(decl) {
60
- const arrow = decl.getInitializerIfKind(SyntaxKind.ArrowFunction) ??
61
- decl.getInitializerIfKind(SyntaxKind.FunctionExpression);
65
+ const arrow = functionValueOf(decl.getInitializer());
62
66
  if (!arrow)
63
67
  throw new ArchConfigError('fromFunctionInitializerDeclaration', 'Expected an arrow function or function expression initializer');
64
68
  return {
@@ -87,8 +91,8 @@ export function fromFunctionInitializerDeclaration(decl) {
87
91
  */
88
92
  export function fromMethodDeclaration(method) {
89
93
  const parent = method.getParent();
90
- const className = NodeClass.isClassDeclaration(parent)
91
- ? (parent.getName() ?? '<anonymous>')
94
+ const className = NodeClass.isClassDeclaration(parent) || NodeClass.isClassExpression(parent)
95
+ ? classNameOf(parent)
92
96
  : '<anonymous>';
93
97
  return {
94
98
  getName: () => {
@@ -110,23 +114,107 @@ export function fromMethodDeclaration(method) {
110
114
  getBody: () => method.getBody(),
111
115
  getNode: () => method,
112
116
  getStartLineNumber: () => method.getStartLineNumber(),
113
- getScope: () => {
114
- const scope = method.getScope();
115
- if (scope === Scope.Protected)
116
- return 'protected';
117
- if (scope === Scope.Private)
118
- return 'private';
119
- return 'public';
120
- },
117
+ getScope: () => accessOf(method.getScope()),
118
+ };
119
+ }
120
+ /** The kind of function an `ArchFunction` is, read off the node it reports at. */
121
+ export function functionKindOf(fn) {
122
+ const node = fn.getNode();
123
+ if (NodeClass.isMethodDeclaration(node))
124
+ return 'method';
125
+ if (NodeClass.isConstructorDeclaration(node))
126
+ return 'constructor';
127
+ if (NodeClass.isGetAccessorDeclaration(node))
128
+ return 'getter';
129
+ if (NodeClass.isSetAccessorDeclaration(node))
130
+ return 'setter';
131
+ if (NodeClass.isPropertyDeclaration(node))
132
+ return 'property';
133
+ return 'function';
134
+ }
135
+ /** A member's access modifier as an `ArchFunction` reports it; no modifier is `'public'`. */
136
+ function accessOf(scope) {
137
+ if (scope === Scope.Protected)
138
+ return 'protected';
139
+ if (scope === Scope.Private)
140
+ return 'private';
141
+ return 'public';
142
+ }
143
+ /**
144
+ * The function a node holds, read through the wrappers that leave it unchanged at run time —
145
+ * parentheses, `as`, `<T>`, `satisfies` and `!` — or `undefined` when it holds something else.
146
+ * A variable's initializer and a class property's value are read this way (bugs 0306, 0315).
147
+ */
148
+ export function functionValueOf(node) {
149
+ const current = throughWrappers(node);
150
+ return NodeClass.isArrowFunction(current) || NodeClass.isFunctionExpression(current)
151
+ ? current
152
+ : undefined;
153
+ }
154
+ /**
155
+ * A class member that is a function but not a method, as an `ArchFunction` (bug 0315): the
156
+ * constructor, an accessor, or a property whose value is a function. Named by its class, as a method
157
+ * is; reported at the member, and read through `fn` — the member itself, or the property's function.
158
+ */
159
+ function fromClassMember(cls, member, name, fn) {
160
+ const className = classNameOf(cls);
161
+ return {
162
+ getName: () => `${className}.${name}`,
163
+ getSourceFile: () => member.getSourceFile(),
164
+ isExported: () => (NodeClass.isClassDeclaration(cls) ? cls.isExported() : false),
165
+ isAsync: () => NodeClass.isArrowFunction(fn) || NodeClass.isFunctionExpression(fn) ? fn.isAsync() : false,
166
+ getParameters: () => fn.getParameters(),
167
+ getReturnType: () => fn.getReturnType(),
168
+ getBody: () => fn.getBody(),
169
+ getNode: () => member,
170
+ getStartLineNumber: () => member.getStartLineNumber(),
171
+ getScope: () => accessOf(member.getScope()),
121
172
  };
122
173
  }
174
+ /**
175
+ * The class's function members other than its methods. The constructor with a body, as
176
+ * `Class.constructor` — ts-morph lists an overloaded constructor by its implementation alone, and an
177
+ * ambient class's constructor has no body. Each accessor as `Class.get x` or `Class.set x`: a
178
+ * getter and its setter share a name, and a metric's identity keys on the function's name. Each
179
+ * property whose value is a function, as `Class.handler`.
180
+ */
181
+ /**
182
+ * The name a class's members are reported under: the class's own, else the binding that holds it —
183
+ * `const Expr = class { m() {} }` reports `Expr.m` — else `<anonymous>`, as a default-exported
184
+ * class's members have read since bug 0315.
185
+ */
186
+ function classNameOf(cls) {
187
+ return cls.getName() ?? owningBindingName(cls) ?? '<anonymous>';
188
+ }
189
+ function classMemberFunctions(cls) {
190
+ const members = [];
191
+ for (const ctor of cls.getConstructors()) {
192
+ if (ctor.getBody() !== undefined)
193
+ members.push(fromClassMember(cls, ctor, 'constructor', ctor));
194
+ }
195
+ for (const getter of cls.getGetAccessors()) {
196
+ members.push(fromClassMember(cls, getter, `get ${getter.getName()}`, getter));
197
+ }
198
+ for (const setter of cls.getSetAccessors()) {
199
+ members.push(fromClassMember(cls, setter, `set ${setter.getName()}`, setter));
200
+ }
201
+ for (const property of cls.getProperties()) {
202
+ const value = functionValueOf(property.getInitializer());
203
+ if (value !== undefined)
204
+ members.push(fromClassMember(cls, property, property.getName(), value));
205
+ }
206
+ return members;
207
+ }
123
208
  /**
124
209
  * Scan a source file for functions.
125
210
  *
126
211
  * Returns ArchFunction wrappers for these *named* shapes by default:
127
212
  * 1. FunctionDeclarations — `function foo() {}`
128
- * 2. VariableDeclarations with ArrowFunction initializer — `const foo = () => {}`
129
- * 3. Class MethodDeclarations — `class Foo { bar() {} }` (when includeMethods is true)
213
+ * 2. VariableDeclarations whose initializer is a function — `const foo = () => {}`, also behind
214
+ * parentheses, `as`, `<T>`, `satisfies` or `!`
215
+ * 3. Class members, when includeMethods is true — methods (`Foo.bar`), the constructor
216
+ * (`Foo.constructor`), accessors (`Foo.get x`, `Foo.set x`) and function-valued properties
217
+ * (`Foo.handler`)
130
218
  *
131
219
  * Plus, when `includeObjectLiteralFunctions` is set (default off):
132
220
  * 4. Object-literal function property values (arrows / function expressions /
@@ -139,29 +227,29 @@ export function collectFunctions(sourceFile, options) {
139
227
  const includeMethods = options?.includeMethods ?? true;
140
228
  const includeObjectLiteralFunctions = options?.includeObjectLiteralFunctions ?? false;
141
229
  const functions = [];
142
- // Pattern 1: FunctionDeclarations
143
- for (const fn of sourceFile.getFunctions()) {
144
- functions.push(fromFunctionDeclaration(fn));
145
- }
146
- // Pattern 2: const arrow functions
147
- for (const varDecl of sourceFile.getVariableDeclarations()) {
148
- // ArrowFunction and FunctionExpression both. `const a = function () {}` is
149
- // an ordinary shape and was collected by nothing — bug 0224 measured `eval`
150
- // passing the `recommended` floor inside one, because the element never
151
- // reached the rule at all. (Distinct from the concise-arrow half of that
152
- // bug, which was a traversal gap, not a collection gap.)
153
- if (varDecl.getInitializerIfKind(SyntaxKind.ArrowFunction) ??
154
- varDecl.getInitializerIfKind(SyntaxKind.FunctionExpression)) {
155
- functions.push(fromFunctionInitializerDeclaration(varDecl));
156
- }
157
- }
158
- // Pattern 3: class methods
159
- if (includeMethods) {
160
- for (const cls of sourceFile.getClasses()) {
161
- for (const method of cls.getMethods()) {
162
- functions.push(fromMethodDeclaration(method));
163
- }
164
- }
230
+ // Patterns 1 to 3 run over the file AND over every namespace body in it (bug 0321). A namespace
231
+ // is a scope that holds the same declarations a file does, and `getFunctions()`,
232
+ // `getVariableDeclarations()` and `getClasses()` answer only for the node they are asked. So
233
+ // `export namespace N { export function g() { eval('…') } }` — an ordinary function, in an
234
+ // ordinary place — reached no function rule at all, and the `recommended` floor with it.
235
+ //
236
+ // A namespace inside a FUNCTION is left out: everything in it is already part of that function's
237
+ // body, and collecting it again would report one `eval` twice.
238
+ collectFromScope(sourceFile, functions, includeMethods);
239
+ for (const namespace of namespaceScopes(sourceFile)) {
240
+ // Qualified by the namespace path — `N.Inner.m`, not `Inner.m`. Two namespaces in one file may
241
+ // hold a class of the same name, and an unqualified name would make the violation ambiguous,
242
+ // `.excluding()` hit both, and one accepted finding silently accept the other — bug 0010's
243
+ // collision, which the object-literal collection already prefixes against.
244
+ //
245
+ // The prefix does not remove every collision, and the new one is worth naming: in one file
246
+ // `class Expr { m() {} }`, `const Expr = class { m() {} }` and `namespace Expr { function m() {} }`
247
+ // all report as `Expr.m`. Name-based identity cannot tell them apart, here or on the
248
+ // object-literal path.
249
+ const prefix = namespacePathOf(namespace);
250
+ const collected = [];
251
+ collectFromScope(namespace, collected, includeMethods);
252
+ functions.push(...collected.map((fn) => qualifiedBy(prefix, fn)));
165
253
  }
166
254
  // Pattern 4: object-literal function property values (opt-in, proposal 016).
167
255
  // Collect from top-level object literals only; the shared traversal recurses
@@ -180,7 +268,7 @@ export function collectFunctions(sourceFile, options) {
180
268
  // findings collapsing to 2 identities). The documented example
181
269
  // (`routes["/x"].GET`) always implied this prefix; the code never added it.
182
270
  const owner = owningBindingName(root);
183
- for (const found of collectObjectLiteralFunctions(root)) {
271
+ for (const found of collectObjectLiteralFunctions(root, { includeAccessors: true })) {
184
272
  const keyPath = owner === undefined ? found.keyPath : [owner, ...found.keyPath];
185
273
  const fn = fromObjectLiteralFunction(found.node, keyPath);
186
274
  if (fn)
@@ -190,6 +278,98 @@ export function collectFunctions(sourceFile, options) {
190
278
  }
191
279
  return functions;
192
280
  }
281
+ /**
282
+ * Every namespace body in a file that holds code and is not inside a function, innermost ones
283
+ * included — the scopes bug 0321 added beside the file itself.
284
+ *
285
+ * `ModuleDeclaration` is three declarations wearing one node kind: `namespace N {}`,
286
+ * `declare module 'virtual:mod' {}` and `declare global {}`. Only the first holds code. Taking all
287
+ * three collected subjects that DECLARE rather than run — `global.gf`, and `'virtual:mod'.mg`,
288
+ * whose element name carries a quote and a colon — and an adopter rule about function names
289
+ * reported them. An ambient `declare namespace` is the same: a description, not code.
290
+ */
291
+ function namespaceScopes(sourceFile) {
292
+ if (sourceFile.isDeclarationFile())
293
+ return [];
294
+ return (sourceFile
295
+ .getDescendantsOfKind(SyntaxKind.ModuleDeclaration)
296
+ // AMBIENT is the whole test, and it is the only one that can fail. `declare global {}` and
297
+ // `declare module 'virtual:mod' {}` both carry the keyword, so both go; `namespace N {}` and the
298
+ // legacy `module N {}` both hold code, and both stay. Filtering by `ModuleDeclarationKind`
299
+ // instead dropped the legacy spelling — a false green measured while closing the ambient one —
300
+ // and the two extra filters that briefly guarded the other forms could not be made to fail, so
301
+ // they are not here.
302
+ .filter((namespace) => !namespace.hasDeclareKeyword())
303
+ .filter((namespace) => !isInsideAFunction(namespace)));
304
+ }
305
+ /** The dotted path of a namespace, outermost first: `N` for `N`, `A.B` for `namespace A { namespace B {} }`. */
306
+ function namespacePathOf(namespace) {
307
+ const names = [];
308
+ for (const node of [namespace, ...namespace.getAncestors()]) {
309
+ if (NodeClass.isModuleDeclaration(node))
310
+ names.unshift(node.getName());
311
+ }
312
+ return names.join('.');
313
+ }
314
+ /** The same function, reported under a qualified name. */
315
+ function qualifiedBy(prefix, fn) {
316
+ return {
317
+ ...fn,
318
+ getName: () => {
319
+ const name = fn.getName();
320
+ return name === undefined ? undefined : `${prefix}.${name}`;
321
+ },
322
+ };
323
+ }
324
+ /** Whether a node lies inside a function's body, where an enclosing function already reads it. */
325
+ function isInsideAFunction(node) {
326
+ return node
327
+ .getAncestors()
328
+ .some((ancestor) => NodeClass.isFunctionDeclaration(ancestor) ||
329
+ NodeClass.isFunctionExpression(ancestor) ||
330
+ NodeClass.isArrowFunction(ancestor) ||
331
+ NodeClass.isMethodDeclaration(ancestor) ||
332
+ NodeClass.isConstructorDeclaration(ancestor) ||
333
+ NodeClass.isGetAccessorDeclaration(ancestor) ||
334
+ NodeClass.isSetAccessorDeclaration(ancestor));
335
+ }
336
+ /** Patterns 1 to 3 over one scope — a file, or a namespace body in it (bug 0321). */
337
+ function collectFromScope(scope, functions, includeMethods) {
338
+ // Pattern 1: FunctionDeclarations
339
+ for (const fn of scope.getFunctions()) {
340
+ functions.push(fromFunctionDeclaration(fn));
341
+ }
342
+ // Pattern 2: const arrow functions
343
+ for (const varDecl of scope.getVariableDeclarations()) {
344
+ // ArrowFunction and FunctionExpression both. `const a = function () {}` is
345
+ // an ordinary shape and was collected by nothing — bug 0224 measured `eval`
346
+ // passing the `recommended` floor inside one, because the element never
347
+ // reached the rule at all. (Distinct from the concise-arrow half of that
348
+ // bug, which was a traversal gap, not a collection gap.)
349
+ // Read through parentheses, `as`, `<T>`, `satisfies` and `!` too: `const f = ((x) => …) as F` is
350
+ // the same function, and was collected by nothing (bug 0315).
351
+ if (functionValueOf(varDecl.getInitializer()) !== undefined) {
352
+ functions.push(fromFunctionInitializerDeclaration(varDecl));
353
+ }
354
+ }
355
+ // Pattern 3: class members — each class's methods, then its other function members, which no
356
+ // function rule read before bug 0315. A class EXPRESSION holds the same members as a
357
+ // declaration, so `const Expr = class { m() {…} }` is read too, its members named by the binding
358
+ // that holds it (bug 0321). One held by anything else — passed to a call, chosen by a
359
+ // conditional — stays out, with the inline functions bug 0315 left out on purpose.
360
+ if (includeMethods) {
361
+ const classExpressions = scope
362
+ .getVariableDeclarations()
363
+ .map((varDecl) => throughWrappers(varDecl.getInitializer()))
364
+ .filter((initializer) => NodeClass.isClassExpression(initializer));
365
+ for (const cls of [...scope.getClasses(), ...classExpressions]) {
366
+ for (const method of cls.getMethods()) {
367
+ functions.push(fromMethodDeclaration(method));
368
+ }
369
+ functions.push(...classMemberFunctions(cls));
370
+ }
371
+ }
372
+ }
193
373
  /**
194
374
  * The name of the binding an object literal is assigned to, if any.
195
375
  *
@@ -233,7 +413,10 @@ export function fromObjectLiteralFunction(node, keyPath) {
233
413
  const name = qualifiedName(keyPath);
234
414
  if (NodeClass.isArrowFunction(node) ||
235
415
  NodeClass.isFunctionExpression(node) ||
236
- NodeClass.isMethodDeclaration(node)) {
416
+ NodeClass.isMethodDeclaration(node) ||
417
+ // An object literal's accessors, the counterpart of the class accessors bug 0315 collected.
418
+ NodeClass.isGetAccessorDeclaration(node) ||
419
+ NodeClass.isSetAccessorDeclaration(node)) {
237
420
  return fromCallableNode(node, () => name);
238
421
  }
239
422
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"arch-function.js","sourceRoot":"","sources":["../../src/models/arch-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAUL,IAAI,IAAI,SAAS,EACjB,KAAK,EACL,UAAU,GACX,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAA;AAsDnF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAA4D,EAC5D,OAAiC;IAEjC,OAAO;QACL,OAAO;QACP,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;QACzC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;QACvB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;QAC7B,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,C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GAAG,CAAC,CAAA;QAC3D,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,GAAG,CAAA;QAC3B,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAA;IAC9D,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,kCAAkC,CAAA"}
@@ -1,26 +1,26 @@
1
1
  import type { ClassDeclaration } from 'ts-morph';
2
2
  import type { Predicate } from '@nielspeter/eess';
3
3
  /**
4
- * Matches classes that extend the named base class.
5
- *
6
- * Uses the extends clause expression text, e.g. `class Foo extends Bar`
7
- * matches `extend('Bar')`.
4
+ * Matches classes whose direct base is the named class — written as its name, or through an
5
+ * aliased import, a namespace member or a mixin call. `class Foo extends Bar` matches
6
+ * `extend('Bar')`. A class that reaches `Bar` through an intermediate class is not matched.
8
7
  */
9
8
  export declare function extend(className: string): Predicate<ClassDeclaration>;
10
9
  /**
11
- * Matches classes that have an explicit `implements` clause for the named interface.
12
- *
13
- * Checks `getImplements()` expression texts.
10
+ * Matches classes whose own `implements` clause names the interface — as written, or through
11
+ * an aliased import.
14
12
  */
15
13
  export declare function implement(interfaceName: string): Predicate<ClassDeclaration>;
16
14
  /**
17
- * Matches classes that have a decorator with the given name.
15
+ * Matches classes that have a decorator with the given name — as written, or imported under
16
+ * an alias.
18
17
  *
19
18
  * @example haveDecorator('Controller') matches `@Controller class Foo {}`
20
19
  */
21
20
  export declare function haveDecorator(name: string): Predicate<ClassDeclaration>;
22
21
  /**
23
- * Matches classes that have a decorator whose name matches the regex.
22
+ * Matches classes that have a decorator whose name — as written, or the name an aliased
23
+ * import stands for — matches the regex.
24
24
  */
25
25
  export declare function haveDecoratorMatching(regex: RegExp): Predicate<ClassDeclaration>;
26
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/predicates/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKrE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAM5E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKvE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKhF;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKzE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAS7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAK3E"}
1
+ {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/predicates/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKrE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKvE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKhF;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAKzE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAS7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAK3E"}
@@ -1,44 +1,45 @@
1
+ import { decoratorNames, extendsByName, implementsByName } from '../helpers/heritage.js';
1
2
  /**
2
- * Matches classes that extend the named base class.
3
- *
4
- * Uses the extends clause expression text, e.g. `class Foo extends Bar`
5
- * matches `extend('Bar')`.
3
+ * Matches classes whose direct base is the named class — written as its name, or through an
4
+ * aliased import, a namespace member or a mixin call. `class Foo extends Bar` matches
5
+ * `extend('Bar')`. A class that reaches `Bar` through an intermediate class is not matched.
6
6
  */
7
7
  export function extend(className) {
8
8
  return {
9
9
  description: `extend "${className}"`,
10
- test: (cls) => cls.getExtends()?.getExpression().getText() === className,
10
+ test: (cls) => extendsByName(cls, className),
11
11
  };
12
12
  }
13
13
  /**
14
- * Matches classes that have an explicit `implements` clause for the named interface.
15
- *
16
- * Checks `getImplements()` expression texts.
14
+ * Matches classes whose own `implements` clause names the interface — as written, or through
15
+ * an aliased import.
17
16
  */
18
17
  export function implement(interfaceName) {
19
18
  return {
20
19
  description: `implement "${interfaceName}"`,
21
- test: (cls) => cls.getImplements().some((impl) => impl.getExpression().getText() === interfaceName),
20
+ test: (cls) => implementsByName(cls, interfaceName),
22
21
  };
23
22
  }
24
23
  /**
25
- * Matches classes that have a decorator with the given name.
24
+ * Matches classes that have a decorator with the given name — as written, or imported under
25
+ * an alias.
26
26
  *
27
27
  * @example haveDecorator('Controller') matches `@Controller class Foo {}`
28
28
  */
29
29
  export function haveDecorator(name) {
30
30
  return {
31
31
  description: `have decorator @${name}`,
32
- test: (cls) => cls.getDecorators().some((d) => d.getName() === name),
32
+ test: (cls) => cls.getDecorators().some((d) => decoratorNames(d).includes(name)),
33
33
  };
34
34
  }
35
35
  /**
36
- * Matches classes that have a decorator whose name matches the regex.
36
+ * Matches classes that have a decorator whose name — as written, or the name an aliased
37
+ * import stands for — matches the regex.
37
38
  */
38
39
  export function haveDecoratorMatching(regex) {
39
40
  return {
40
41
  description: `have decorator matching ${String(regex)}`,
41
- test: (cls) => cls.getDecorators().some((d) => regex.test(d.getName())),
42
+ test: (cls) => cls.getDecorators().some((d) => decoratorNames(d).some((n) => regex.test(n))),
42
43
  };
43
44
  }
44
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/predicates/class.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,SAAiB;IACtC,OAAO;QACL,WAAW,EAAE,WAAW,SAAS,GAAG;QACpC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,CAAC,OAAO,EAAE,KAAK,SAAS;KACzE,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,aAAqB;IAC7C,OAAO;QACL,WAAW,EAAE,cAAc,aAAa,GAAG;QAC3C,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CACZ,GAAG,CAAC,aAAa,EAAE,CAAC,I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AC,CAAC;KACL,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO;QACL,WAAW,EAAE,wBAAwB,IAAI,GAAG;QAC5C,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS;KACnD,CAAA;AACH,CAAC"}
@@ -1,25 +1,37 @@
1
1
  import type { Predicate } from '@nielspeter/eess';
2
- import type { ArchFunction } from '../models/arch-function.js';
2
+ import { type ArchFunction, type FunctionKind } from '../models/arch-function.js';
3
3
  import type { TypeMatcher } from '../helpers/type-matchers.js';
4
4
  /**
5
5
  * Matches functions/methods with public visibility.
6
6
  *
7
- * - Class methods: matches explicitly `public` or no access modifier (implicitly public).
7
+ * - Class members: matches explicitly `public` or no access modifier (implicitly public).
8
8
  * - Standalone functions / arrow functions: always match (module-level, no visibility concept).
9
9
  */
10
10
  export declare function arePublic(): Predicate<ArchFunction>;
11
11
  /**
12
- * Matches class methods with `protected` visibility.
12
+ * Matches class members with `protected` visibility.
13
13
  *
14
14
  * Standalone functions and arrow functions never match (they have no visibility modifier).
15
15
  */
16
16
  export declare function areProtected(): Predicate<ArchFunction>;
17
17
  /**
18
- * Matches class methods with `private` visibility.
18
+ * Matches class members with `private` visibility.
19
19
  *
20
20
  * Standalone functions and arrow functions never match (they have no visibility modifier).
21
21
  */
22
22
  export declare function arePrivate(): Predicate<ArchFunction>;
23
+ /**
24
+ * Matches functions of any of the given kinds: `'function'`, `'method'`, `'constructor'`,
25
+ * `'getter'`, `'setter'` or `'property'` (see {@link FunctionKind}).
26
+ */
27
+ export declare function areOfKind(...kinds: FunctionKind[]): Predicate<ArchFunction>;
28
+ /**
29
+ * Matches functions of none of the given kinds. Since bug 0315 `functions()` collects a class's
30
+ * constructor and accessors beside its methods; a rule that requires something they cannot give —
31
+ * `beAsync()`, `contain(call(...))` — keeps to the functions that can with
32
+ * `areNotOfKind('constructor', 'getter', 'setter')`.
33
+ */
34
+ export declare function areNotOfKind(...kinds: FunctionKind[]): Predicate<ArchFunction>;
23
35
  /**
24
36
  * Matches async functions (declared with the `async` keyword).
25
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/predicates/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,SAAS,CAAC,YAAY,CAAC,CAKnD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,CAKtD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC,CAKpD;AAID;;GAEG;AACH,wBAAgB,QAAQ,IAAI,SAAS,CAAC,YAAY,CAAC,CAKlD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAAC,YAAY,CAAC,CAKrD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKrE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKhF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAK7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKxE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAMhF;AAED;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AAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKrE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKhF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAK7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKxE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAMhF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAAC,YAAY,CAAC,CAK3D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,CAAC,YAAY,CAAC,CAK/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC,CAUhG;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAKlF"}
@@ -1,8 +1,10 @@
1
+ import { ArchConfigError } from '@nielspeter/eess';
2
+ import { functionKindOf } from '../models/arch-function.js';
1
3
  // --- Visibility predicates (plan 0032) ---
2
4
  /**
3
5
  * Matches functions/methods with public visibility.
4
6
  *
5
- * - Class methods: matches explicitly `public` or no access modifier (implicitly public).
7
+ * - Class members: matches explicitly `public` or no access modifier (implicitly public).
6
8
  * - Standalone functions / arrow functions: always match (module-level, no visibility concept).
7
9
  */
8
10
  export function arePublic() {
@@ -12,7 +14,7 @@ export function arePublic() {
12
14
  };
13
15
  }
14
16
  /**
15
- * Matches class methods with `protected` visibility.
17
+ * Matches class members with `protected` visibility.
16
18
  *
17
19
  * Standalone functions and arrow functions never match (they have no visibility modifier).
18
20
  */
@@ -23,7 +25,7 @@ export function areProtected() {
23
25
  };
24
26
  }
25
27
  /**
26
- * Matches class methods with `private` visibility.
28
+ * Matches class members with `private` visibility.
27
29
  *
28
30
  * Standalone functions and arrow functions never match (they have no visibility modifier).
29
31
  */
@@ -33,6 +35,57 @@ export function arePrivate() {
33
35
  test: (fn) => fn.getScope() === 'private',
34
36
  };
35
37
  }
38
+ // --- Kind predicates (bug 0315) ---
39
+ /** Every kind, checked by the compiler against `FunctionKind` so the two cannot drift apart. */
40
+ const KINDS = {
41
+ function: true,
42
+ method: true,
43
+ constructor: true,
44
+ getter: true,
45
+ setter: true,
46
+ property: true,
47
+ };
48
+ const KNOWN_KINDS = new Set(Object.keys(KINDS));
49
+ /**
50
+ * The kinds a kind predicate names. Naming none is refused, and so is a string that is not a kind: the
51
+ * `FunctionKind` type stops a typo only where the rule file is type-checked, and without this a rule
52
+ * file loaded unchecked would narrow the rule to the kinds it spelled right, and say nothing.
53
+ */
54
+ function namedKinds(predicate, kinds) {
55
+ if (kinds.length === 0) {
56
+ throw new ArchConfigError(predicate, 'name at least one kind, e.g. constructor, getter or setter');
57
+ }
58
+ for (const kind of kinds) {
59
+ if (!KNOWN_KINDS.has(kind)) {
60
+ throw new ArchConfigError(predicate, `'${kind}' is not a function kind; the kinds are ${[...KNOWN_KINDS].join(', ')}`);
61
+ }
62
+ }
63
+ return new Set(kinds);
64
+ }
65
+ /**
66
+ * Matches functions of any of the given kinds: `'function'`, `'method'`, `'constructor'`,
67
+ * `'getter'`, `'setter'` or `'property'` (see {@link FunctionKind}).
68
+ */
69
+ export function areOfKind(...kinds) {
70
+ const named = namedKinds('areOfKind', kinds);
71
+ return {
72
+ description: `are of kind ${kinds.join(', ')}`,
73
+ test: (fn) => named.has(functionKindOf(fn)),
74
+ };
75
+ }
76
+ /**
77
+ * Matches functions of none of the given kinds. Since bug 0315 `functions()` collects a class's
78
+ * constructor and accessors beside its methods; a rule that requires something they cannot give —
79
+ * `beAsync()`, `contain(call(...))` — keeps to the functions that can with
80
+ * `areNotOfKind('constructor', 'getter', 'setter')`.
81
+ */
82
+ export function areNotOfKind(...kinds) {
83
+ const named = namedKinds('areNotOfKind', kinds);
84
+ return {
85
+ description: `are not of kind ${kinds.join(', ')}`,
86
+ test: (fn) => !named.has(functionKindOf(fn)),
87
+ };
88
+ }
36
89
  // --- Async predicates ---
37
90
  /**
38
91
  * Matches async functions (declared with the `async` keyword).