@starci/eslint-canon-be 3.5.0 → 3.6.1

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 (198) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +13 -2
  3. package/dist/ambient-id.d.ts +9 -0
  4. package/{ambient-id.mjs → dist/ambient-id.js} +43 -39
  5. package/dist/app-composition.d.ts +21 -0
  6. package/{app-composition.mjs → dist/app-composition.js} +396 -300
  7. package/dist/async-discipline.d.ts +9 -0
  8. package/dist/async-discipline.js +77 -0
  9. package/dist/authorization.d.ts +12 -0
  10. package/{authorization.mjs → dist/authorization.js} +53 -59
  11. package/dist/boundary-schema.d.ts +15 -0
  12. package/{boundary-schema.mjs → dist/boundary-schema.js} +120 -105
  13. package/dist/builders.d.ts +21 -0
  14. package/{builders.mjs → dist/builders.js} +162 -146
  15. package/dist/cli.d.ts +15 -0
  16. package/{cli.mjs → dist/cli.js} +97 -82
  17. package/dist/comments.d.ts +52 -0
  18. package/dist/comments.js +412 -0
  19. package/dist/config-owner.d.ts +24 -0
  20. package/{config-owner.mjs → dist/config-owner.js} +256 -219
  21. package/dist/connections.d.ts +12 -0
  22. package/{connections.mjs → dist/connections.js} +138 -140
  23. package/dist/cookies.d.ts +9 -0
  24. package/{cookies.mjs → dist/cookies.js} +58 -58
  25. package/dist/cqrs.d.ts +27 -0
  26. package/{cqrs.mjs → dist/cqrs.js} +341 -282
  27. package/dist/data-access.d.ts +50 -0
  28. package/{data-access.mjs → dist/data-access.js} +238 -243
  29. package/dist/default-deny.d.ts +15 -0
  30. package/{default-deny.mjs → dist/default-deny.js} +103 -88
  31. package/dist/e2e-flow.d.ts +25 -0
  32. package/{e2e-flow.mjs → dist/e2e-flow.js} +113 -112
  33. package/dist/edge-hardening.d.ts +10 -0
  34. package/dist/edge-hardening.js +173 -0
  35. package/dist/error-handling.d.ts +21 -0
  36. package/{error-handling.mjs → dist/error-handling.js} +289 -239
  37. package/dist/event-bus.d.ts +14 -0
  38. package/{event-bus.mjs → dist/event-bus.js} +146 -129
  39. package/dist/feature-thin.d.ts +12 -0
  40. package/{feature-thin.mjs → dist/feature-thin.js} +208 -191
  41. package/dist/function-budget.d.ts +7 -0
  42. package/{function-budget.mjs → dist/function-budget.js} +24 -27
  43. package/dist/health-ready.d.ts +10 -0
  44. package/dist/health-ready.js +703 -0
  45. package/dist/idempotency.d.ts +10 -0
  46. package/{idempotency.mjs → dist/idempotency.js} +296 -226
  47. package/dist/index.d.ts +54 -0
  48. package/{index.mjs → dist/index.js} +91 -109
  49. package/dist/infra-owner.d.ts +18 -0
  50. package/{infra-owner.mjs → dist/infra-owner.js} +58 -51
  51. package/dist/injection.d.ts +30 -0
  52. package/{injection.mjs → dist/injection.js} +397 -344
  53. package/dist/input-bounds.d.ts +15 -0
  54. package/{input-bounds.mjs → dist/input-bounds.js} +143 -132
  55. package/dist/jobs.d.ts +17 -0
  56. package/{jobs.mjs → dist/jobs.js} +116 -99
  57. package/dist/jwt-alg.d.ts +6 -0
  58. package/dist/jwt-alg.js +49 -0
  59. package/dist/lib/app-roles.d.ts +25 -0
  60. package/{lib/app-roles.mjs → dist/lib/app-roles.js} +15 -17
  61. package/dist/lib/ast.d.ts +40 -0
  62. package/dist/lib/ast.js +100 -0
  63. package/dist/lib/client-idempotency.d.ts +3 -0
  64. package/{lib/client-idempotency.mjs → dist/lib/client-idempotency.js} +316 -268
  65. package/dist/lib/config.d.ts +36 -0
  66. package/{lib/config.mjs → dist/lib/config.js} +24 -27
  67. package/dist/lib/db-writes.d.ts +29 -0
  68. package/{lib/db-writes.mjs → dist/lib/db-writes.js} +27 -27
  69. package/dist/lib/declared.d.ts +77 -0
  70. package/{lib/declared.mjs → dist/lib/declared.js} +83 -78
  71. package/dist/lib/doors.d.ts +50 -0
  72. package/{lib/doors.mjs → dist/lib/doors.js} +45 -50
  73. package/dist/lib/edition.d.ts +25 -0
  74. package/{lib/edition.mjs → dist/lib/edition.js} +15 -20
  75. package/dist/lib/entity-writes.d.ts +7 -0
  76. package/{lib/entity-writes.mjs → dist/lib/entity-writes.js} +31 -22
  77. package/dist/lib/hfs-view.d.ts +127 -0
  78. package/dist/lib/hfs-view.js +1 -0
  79. package/dist/lib/hfs.d.ts +34 -0
  80. package/{lib/hfs.mjs → dist/lib/hfs.js} +31 -29
  81. package/dist/lib/import-source.d.ts +63 -0
  82. package/dist/lib/import-source.js +134 -0
  83. package/dist/lib/path.d.ts +8 -0
  84. package/{lib/path.mjs → dist/lib/path.js} +4 -7
  85. package/dist/lib/persistence.d.ts +115 -0
  86. package/{lib/persistence.mjs → dist/lib/persistence.js} +55 -66
  87. package/dist/lib/ports.d.ts +70 -0
  88. package/{lib/ports.mjs → dist/lib/ports.js} +62 -66
  89. package/dist/lib/rule.d.ts +31 -0
  90. package/dist/lib/rule.js +2 -0
  91. package/dist/lib/runtime-root.d.ts +4 -0
  92. package/dist/lib/runtime-root.js +10 -0
  93. package/dist/lib/schema-values.d.ts +13 -0
  94. package/{lib/schema-values.mjs → dist/lib/schema-values.js} +67 -59
  95. package/dist/lib/specifier.d.ts +12 -0
  96. package/dist/lib/specifier.js +29 -0
  97. package/dist/lib/subject-values.d.ts +4 -0
  98. package/dist/lib/subject-values.js +61 -0
  99. package/dist/lib/transactions.d.ts +18 -0
  100. package/{lib/transactions.mjs → dist/lib/transactions.js} +17 -15
  101. package/dist/lib/transport-slots.d.ts +17 -0
  102. package/{lib/transport-slots.mjs → dist/lib/transport-slots.js} +2 -4
  103. package/dist/lib/types.d.ts +96 -0
  104. package/dist/lib/types.js +150 -0
  105. package/dist/lib/unit-spec.d.ts +48 -0
  106. package/{lib/unit-spec.mjs → dist/lib/unit-spec.js} +35 -44
  107. package/dist/lib/webhook-ack.d.ts +4 -0
  108. package/{lib/webhook-ack.mjs → dist/lib/webhook-ack.js} +78 -62
  109. package/dist/lib/webhook-handoff-inbox.d.ts +3 -0
  110. package/{lib/webhook-handoff-inbox.mjs → dist/lib/webhook-handoff-inbox.js} +195 -167
  111. package/dist/lib/webhook-handoff-intake.d.ts +4 -0
  112. package/{lib/webhook-handoff-intake.mjs → dist/lib/webhook-handoff-intake.js} +125 -102
  113. package/dist/lib/webhook-handoff.d.ts +15 -0
  114. package/{lib/webhook-handoff.mjs → dist/lib/webhook-handoff.js} +107 -100
  115. package/dist/lib/webhook-verifiers.d.ts +20 -0
  116. package/{lib/webhook-verifiers.mjs → dist/lib/webhook-verifiers.js} +108 -104
  117. package/dist/lib/why.d.ts +9 -0
  118. package/{lib/why.mjs → dist/lib/why.js} +6 -6
  119. package/dist/log-safety.d.ts +20 -0
  120. package/dist/log-safety.js +308 -0
  121. package/dist/module-layering.d.ts +42 -0
  122. package/dist/module-layering.js +257 -0
  123. package/dist/module-shape.d.ts +47 -0
  124. package/{module-shape.mjs → dist/module-shape.js} +278 -236
  125. package/dist/naming.d.ts +49 -0
  126. package/dist/naming.js +246 -0
  127. package/dist/observability.d.ts +25 -0
  128. package/dist/observability.js +245 -0
  129. package/dist/operations.d.ts +23 -0
  130. package/{operations.mjs → dist/operations.js} +410 -332
  131. package/dist/project-graph.d.ts +9 -0
  132. package/{project-graph.mjs → dist/project-graph.js} +8 -13
  133. package/dist/projections.d.ts +11 -0
  134. package/{projections.mjs → dist/projections.js} +60 -57
  135. package/dist/query-safety.d.ts +21 -0
  136. package/{query-safety.mjs → dist/query-safety.js} +92 -108
  137. package/dist/realtime.d.ts +15 -0
  138. package/{realtime.mjs → dist/realtime.js} +108 -106
  139. package/dist/resilience.d.ts +15 -0
  140. package/dist/resilience.js +319 -0
  141. package/dist/schema-authority.d.ts +15 -0
  142. package/{schema-authority.mjs → dist/schema-authority.js} +256 -220
  143. package/dist/service-deps.d.ts +17 -0
  144. package/{service-deps.mjs → dist/service-deps.js} +133 -130
  145. package/dist/service-isolation.d.ts +8 -0
  146. package/dist/service-isolation.js +76 -0
  147. package/dist/size-budget.d.ts +9 -0
  148. package/{size-budget.mjs → dist/size-budget.js} +27 -27
  149. package/dist/sonar-parity.d.ts +5 -0
  150. package/{sonar-parity.mjs → dist/sonar-parity.js} +7 -7
  151. package/dist/spec-no-skip.d.ts +9 -0
  152. package/dist/spec-no-skip.js +81 -0
  153. package/dist/spec-quality.d.ts +10 -0
  154. package/{spec-quality.mjs → dist/spec-quality.js} +103 -87
  155. package/dist/suppression.d.ts +26 -0
  156. package/{suppression.mjs → dist/suppression.js} +30 -45
  157. package/dist/temporal.d.ts +9 -0
  158. package/{temporal.mjs → dist/temporal.js} +75 -65
  159. package/dist/test-world.d.ts +28 -0
  160. package/{test-world.mjs → dist/test-world.js} +102 -83
  161. package/dist/testing.d.ts +51 -0
  162. package/dist/testing.js +368 -0
  163. package/dist/third-party-owner.d.ts +8 -0
  164. package/{third-party-owner.mjs → dist/third-party-owner.js} +105 -91
  165. package/dist/transport.d.ts +24 -0
  166. package/{transport.mjs → dist/transport.js} +279 -240
  167. package/dist/type-safety.d.ts +25 -0
  168. package/dist/type-safety.js +297 -0
  169. package/dist/unit-spec.d.ts +30 -0
  170. package/{unit-spec.mjs → dist/unit-spec.js} +473 -399
  171. package/dist/uploads.d.ts +9 -0
  172. package/{uploads.mjs → dist/uploads.js} +62 -54
  173. package/dist/user-copy.d.ts +9 -0
  174. package/{user-copy.mjs → dist/user-copy.js} +76 -67
  175. package/dist/webhooks.d.ts +16 -0
  176. package/{webhooks.mjs → dist/webhooks.js} +243 -231
  177. package/package.json +23 -8
  178. package/runtime/knowledge/hfs/canon-pins.yaml +18 -11
  179. package/runtime/scripts/hfs/repo-identity.mjs +5 -4
  180. package/async-discipline.mjs +0 -83
  181. package/comments.mjs +0 -416
  182. package/edge-hardening.mjs +0 -139
  183. package/health-ready.mjs +0 -539
  184. package/jwt-alg.mjs +0 -45
  185. package/lib/ast.mjs +0 -88
  186. package/lib/import-source.mjs +0 -104
  187. package/lib/specifier.mjs +0 -27
  188. package/lib/subject-values.mjs +0 -55
  189. package/lib/types.mjs +0 -133
  190. package/log-safety.mjs +0 -303
  191. package/module-layering.mjs +0 -270
  192. package/naming.mjs +0 -251
  193. package/observability.mjs +0 -241
  194. package/resilience.mjs +0 -304
  195. package/service-isolation.mjs +0 -75
  196. package/spec-no-skip.mjs +0 -85
  197. package/testing.mjs +0 -384
  198. package/type-safety.mjs +0 -323
@@ -0,0 +1,81 @@
1
+ import { hfsOf } from "./lib/hfs.js";
2
+ import { isSpecFile } from "./lib/path.js";
3
+ const RUNNERS = new Set(["describe", "it", "test"]);
4
+ const MARKED = new Set(["xit", "xtest", "xdescribe", "fit", "ftest", "fdescribe"]);
5
+ const BLOCKING_MEMBERS = new Set(["skip", "skipIf", "runIf", "todo", "only"]);
6
+ const RUNNER_PACKAGES = new Set(["@jest/globals", "vitest"]);
7
+ /** The variable a name resolves to from a scope, or null for an unresolved (global) name. */
8
+ const resolve = (scope, name) => {
9
+ for (let current = scope; current; current = current.upper) {
10
+ const variable = current.set.get(name);
11
+ if (variable && variable.defs.length > 0)
12
+ return variable;
13
+ }
14
+ return null;
15
+ };
16
+ /** The module a definition imports from (`undefined` when its parent is not an import with a source). */
17
+ const importedFrom = (def) => {
18
+ const parent = def.parent;
19
+ return parent && "source" in parent ? parent.source?.value : undefined;
20
+ };
21
+ /** A spec runs every test it declares; the skip lives in the world's contract helper. */
22
+ export const specNoSkip = {
23
+ meta: {
24
+ type: "problem",
25
+ docs: { description: "No spec or test-tree file skips, focuses, marks todo or selects its runner conditionally; a contract spec's missing sandbox is a failing test of the test-world library's `sandbox.describe`, never a skip." },
26
+ schema: [],
27
+ messages: {
28
+ skip: "`{{what}}` keeps a test from running. A spec runs every test it declares: delete it or write it. Nothing skips: a contract spec calls `useSandbox(...)` of `@starci/test-world` and writes `sandbox.describe(...)`, which fails naming the missing keys when the sandbox is not configured.",
29
+ select: "A test runner (`{{what}}`) is used as a value here, so the spec picks or hides what runs. Call `describe`/`it`/`test` directly; a contract spec writes `sandbox.describe(...)` from `useSandbox(...)` of `@starci/test-world`, which fails naming the missing keys when the sandbox is not configured.",
30
+ },
31
+ },
32
+ create(context) {
33
+ const filename = context.filename || context.getFilename();
34
+ const slot = hfsOf(context).slotOf(filename);
35
+ if (!isSpecFile(filename) && !String(slot ?? "").startsWith("be.tests."))
36
+ return {};
37
+ const isRunner = (node) => {
38
+ const variable = resolve(context.sourceCode.getScope(node), node.name);
39
+ if (variable === null)
40
+ return true;
41
+ return variable.defs.some((def) => def.type === "ImportBinding" && RUNNER_PACKAGES.has(String(importedFrom(def))));
42
+ };
43
+ return {
44
+ Identifier(node) {
45
+ const parent = node.parent;
46
+ if (parent.type === "TSTypeQuery" || parent.type === "ImportSpecifier" || parent.type === "ExportSpecifier")
47
+ return;
48
+ if (parent.type === "MemberExpression" && parent.property === node && !parent.computed)
49
+ return;
50
+ if ("key" in parent && parent.key === node && !("computed" in parent && parent.computed) && !("shorthand" in parent && parent.shorthand))
51
+ return;
52
+ const marked = MARKED.has(node.name);
53
+ if (!marked && !RUNNERS.has(node.name))
54
+ return;
55
+ if (!isRunner(node))
56
+ return;
57
+ if (marked)
58
+ return context.report({ node, messageId: "skip", data: { what: node.name } });
59
+ if (parent.type === "CallExpression" && parent.callee === node)
60
+ return;
61
+ if (parent.type === "MemberExpression" && parent.object === node) {
62
+ const member = parent.computed ? (parent.property.type === "Literal" ? String(parent.property.value) : null) : parent.property.name;
63
+ if (member === null)
64
+ return context.report({ node: parent, messageId: "select", data: { what: node.name } });
65
+ if (BLOCKING_MEMBERS.has(member))
66
+ return context.report({ node: parent, messageId: "skip", data: { what: `${node.name}.${member}` } });
67
+ return;
68
+ }
69
+ context.report({ node, messageId: "select", data: { what: node.name } });
70
+ },
71
+ };
72
+ },
73
+ };
74
+ /** The rules this law contributes to the plugin. */
75
+ export const rules = {
76
+ "spec-no-skip": specNoSkip,
77
+ };
78
+ /** Every rule of this law ships at `error`. */
79
+ export const recommended = {
80
+ "starci-be/spec-no-skip": "error",
81
+ };
@@ -0,0 +1,10 @@
1
+ import type { Recommended, RuleModule } from "./lib/rule.js";
2
+ /** A spec never opens source files to assert on their text. */
3
+ export declare const specNoSourceRead: RuleModule;
4
+ export declare const specTypedEntityManager: RuleModule;
5
+ export declare const rules: {
6
+ "spec-no-source-read": RuleModule;
7
+ "spec-typed-entity-manager": RuleModule;
8
+ };
9
+ /** Error from the start: the migration lanes replace the source-reading specs before adoption. */
10
+ export declare const recommended: Recommended;
@@ -11,31 +11,31 @@
11
11
  * the dependency's shape changes; a cast keeps compiling and lies. This canon writes no second rule for what the
12
12
  * borrowed rules already state. The e2e rules of R48 live in `e2e-flow.mjs` and `testing.mjs`.
13
13
  */
14
- import { basename } from "node:path"
15
- import { walk } from "./lib/ast.mjs"
16
- import { hfsOf } from "./lib/hfs.mjs"
17
- import { importOf } from "./lib/import-source.mjs"
18
- import { originsOfType, typed } from "./lib/types.mjs"
19
-
20
- const FS_MODULES = new Set(["fs", "node:fs", "fs/promises", "node:fs/promises"])
21
- const FS_READERS = new Set(["readFile", "readFileSync", "readdir", "readdirSync", "glob", "globSync", "opendir", "opendirSync", "createReadStream"])
22
-
14
+ import { basename } from "node:path";
15
+ import { walk } from "./lib/ast.js";
16
+ import { hfsOf } from "./lib/hfs.js";
17
+ import { importOf } from "./lib/import-source.js";
18
+ import { originsOfType, typed } from "./lib/types.js";
19
+ const FS_MODULES = new Set(["fs", "node:fs", "fs/promises", "node:fs/promises"]);
20
+ const FS_READERS = new Set(["readFile", "readFileSync", "readdir", "readdirSync", "glob", "globSync", "opendir", "opendirSync", "createReadStream"]);
23
21
  /** A source file by its extension (a basename role): a spec that reads one reads source. */
24
- const SOURCE_EXTENSION = /\.[cm]?[jt]sx?$/
25
- const SOURCE_ANCHORS = new Set(["__dirname", "__filename"])
26
-
22
+ const SOURCE_EXTENSION = /\.[cm]?[jt]sx?$/;
23
+ const SOURCE_ANCHORS = new Set(["__dirname", "__filename"]);
27
24
  /**
28
25
  * Whether a path text leads into the repository's own tree: the slot manifest owns it, or it starts down a path the
29
26
  * manifest knows (`src`, `apps`, `src/modules`), or it names a source file.
30
27
  */
31
28
  const leadsIntoRepository = (hfs, text) => {
32
- const path = text.replace(/^(?:\.{0,2}[\\/])+/, "")
33
- if (!path) return false
34
- if (SOURCE_EXTENSION.test(path)) return true
35
- const found = hfs.classify(path)
36
- return found.status === "owned" || (found.nearest?.matchedDepth ?? 0) > 0
37
- }
38
-
29
+ const path = text.replace(/^(?:\.{0,2}[\\/])+/, "");
30
+ if (!path)
31
+ return false;
32
+ if (SOURCE_EXTENSION.test(path))
33
+ return true;
34
+ const found = hfs.classify(path);
35
+ const nearest = found.nearest;
36
+ const matchedDepth = nearest && "matchedDepth" in nearest ? nearest.matchedDepth : undefined;
37
+ return found.status === "owned" || Number(matchedDepth ?? 0) > 0;
38
+ };
39
39
  /**
40
40
  * Whether a path expression points at source: it names `__dirname`, `import.meta`, `process.cwd()`, a source file, or
41
41
  * a path the HFS manifest places in the repository. An identifier is followed once to its `const` initializer, so
@@ -43,26 +43,35 @@ const leadsIntoRepository = (hfs, text) => {
43
43
  * wrote to a temporary directory is behavior, and stays outside this rule.
44
44
  */
45
45
  const pointsAtSource = (hfs, expression, scope, depth = 0) => {
46
- if (!expression) return false
47
- let found = false
46
+ if (!expression)
47
+ return false;
48
+ let found = false;
48
49
  walk(expression, (node) => {
49
- if (found) return
50
- if (node.type === "Identifier" && SOURCE_ANCHORS.has(node.name)) found = true
51
- else if (node.type === "MetaProperty") found = true
52
- else if (node.type === "MemberExpression" && node.object.type === "MetaProperty") found = true
53
- else if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "process" && node.callee.property.name === "cwd") found = true
54
- else if (node.type === "Literal" && typeof node.value === "string" && leadsIntoRepository(hfs, node.value)) found = true
55
- else if (node.type === "TemplateElement" && leadsIntoRepository(hfs, node.value.cooked ?? "")) found = true
50
+ if (found)
51
+ return;
52
+ if (node.type === "Identifier" && SOURCE_ANCHORS.has(node.name))
53
+ found = true;
54
+ else if (node.type === "MetaProperty")
55
+ found = true;
56
+ else if (node.type === "MemberExpression" && node.object.type === "MetaProperty")
57
+ found = true;
58
+ else if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "process" && "name" in node.callee.property && node.callee.property.name === "cwd")
59
+ found = true;
60
+ else if (node.type === "Literal" && typeof node.value === "string" && leadsIntoRepository(hfs, node.value))
61
+ found = true;
62
+ else if (node.type === "TemplateElement" && leadsIntoRepository(hfs, node.value.cooked ?? ""))
63
+ found = true;
56
64
  else if (node.type === "Identifier" && depth < 2) {
57
- let reference = scope
58
- while (reference && !reference.set.has(node.name)) reference = reference.upper
59
- const definition = reference?.set.get(node.name)?.defs[0]
60
- if (definition?.node.type === "VariableDeclarator" && pointsAtSource(hfs, definition.node.init, scope, depth + 1)) found = true
65
+ let reference = scope;
66
+ while (reference && !reference.set.has(node.name))
67
+ reference = reference.upper;
68
+ const definition = reference?.set.get(node.name)?.defs[0];
69
+ if (definition?.node.type === "VariableDeclarator" && pointsAtSource(hfs, definition.node.init, scope, depth + 1))
70
+ found = true;
61
71
  }
62
- })
63
- return found
64
- }
65
-
72
+ });
73
+ return found;
74
+ };
66
75
  /** A spec never opens source files to assert on their text. */
67
76
  export const specNoSourceRead = {
68
77
  meta: {
@@ -74,40 +83,46 @@ export const specNoSourceRead = {
74
83
  },
75
84
  },
76
85
  create(context) {
77
- if (!/\.(?:e2e-)?spec\.[cm]?ts$/.test(basename(context.filename || context.getFilename()))) return {}
78
- const hfs = hfsOf(context)
79
- const sourceCode = context.sourceCode || context.getSourceCode()
80
- const namespaces = new Set()
81
- const named = new Set()
86
+ if (!/\.(?:e2e-)?spec\.[cm]?ts$/.test(basename(context.filename || context.getFilename())))
87
+ return {};
88
+ const hfs = hfsOf(context);
89
+ const sourceCode = context.sourceCode || context.getSourceCode();
90
+ const namespaces = new Set();
91
+ const named = new Set();
82
92
  return {
83
93
  ImportDeclaration(node) {
84
- if (typeof node.source.value !== "string" || !FS_MODULES.has(node.source.value)) return
94
+ if (typeof node.source.value !== "string" || !FS_MODULES.has(node.source.value))
95
+ return;
85
96
  for (const specifier of node.specifiers) {
86
97
  if (specifier.type === "ImportSpecifier") {
87
- const imported = specifier.imported.name ?? specifier.imported.value
88
- if (FS_READERS.has(imported)) named.add(specifier.local.name)
89
- else if (imported === "promises") namespaces.add(specifier.local.name)
90
- } else {
91
- namespaces.add(specifier.local.name)
98
+ const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
99
+ if (FS_READERS.has(imported))
100
+ named.add(specifier.local.name);
101
+ else if (imported === "promises")
102
+ namespaces.add(specifier.local.name);
103
+ }
104
+ else {
105
+ namespaces.add(specifier.local.name);
92
106
  }
93
107
  }
94
108
  },
95
109
  CallExpression(node) {
96
- const callee = node.callee
97
- let reads = false
110
+ const callee = node.callee;
111
+ let reads = false;
98
112
  if (callee.type === "Identifier" && named.has(callee.name)) {
99
- reads = true
100
- } else if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" && FS_READERS.has(callee.property.name)) {
101
- const object = callee.object
102
- const base = object.type === "MemberExpression" ? object.object : object
103
- reads = base.type === "Identifier" && namespaces.has(base.name)
113
+ reads = true;
114
+ }
115
+ else if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" && FS_READERS.has(callee.property.name)) {
116
+ const object = callee.object;
117
+ const base = object.type === "MemberExpression" ? object.object : object;
118
+ reads = base.type === "Identifier" && namespaces.has(base.name);
104
119
  }
105
- if (reads && pointsAtSource(hfs, node.arguments[0], sourceCode.getScope(node))) context.report({ node, messageId: "read" })
120
+ if (reads && pointsAtSource(hfs, node.arguments[0], sourceCode.getScope(node)))
121
+ context.report({ node, messageId: "read" });
106
122
  },
107
- }
123
+ };
108
124
  },
109
- }
110
-
125
+ };
111
126
  /**
112
127
  * R48 (unit-test standard 2026-09-30): a unit spec takes its database double from the kit, `mockEntityManager()` (or
113
128
  * `fakeTransaction()`) imported from `@starci/jest-preset`. It never builds an ad-hoc `EntityManager`, `QueryRunner`,
@@ -116,11 +131,9 @@ export const specNoSourceRead = {
116
131
  * `mockEntityManager` / `fakeTransaction` imported from the kit package, and assigning a value to a member of a receiver of
117
132
  * those types (`manager.find = jest.fn()`). The kit package is `ruleParams.be.specDoubles.kit` of the slot manifest.
118
133
  */
119
- const TYPEORM_DOUBLES = ["EntityManager", "QueryRunner", "DataSource", "SelectQueryBuilder", "QueryBuilder"]
120
-
134
+ const TYPEORM_DOUBLES = ["EntityManager", "QueryRunner", "DataSource", "SelectQueryBuilder", "QueryBuilder"];
121
135
  /** The kit functions that build the database double. */
122
- const DATABASE_DOUBLES = ["mockEntityManager", "fakeTransaction"]
123
-
136
+ const DATABASE_DOUBLES = ["mockEntityManager", "fakeTransaction"];
124
137
  export const specTypedEntityManager = {
125
138
  meta: {
126
139
  type: "problem",
@@ -131,43 +144,46 @@ export const specTypedEntityManager = {
131
144
  },
132
145
  },
133
146
  create(context) {
134
- const hfs = hfsOf(context)
135
- const filename = context.filename || context.getFilename()
136
- if (!/\.spec\.ts$/.test(basename(filename)) || /\.e2e-spec\.ts$/.test(basename(filename))) return {}
137
- const kit = hfs.ruleParams.specDoubles.kit
147
+ const hfs = hfsOf(context);
148
+ const filename = context.filename || context.getFilename();
149
+ if (!/\.spec\.ts$/.test(basename(filename)) || /\.e2e-spec\.ts$/.test(basename(filename)))
150
+ return {};
151
+ const kit = hfs.ruleParams.specDoubles.kit;
138
152
  const doubleType = (node) => {
139
- const { checker, toTs } = typed(context)
140
- const tsNode = toTs(node)
141
- if (!tsNode) return undefined
142
- const type = checker.getTypeAtLocation(tsNode)
143
- const parts = type.isUnionOrIntersection() ? type.types : [type]
144
- return TYPEORM_DOUBLES.find((name) => parts.some((part) => originsOfType(checker, part).some((origin) => origin.name === name && origin.module === "typeorm")))
145
- }
153
+ const { checker, toTs } = typed(context);
154
+ const tsNode = toTs(node);
155
+ if (!tsNode)
156
+ return undefined;
157
+ const type = checker.getTypeAtLocation(tsNode);
158
+ const parts = type.isUnionOrIntersection() ? type.types : [type];
159
+ return TYPEORM_DOUBLES.find((name) => parts.some((part) => originsOfType(checker, part).some((origin) => origin.name === name && origin.module === "typeorm")));
160
+ };
146
161
  const fromKit = (callee) => {
147
- const found = callee.type === "Identifier" ? importOf(context, callee) : null
148
- return found !== null && (found.source === kit || found.source.startsWith(`${kit}/`)) && DATABASE_DOUBLES.includes(found.imported)
149
- }
162
+ const found = callee.type === "Identifier" ? importOf(context, callee) : null;
163
+ return found !== null && (found.source === kit || found.source.startsWith(`${kit}/`)) && DATABASE_DOUBLES.includes(found.imported);
164
+ };
150
165
  return {
151
166
  CallExpression(node) {
152
- const type = doubleType(node)
153
- if (type && !fromKit(node.callee)) context.report({ node, messageId: "adhoc", data: { type, kit } })
167
+ const type = doubleType(node);
168
+ if (type && !fromKit(node.callee))
169
+ context.report({ node, messageId: "adhoc", data: { type, kit } });
154
170
  },
155
171
  AssignmentExpression(node) {
156
- if (node.left.type !== "MemberExpression") return
157
- const type = doubleType(node.left.object)
158
- if (type) context.report({ node, messageId: "adhoc", data: { type, kit } })
172
+ if (node.left.type !== "MemberExpression")
173
+ return;
174
+ const type = doubleType(node.left.object);
175
+ if (type)
176
+ context.report({ node, messageId: "adhoc", data: { type, kit } });
159
177
  },
160
- }
178
+ };
161
179
  },
162
- }
163
-
180
+ };
164
181
  export const rules = {
165
182
  "spec-no-source-read": specNoSourceRead,
166
183
  "spec-typed-entity-manager": specTypedEntityManager,
167
- }
168
-
184
+ };
169
185
  /** Error from the start: the migration lanes replace the source-reading specs before adoption. */
170
186
  export const recommended = {
171
187
  "starci-be/spec-no-source-read": "error",
172
188
  "starci-be/spec-typed-entity-manager": "error",
173
- }
189
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The rule that holds "no suppression anywhere" (catalog R18 `HFS_INLINE_SUPPRESSION`).
3
+ *
4
+ * `no-inline-suppression` reports every comment that switches a check off, or declares an exemption, at the place it
5
+ * is written:
6
+ *
7
+ * - ESLint: `eslint-disable` / `eslint-enable` in every form, an `eslint <rule>: off` configuration comment,
8
+ * `eslint-env`, and a `/* global x *\/` declaration;
9
+ * - TypeScript: `@ts-ignore`, `@ts-expect-error` and `@ts-nocheck`, wherever they sit in a comment;
10
+ * - coverage: `istanbul ignore`, `c8 ignore`, `v8 ignore`;
11
+ * - Sonar: its no-sonar comment and `sonar-disable`;
12
+ * - Prettier: `prettier-ignore`.
13
+ *
14
+ * The factory also sets `noInlineConfig: true`, so ESLint itself ignores such a comment; this rule is what turns the
15
+ * ignored comment into a failure a person reads, instead of a silent no-op that looks like an exemption. There is no
16
+ * exit here: fix the code, or propose a change to the canon.
17
+ */
18
+ import type { Recommended, RuleModule } from "./lib/rule.js";
19
+ /** No comment switches a check off at the place it is written. */
20
+ export declare const noInlineSuppression: RuleModule;
21
+ /** The rules this law contributes to the plugin. */
22
+ export declare const rules: {
23
+ "no-inline-suppression": RuleModule;
24
+ };
25
+ /** Error from the start: there is no baseline and no allowlist for a suppression. */
26
+ export declare const recommended: Recommended;
@@ -1,41 +1,27 @@
1
- /**
2
- * The rule that holds "no suppression anywhere" (catalog R18 `HFS_INLINE_SUPPRESSION`).
3
- *
4
- * `no-inline-suppression` reports every comment that switches a check off, or declares an exemption, at the place it
5
- * is written:
6
- *
7
- * - ESLint: `eslint-disable` / `eslint-enable` in every form, an `eslint <rule>: off` configuration comment,
8
- * `eslint-env`, and a `/* global x *\/` declaration;
9
- * - TypeScript: `@ts-ignore`, `@ts-expect-error` and `@ts-nocheck`, wherever they sit in a comment;
10
- * - coverage: `istanbul ignore`, `c8 ignore`, `v8 ignore`;
11
- * - Sonar: its no-sonar comment and `sonar-disable`;
12
- * - Prettier: `prettier-ignore`.
13
- *
14
- * The factory also sets `noInlineConfig: true`, so ESLint itself ignores such a comment; this rule is what turns the
15
- * ignored comment into a failure a person reads, instead of a silent no-op that looks like an exemption. There is no
16
- * exit here: fix the code, or propose a change to the canon.
17
- */
18
-
19
- const ESLINT_DIRECTIVE = /^\s*eslint-(?:disable|enable|env)(?:-next-line|-line)?(?:\s|$)/
20
- const ESLINT_CONFIG = /^\s*eslint\s+[@\w/-]+\s*:\s*(?:0|1|2|off|warn|error|\[)/
21
- const GLOBAL_DECLARATION = /^\s*globals?\s+[\w$]/
22
- const TS_DIRECTIVE = /@ts-(?:ignore|expect-error|nocheck)\b/
23
- const COVERAGE_IGNORE = /(?:^|[\s*/])(?:istanbul|c8|v8)\s+ignore\b/
24
- const SONAR = /\bNOSONAR\b|\bsonar-(?:disable|enable)\b/i
25
- const PRETTIER_IGNORE = /(?:^|[\s*/])prettier-ignore\b/
26
-
1
+ const ESLINT_DIRECTIVE = /^\s*eslint-(?:disable|enable|env)(?:-next-line|-line)?(?:\s|$)/;
2
+ const ESLINT_CONFIG = /^\s*eslint\s+[@\w/-]+\s*:\s*(?:0|1|2|off|warn|error|\[)/;
3
+ const GLOBAL_DECLARATION = /^\s*globals?\s+[\w$]/;
4
+ const TS_DIRECTIVE = /@ts-(?:ignore|expect-error|nocheck)\b/;
5
+ const COVERAGE_IGNORE = /(?:^|[\s*/])(?:istanbul|c8|v8)\s+ignore\b/;
6
+ const SONAR = /\bNOSONAR\b|\bsonar-(?:disable|enable)\b/i;
7
+ const PRETTIER_IGNORE = /(?:^|[\s*/])prettier-ignore\b/;
27
8
  /** The finding a comment is, or null when it is ordinary prose. `/* global x *\/` is a block-comment form only. */
28
9
  const kindOf = (comment) => {
29
- const text = comment.value
30
- if (ESLINT_DIRECTIVE.test(text) || ESLINT_CONFIG.test(text)) return "eslint"
31
- if (comment.type === "Block" && GLOBAL_DECLARATION.test(text)) return "eslint"
32
- if (TS_DIRECTIVE.test(text)) return "typescript"
33
- if (COVERAGE_IGNORE.test(text)) return "coverage"
34
- if (SONAR.test(text)) return "sonar"
35
- if (PRETTIER_IGNORE.test(text)) return "prettier"
36
- return null
37
- }
38
-
10
+ const text = comment.value;
11
+ if (ESLINT_DIRECTIVE.test(text) || ESLINT_CONFIG.test(text))
12
+ return "eslint";
13
+ if (comment.type === "Block" && GLOBAL_DECLARATION.test(text))
14
+ return "eslint";
15
+ if (TS_DIRECTIVE.test(text))
16
+ return "typescript";
17
+ if (COVERAGE_IGNORE.test(text))
18
+ return "coverage";
19
+ if (SONAR.test(text))
20
+ return "sonar";
21
+ if (PRETTIER_IGNORE.test(text))
22
+ return "prettier";
23
+ return null;
24
+ };
39
25
  /** No comment switches a check off at the place it is written. */
40
26
  export const noInlineSuppression = {
41
27
  meta: {
@@ -51,24 +37,23 @@ export const noInlineSuppression = {
51
37
  },
52
38
  },
53
39
  create(context) {
54
- const sourceCode = context.sourceCode || context.getSourceCode()
40
+ const sourceCode = context.sourceCode || context.getSourceCode();
55
41
  return {
56
42
  "Program:exit"() {
57
43
  for (const comment of sourceCode.getAllComments()) {
58
- const kind = kindOf(comment)
59
- if (kind) context.report({ loc: comment.loc, messageId: kind })
44
+ const kind = kindOf(comment);
45
+ if (kind)
46
+ context.report({ loc: comment.loc, messageId: kind });
60
47
  }
61
48
  },
62
- }
49
+ };
63
50
  },
64
- }
65
-
51
+ };
66
52
  /** The rules this law contributes to the plugin. */
67
53
  export const rules = {
68
54
  "no-inline-suppression": noInlineSuppression,
69
- }
70
-
55
+ };
71
56
  /** Error from the start: there is no baseline and no allowlist for a suppression. */
72
57
  export const recommended = {
73
58
  "starci-be/no-inline-suppression": "error",
74
- }
59
+ };
@@ -0,0 +1,9 @@
1
+ import type { Recommended, RuleModule } from "./lib/rule.js";
2
+ /** Only `platform/clock` reads the ambient clock. */
3
+ export declare const noAmbientClock: RuleModule;
4
+ /** The rule this law contributes to the plugin. */
5
+ export declare const rules: {
6
+ "no-ambient-clock": RuleModule;
7
+ };
8
+ /** Starts at error: no baseline exists, and the repositories' fix lanes clear the debt with a Clock codemod. */
9
+ export declare const recommended: Recommended;