@starci/eslint-canon-be 3.4.57 → 3.6.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 (197) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +11 -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.d.ts +34 -0
  78. package/{lib/hfs.mjs → dist/lib/hfs.js} +31 -29
  79. package/dist/lib/import-source.d.ts +63 -0
  80. package/dist/lib/import-source.js +134 -0
  81. package/dist/lib/path.d.ts +8 -0
  82. package/{lib/path.mjs → dist/lib/path.js} +4 -7
  83. package/dist/lib/persistence.d.ts +115 -0
  84. package/{lib/persistence.mjs → dist/lib/persistence.js} +55 -66
  85. package/dist/lib/ports.d.ts +70 -0
  86. package/{lib/ports.mjs → dist/lib/ports.js} +62 -66
  87. package/dist/lib/rule.d.ts +31 -0
  88. package/dist/lib/rule.js +2 -0
  89. package/dist/lib/runtime-root.d.ts +4 -0
  90. package/dist/lib/runtime-root.js +10 -0
  91. package/dist/lib/schema-values.d.ts +13 -0
  92. package/{lib/schema-values.mjs → dist/lib/schema-values.js} +67 -59
  93. package/dist/lib/specifier.d.ts +12 -0
  94. package/dist/lib/specifier.js +29 -0
  95. package/dist/lib/subject-values.d.ts +4 -0
  96. package/dist/lib/subject-values.js +61 -0
  97. package/dist/lib/transactions.d.ts +18 -0
  98. package/{lib/transactions.mjs → dist/lib/transactions.js} +17 -15
  99. package/dist/lib/transport-slots.d.ts +17 -0
  100. package/{lib/transport-slots.mjs → dist/lib/transport-slots.js} +2 -4
  101. package/dist/lib/types.d.ts +96 -0
  102. package/dist/lib/types.js +150 -0
  103. package/dist/lib/unit-spec.d.ts +48 -0
  104. package/{lib/unit-spec.mjs → dist/lib/unit-spec.js} +35 -44
  105. package/dist/lib/webhook-ack.d.ts +4 -0
  106. package/{lib/webhook-ack.mjs → dist/lib/webhook-ack.js} +78 -62
  107. package/dist/lib/webhook-handoff-inbox.d.ts +3 -0
  108. package/{lib/webhook-handoff-inbox.mjs → dist/lib/webhook-handoff-inbox.js} +195 -167
  109. package/dist/lib/webhook-handoff-intake.d.ts +4 -0
  110. package/{lib/webhook-handoff-intake.mjs → dist/lib/webhook-handoff-intake.js} +125 -102
  111. package/dist/lib/webhook-handoff.d.ts +15 -0
  112. package/{lib/webhook-handoff.mjs → dist/lib/webhook-handoff.js} +107 -100
  113. package/dist/lib/webhook-verifiers.d.ts +20 -0
  114. package/{lib/webhook-verifiers.mjs → dist/lib/webhook-verifiers.js} +108 -104
  115. package/dist/lib/why.d.ts +9 -0
  116. package/{lib/why.mjs → dist/lib/why.js} +6 -6
  117. package/dist/log-safety.d.ts +20 -0
  118. package/dist/log-safety.js +308 -0
  119. package/dist/module-layering.d.ts +42 -0
  120. package/dist/module-layering.js +257 -0
  121. package/dist/module-shape.d.ts +47 -0
  122. package/{module-shape.mjs → dist/module-shape.js} +278 -236
  123. package/dist/naming.d.ts +49 -0
  124. package/dist/naming.js +246 -0
  125. package/dist/observability.d.ts +25 -0
  126. package/dist/observability.js +245 -0
  127. package/dist/operations.d.ts +23 -0
  128. package/{operations.mjs → dist/operations.js} +410 -332
  129. package/dist/project-graph.d.ts +9 -0
  130. package/{project-graph.mjs → dist/project-graph.js} +8 -13
  131. package/dist/projections.d.ts +11 -0
  132. package/{projections.mjs → dist/projections.js} +60 -57
  133. package/dist/query-safety.d.ts +21 -0
  134. package/{query-safety.mjs → dist/query-safety.js} +92 -108
  135. package/dist/realtime.d.ts +15 -0
  136. package/{realtime.mjs → dist/realtime.js} +108 -106
  137. package/dist/resilience.d.ts +15 -0
  138. package/dist/resilience.js +319 -0
  139. package/dist/schema-authority.d.ts +15 -0
  140. package/{schema-authority.mjs → dist/schema-authority.js} +256 -220
  141. package/dist/service-deps.d.ts +17 -0
  142. package/{service-deps.mjs → dist/service-deps.js} +133 -130
  143. package/dist/service-isolation.d.ts +8 -0
  144. package/dist/service-isolation.js +76 -0
  145. package/dist/size-budget.d.ts +9 -0
  146. package/{size-budget.mjs → dist/size-budget.js} +27 -27
  147. package/dist/sonar-parity.d.ts +5 -0
  148. package/{sonar-parity.mjs → dist/sonar-parity.js} +7 -7
  149. package/dist/spec-no-skip.d.ts +9 -0
  150. package/dist/spec-no-skip.js +81 -0
  151. package/dist/spec-quality.d.ts +10 -0
  152. package/{spec-quality.mjs → dist/spec-quality.js} +103 -87
  153. package/dist/suppression.d.ts +26 -0
  154. package/{suppression.mjs → dist/suppression.js} +30 -45
  155. package/dist/temporal.d.ts +9 -0
  156. package/{temporal.mjs → dist/temporal.js} +75 -65
  157. package/dist/test-world.d.ts +28 -0
  158. package/{test-world.mjs → dist/test-world.js} +102 -83
  159. package/dist/testing.d.ts +51 -0
  160. package/dist/testing.js +368 -0
  161. package/dist/third-party-owner.d.ts +8 -0
  162. package/{third-party-owner.mjs → dist/third-party-owner.js} +105 -91
  163. package/dist/transport.d.ts +24 -0
  164. package/{transport.mjs → dist/transport.js} +279 -240
  165. package/dist/type-safety.d.ts +25 -0
  166. package/dist/type-safety.js +297 -0
  167. package/dist/unit-spec.d.ts +30 -0
  168. package/{unit-spec.mjs → dist/unit-spec.js} +473 -399
  169. package/dist/uploads.d.ts +9 -0
  170. package/{uploads.mjs → dist/uploads.js} +62 -54
  171. package/dist/user-copy.d.ts +9 -0
  172. package/{user-copy.mjs → dist/user-copy.js} +76 -67
  173. package/dist/webhooks.d.ts +16 -0
  174. package/{webhooks.mjs → dist/webhooks.js} +243 -231
  175. package/package.json +17 -8
  176. package/runtime/knowledge/hfs/canon-pins.yaml +22 -14
  177. package/runtime/knowledge/hfs/rules.yaml +23 -0
  178. package/runtime/scripts/lib/package-at.mjs +5 -5
  179. package/async-discipline.mjs +0 -83
  180. package/comments.mjs +0 -416
  181. package/edge-hardening.mjs +0 -139
  182. package/health-ready.mjs +0 -539
  183. package/jwt-alg.mjs +0 -45
  184. package/lib/ast.mjs +0 -88
  185. package/lib/import-source.mjs +0 -104
  186. package/lib/specifier.mjs +0 -27
  187. package/lib/subject-values.mjs +0 -55
  188. package/lib/types.mjs +0 -133
  189. package/log-safety.mjs +0 -303
  190. package/module-layering.mjs +0 -270
  191. package/naming.mjs +0 -251
  192. package/observability.mjs +0 -241
  193. package/resilience.mjs +0 -304
  194. package/service-isolation.mjs +0 -75
  195. package/spec-no-skip.mjs +0 -85
  196. package/testing.mjs +0 -384
  197. package/type-safety.mjs +0 -323
@@ -0,0 +1,54 @@
1
+ import type { TSESLint } from "@typescript-eslint/utils";
2
+ import type { CanonPlugin } from "./lib/config.js";
3
+ import type { HfsView } from "./lib/hfs.js";
4
+ import type { RuleEntry, RuleModule } from "./lib/rule.js";
5
+ /** One (law, rule name) pair as a law declares it. */
6
+ interface RuleDeclaration {
7
+ law: string;
8
+ name: string;
9
+ }
10
+ /** Every gathered law. */
11
+ export declare const lawOwners: string[];
12
+ /**
13
+ * Every (law, rule name) pair as DECLARED, before any collapsing.
14
+ *
15
+ * This exists because `ruleOwners` and `rules` below are both built with `Object.fromEntries`, which
16
+ * silently keeps the last writer when two laws declare one name. A test that walks either of them
17
+ * therefore cannot see a collision: the duplicate is already gone by the time it looks, so every
18
+ * name appears exactly once BY CONSTRUCTION and the check passes forever while being blind.
19
+ *
20
+ * That is exactly what happened - three back-end rules were declared by two laws each, one copy was
21
+ * discarded on import, and the guard reported green the whole time. A gate that cannot fail is
22
+ * indistinguishable from no gate, so the raw declarations are published here and the guard walks
23
+ * these instead.
24
+ */
25
+ export declare const ruleDeclarations: RuleDeclaration[];
26
+ /**
27
+ * Which law declares each rule.
28
+ *
29
+ * Exported because a failing rule is a question about a LAW, and the shortest path from a build log
30
+ * to the document that explains it is this map. It answers "who owns this name" for a name that
31
+ * SHIPPED; proving no two laws claim one name is `ruleDeclarations`' job, not this map's.
32
+ */
33
+ export declare const ruleOwners: Record<string, string>;
34
+ /** Every rule this canon publishes, keyed by its published name. */
35
+ export declare const rules: Record<string, RuleModule>;
36
+ /**
37
+ * The levels this canon asks for: every rule at `error`. There is no `warn` and no burn-down level; a rule with
38
+ * debt is fixed in the repositories before it ships, never published weaker.
39
+ */
40
+ export declare const recommended: Record<string, RuleEntry>;
41
+ /** The plugin object, shaped the way a flat config expects it. */
42
+ declare const plugin: CanonPlugin;
43
+ export default plugin;
44
+ /**
45
+ * The whole flat config of a back end: `export default starciBeConfig({ hfs: loadHfs(import.meta.url) })`.
46
+ *
47
+ * @param input - The HFS view of the repository.
48
+ * @returns The flat config.
49
+ */
50
+ export declare const starciBeConfig: ({ hfs }: {
51
+ hfs?: HfsView | null | undefined;
52
+ }) => Promise<TSESLint.FlatConfig.ConfigArray>;
53
+ export { linterOptions } from "./lib/config.js";
54
+ export { loadHfs } from "./lib/hfs.js";
@@ -16,60 +16,59 @@
16
16
  * every conversation about the failure. Aliasing one here to match a target's older spelling would
17
17
  * leave two names for one rule and no way to tell which a message came from.
18
18
  */
19
- import { buildBeConfig } from "./lib/config.mjs"
20
- import { pluginForEdition } from "./lib/edition.mjs"
21
- import { recommended as ambientIdRecommended, rules as ambientIdRules } from "./ambient-id.mjs"
22
- import { recommended as appCompositionRecommended, rules as appCompositionRules } from "./app-composition.mjs"
23
- import { recommended as asyncDisciplineRecommended, rules as asyncDisciplineRules } from "./async-discipline.mjs"
24
- import { recommended as authorizationRecommended, rules as authorizationRules } from "./authorization.mjs"
25
- import { recommended as buildersRecommended, rules as buildersRules } from "./builders.mjs"
26
- import { recommended as commentsRecommended, rules as commentsRules } from "./comments.mjs"
27
- import { recommended as configOwnerRecommended, rules as configOwnerRules } from "./config-owner.mjs"
28
- import { recommended as connectionsRecommended, rules as connectionsRules } from "./connections.mjs"
29
- import { recommended as cookiesRecommended, rules as cookiesRules } from "./cookies.mjs"
30
- import { recommended as cqrsRecommended, rules as cqrsRules } from "./cqrs.mjs"
31
- import { recommended as dataAccessRecommended, rules as dataAccessRules } from "./data-access.mjs"
32
- import { recommended as defaultDenyRecommended, rules as defaultDenyRules } from "./default-deny.mjs"
33
- import { recommended as eventBusRecommended, rules as eventBusRules } from "./event-bus.mjs"
34
- import { recommended as jobsRecommended, rules as jobsRules } from "./jobs.mjs"
35
- import { recommended as projectionsRecommended, rules as projectionsRules } from "./projections.mjs"
36
- import { recommended as e2eFlowRecommended, rules as e2eFlowRules } from "./e2e-flow.mjs"
37
- import { recommended as errorHandlingRecommended, rules as errorHandlingRules } from "./error-handling.mjs"
38
- import { recommended as idempotencyRecommended, rules as idempotencyRules } from "./idempotency.mjs"
39
- import { recommended as infraOwnerRecommended, rules as infraOwnerRules } from "./infra-owner.mjs"
40
- import { recommended as injectionRecommended, rules as injectionRules } from "./injection.mjs"
41
- import { recommended as boundarySchemaRecommended, rules as boundarySchemaRules } from "./boundary-schema.mjs"
42
- import { recommended as inputBoundsRecommended, rules as inputBoundsRules } from "./input-bounds.mjs"
43
- import { recommended as logSafetyRecommended, rules as logSafetyRules } from "./log-safety.mjs"
44
- import { recommended as moduleLayeringRecommended, rules as moduleLayeringRules } from "./module-layering.mjs"
45
- import { recommended as moduleShapeRecommended, rules as moduleShapeRules } from "./module-shape.mjs"
46
- import { recommended as namingRecommended, rules as namingRules } from "./naming.mjs"
47
- import { recommended as observabilityRecommended, rules as observabilityRules } from "./observability.mjs"
48
- import { recommended as operationsRecommended, rules as operationsRules } from "./operations.mjs"
49
- import { recommended as querySafetyRecommended, rules as querySafetyRules } from "./query-safety.mjs"
50
- import { recommended as resilienceRecommended, rules as resilienceRules } from "./resilience.mjs"
51
- import { recommended as schemaAuthorityRecommended, rules as schemaAuthorityRules } from "./schema-authority.mjs"
52
- import { recommended as cliRecommended, rules as cliRules } from "./cli.mjs"
53
- import { recommended as serviceDepsRecommended, rules as serviceDepsRules } from "./service-deps.mjs"
54
- import { recommended as serviceIsolationRecommended, rules as serviceIsolationRules } from "./service-isolation.mjs"
55
- import { recommended as sizeBudgetRecommended, rules as sizeBudgetRules } from "./size-budget.mjs"
56
- import { recommended as specNoSkipRecommended, rules as specNoSkipRules } from "./spec-no-skip.mjs"
57
- import { recommended as specQualityRecommended, rules as specQualityRules } from "./spec-quality.mjs"
58
- import { recommended as suppressionRecommended, rules as suppressionRules } from "./suppression.mjs"
59
- import { recommended as temporalRecommended, rules as temporalRules } from "./temporal.mjs"
60
- import { recommended as testingRecommended, rules as testingRules } from "./testing.mjs"
61
- import { recommended as testWorldRecommended, rules as testWorldRules } from "./test-world.mjs"
62
- import { recommended as transportRecommended, rules as transportRules } from "./transport.mjs"
63
- import { recommended as typeSafetyRecommended, rules as typeSafetyRules } from "./type-safety.mjs"
64
- import { recommended as unitSpecRecommended, rules as unitSpecRules } from "./unit-spec.mjs"
65
- import { recommended as uploadsRecommended, rules as uploadsRules } from "./uploads.mjs"
66
- import { recommended as userCopyRecommended, rules as userCopyRules } from "./user-copy.mjs"
67
- import { recommended as webhooksRecommended, rules as webhooksRules } from "./webhooks.mjs"
68
- import { recommended as realtimeRecommended, rules as realtimeRules } from "./realtime.mjs"
69
- import { recommended as featureThinRecommended, rules as featureThinRules } from "./feature-thin.mjs"
70
- import { recommended as projectGraphRecommended, rules as projectGraphRules } from "./project-graph.mjs"
71
- import { recommended as sonarParityRecommended, rules as sonarParityRules } from "./sonar-parity.mjs"
72
-
19
+ import { buildBeConfig } from "./lib/config.js";
20
+ import { pluginForEdition } from "./lib/edition.js";
21
+ import { recommended as ambientIdRecommended, rules as ambientIdRules } from "./ambient-id.js";
22
+ import { recommended as appCompositionRecommended, rules as appCompositionRules } from "./app-composition.js";
23
+ import { recommended as asyncDisciplineRecommended, rules as asyncDisciplineRules } from "./async-discipline.js";
24
+ import { recommended as authorizationRecommended, rules as authorizationRules } from "./authorization.js";
25
+ import { recommended as buildersRecommended, rules as buildersRules } from "./builders.js";
26
+ import { recommended as commentsRecommended, rules as commentsRules } from "./comments.js";
27
+ import { recommended as configOwnerRecommended, rules as configOwnerRules } from "./config-owner.js";
28
+ import { recommended as connectionsRecommended, rules as connectionsRules } from "./connections.js";
29
+ import { recommended as cookiesRecommended, rules as cookiesRules } from "./cookies.js";
30
+ import { recommended as cqrsRecommended, rules as cqrsRules } from "./cqrs.js";
31
+ import { recommended as dataAccessRecommended, rules as dataAccessRules } from "./data-access.js";
32
+ import { recommended as defaultDenyRecommended, rules as defaultDenyRules } from "./default-deny.js";
33
+ import { recommended as eventBusRecommended, rules as eventBusRules } from "./event-bus.js";
34
+ import { recommended as jobsRecommended, rules as jobsRules } from "./jobs.js";
35
+ import { recommended as projectionsRecommended, rules as projectionsRules } from "./projections.js";
36
+ import { recommended as e2eFlowRecommended, rules as e2eFlowRules } from "./e2e-flow.js";
37
+ import { recommended as errorHandlingRecommended, rules as errorHandlingRules } from "./error-handling.js";
38
+ import { recommended as idempotencyRecommended, rules as idempotencyRules } from "./idempotency.js";
39
+ import { recommended as infraOwnerRecommended, rules as infraOwnerRules } from "./infra-owner.js";
40
+ import { recommended as injectionRecommended, rules as injectionRules } from "./injection.js";
41
+ import { recommended as boundarySchemaRecommended, rules as boundarySchemaRules } from "./boundary-schema.js";
42
+ import { recommended as inputBoundsRecommended, rules as inputBoundsRules } from "./input-bounds.js";
43
+ import { recommended as logSafetyRecommended, rules as logSafetyRules } from "./log-safety.js";
44
+ import { recommended as moduleLayeringRecommended, rules as moduleLayeringRules } from "./module-layering.js";
45
+ import { recommended as moduleShapeRecommended, rules as moduleShapeRules } from "./module-shape.js";
46
+ import { recommended as namingRecommended, rules as namingRules } from "./naming.js";
47
+ import { recommended as observabilityRecommended, rules as observabilityRules } from "./observability.js";
48
+ import { recommended as operationsRecommended, rules as operationsRules } from "./operations.js";
49
+ import { recommended as querySafetyRecommended, rules as querySafetyRules } from "./query-safety.js";
50
+ import { recommended as resilienceRecommended, rules as resilienceRules } from "./resilience.js";
51
+ import { recommended as schemaAuthorityRecommended, rules as schemaAuthorityRules } from "./schema-authority.js";
52
+ import { recommended as cliRecommended, rules as cliRules } from "./cli.js";
53
+ import { recommended as serviceDepsRecommended, rules as serviceDepsRules } from "./service-deps.js";
54
+ import { recommended as serviceIsolationRecommended, rules as serviceIsolationRules } from "./service-isolation.js";
55
+ import { recommended as sizeBudgetRecommended, rules as sizeBudgetRules } from "./size-budget.js";
56
+ import { recommended as specNoSkipRecommended, rules as specNoSkipRules } from "./spec-no-skip.js";
57
+ import { recommended as specQualityRecommended, rules as specQualityRules } from "./spec-quality.js";
58
+ import { recommended as suppressionRecommended, rules as suppressionRules } from "./suppression.js";
59
+ import { recommended as temporalRecommended, rules as temporalRules } from "./temporal.js";
60
+ import { recommended as testingRecommended, rules as testingRules } from "./testing.js";
61
+ import { recommended as testWorldRecommended, rules as testWorldRules } from "./test-world.js";
62
+ import { recommended as transportRecommended, rules as transportRules } from "./transport.js";
63
+ import { recommended as typeSafetyRecommended, rules as typeSafetyRules } from "./type-safety.js";
64
+ import { recommended as unitSpecRecommended, rules as unitSpecRules } from "./unit-spec.js";
65
+ import { recommended as uploadsRecommended, rules as uploadsRules } from "./uploads.js";
66
+ import { recommended as userCopyRecommended, rules as userCopyRules } from "./user-copy.js";
67
+ import { recommended as webhooksRecommended, rules as webhooksRules } from "./webhooks.js";
68
+ import { recommended as realtimeRecommended, rules as realtimeRules } from "./realtime.js";
69
+ import { recommended as featureThinRecommended, rules as featureThinRules } from "./feature-thin.js";
70
+ import { recommended as projectGraphRecommended, rules as projectGraphRules } from "./project-graph.js";
71
+ import { recommended as sonarParityRecommended, rules as sonarParityRules } from "./sonar-parity.js";
73
72
  /** Each law's contribution, kept separate so a duplicate name is detectable rather than silent. */
74
73
  const CONTRIBUTIONS = [
75
74
  { law: "project-graph", rules: projectGraphRules, recommended: projectGraphRecommended },
@@ -123,11 +122,9 @@ const CONTRIBUTIONS = [
123
122
  { law: "realtime", rules: realtimeRules, recommended: realtimeRecommended },
124
123
  { law: "feature-thin", rules: featureThinRules, recommended: featureThinRecommended },
125
124
  { law: "sonar-parity", rules: sonarParityRules, recommended: sonarParityRecommended },
126
- ]
127
-
125
+ ];
128
126
  /** Every gathered law. */
129
- export const lawOwners = CONTRIBUTIONS.map((entry) => entry.law)
130
-
127
+ export const lawOwners = CONTRIBUTIONS.map((entry) => entry.law);
131
128
  /**
132
129
  * Every (law, rule name) pair as DECLARED, before any collapsing.
133
130
  *
@@ -141,10 +138,7 @@ export const lawOwners = CONTRIBUTIONS.map((entry) => entry.law)
141
138
  * indistinguishable from no gate, so the raw declarations are published here and the guard walks
142
139
  * these instead.
143
140
  */
144
- export const ruleDeclarations = CONTRIBUTIONS.flatMap((entry) =>
145
- Object.keys(entry.rules).map((name) => ({ law: entry.law, name })),
146
- )
147
-
141
+ export const ruleDeclarations = CONTRIBUTIONS.flatMap((entry) => Object.keys(entry.rules).map((name) => ({ law: entry.law, name })));
148
142
  /**
149
143
  * Which law declares each rule.
150
144
  *
@@ -152,75 +146,63 @@ export const ruleDeclarations = CONTRIBUTIONS.flatMap((entry) =>
152
146
  * to the document that explains it is this map. It answers "who owns this name" for a name that
153
147
  * SHIPPED; proving no two laws claim one name is `ruleDeclarations`' job, not this map's.
154
148
  */
155
- export const ruleOwners = Object.fromEntries(
156
- CONTRIBUTIONS.flatMap((entry) => Object.keys(entry.rules).map((name) => [name, entry.law])),
157
- )
158
-
149
+ export const ruleOwners = Object.fromEntries(CONTRIBUTIONS.flatMap((entry) => Object.keys(entry.rules).map((name) => [name, entry.law])));
159
150
  /** Every rule this canon publishes, keyed by its published name. */
160
- export const rules = Object.fromEntries(
161
- CONTRIBUTIONS.flatMap((entry) => Object.entries(entry.rules)),
162
- )
163
-
151
+ export const rules = Object.fromEntries(CONTRIBUTIONS.flatMap((entry) => Object.entries(entry.rules)));
164
152
  /**
165
153
  * The levels this canon asks for: every rule at `error`. There is no `warn` and no burn-down level; a rule with
166
154
  * debt is fixed in the repositories before it ships, never published weaker.
167
155
  */
168
- export const recommended = Object.fromEntries(
169
- CONTRIBUTIONS.flatMap((entry) => Object.entries(entry.recommended)),
170
- )
171
-
156
+ export const recommended = Object.fromEntries(CONTRIBUTIONS.flatMap((entry) => Object.entries(entry.recommended)));
172
157
  /** The plugin object, shaped the way a flat config expects it. */
173
158
  const plugin = {
174
159
  meta: { name: "eslint-plugin-starci-be" },
175
160
  rules,
176
- }
177
-
178
- export default plugin
179
-
161
+ };
162
+ export default plugin;
180
163
  /**
181
164
  * The whole flat config of a back end: `export default starciBeConfig({ hfs: loadHfs(import.meta.url) })`.
182
165
  *
183
- * @param {{ hfs: object }} input - The HFS view of the repository.
184
- * @returns {Promise<Array<object>>} The flat config.
166
+ * @param input - The HFS view of the repository.
167
+ * @returns The flat config.
185
168
  */
186
- export const starciBeConfig = ({ hfs }) => buildBeConfig({ hfs, plugin: pluginForEdition({ plugin, hfs }), recommended })
187
-
188
- export { linterOptions } from "./lib/config.mjs"
189
- export { loadHfs } from "./lib/hfs.mjs"
190
-
169
+ export const starciBeConfig = ({ hfs }) => buildBeConfig({ hfs, plugin: pluginForEdition({ plugin, hfs }), recommended });
170
+ export { linterOptions } from "./lib/config.js";
171
+ export { loadHfs } from "./lib/hfs.js";
191
172
  // A12 registration is appended so the shared registry can be union-merged.
192
- import { recommended as thirdPartyOwnerRecommended, rules as thirdPartyOwnerRules } from "./third-party-owner.mjs"
193
- Object.assign(rules, thirdPartyOwnerRules)
194
- Object.assign(recommended, thirdPartyOwnerRecommended)
195
- lawOwners.push("third-party-owner")
173
+ import { recommended as thirdPartyOwnerRecommended, rules as thirdPartyOwnerRules } from "./third-party-owner.js";
174
+ Object.assign(rules, thirdPartyOwnerRules);
175
+ Object.assign(recommended, thirdPartyOwnerRecommended);
176
+ lawOwners.push("third-party-owner");
196
177
  for (const name of Object.keys(thirdPartyOwnerRules)) {
197
- ruleOwners[name] = "third-party-owner"
178
+ ruleOwners[name] = "third-party-owner";
198
179
  // infra-owner also exposes these rules so the catalog's static contribution reader sees them.
199
- const declaration = ruleDeclarations.find((entry) => entry.name === name)
200
- if (declaration) declaration.law = "third-party-owner"
201
- else ruleDeclarations.push({ law: "third-party-owner", name })
180
+ const declaration = ruleDeclarations.find((entry) => entry.name === name);
181
+ if (declaration)
182
+ declaration.law = "third-party-owner";
183
+ else
184
+ ruleDeclarations.push({ law: "third-party-owner", name });
202
185
  }
203
186
  // A21 append-only registration: keep the already exported plugin and recommendation live.
204
- import { recommended as functionBudgetRecommended, rules as functionBudgetRules } from "./function-budget.mjs"
205
- CONTRIBUTIONS.push({ law: "function-budget", rules: functionBudgetRules, recommended: functionBudgetRecommended })
206
- lawOwners.push("function-budget")
207
- ruleDeclarations.push(...Object.keys(functionBudgetRules).map((name) => ({ law: "function-budget", name })))
208
- Object.assign(ruleOwners, Object.fromEntries(Object.keys(functionBudgetRules).map((name) => [name, "function-budget"])))
209
- Object.assign(rules, functionBudgetRules)
210
- Object.assign(recommended, functionBudgetRecommended)
187
+ import { recommended as functionBudgetRecommended, rules as functionBudgetRules } from "./function-budget.js";
188
+ CONTRIBUTIONS.push({ law: "function-budget", rules: functionBudgetRules, recommended: functionBudgetRecommended });
189
+ lawOwners.push("function-budget");
190
+ ruleDeclarations.push(...Object.keys(functionBudgetRules).map((name) => ({ law: "function-budget", name })));
191
+ Object.assign(ruleOwners, Object.fromEntries(Object.keys(functionBudgetRules).map((name) => [name, "function-budget"])));
192
+ Object.assign(rules, functionBudgetRules);
193
+ Object.assign(recommended, functionBudgetRecommended);
211
194
  // A06 registrations are appended: the coordinator union-merges this shared registry.
212
- import { recommended as edgeHardeningRecommended, rules as edgeHardeningRules } from "./edge-hardening.mjs"
213
- import { recommended as healthReadyRecommended, rules as healthReadyRules } from "./health-ready.mjs"
214
- import { recommended as jwtAlgRecommended, rules as jwtAlgRules } from "./jwt-alg.mjs"
215
-
195
+ import { recommended as edgeHardeningRecommended, rules as edgeHardeningRules } from "./edge-hardening.js";
196
+ import { recommended as healthReadyRecommended, rules as healthReadyRules } from "./health-ready.js";
197
+ import { recommended as jwtAlgRecommended, rules as jwtAlgRules } from "./jwt-alg.js";
216
198
  for (const entry of [
217
199
  { law: "edge-hardening", rules: edgeHardeningRules, recommended: edgeHardeningRecommended },
218
200
  { law: "health-ready", rules: healthReadyRules, recommended: healthReadyRecommended },
219
201
  { law: "jwt-alg", rules: jwtAlgRules, recommended: jwtAlgRecommended },
220
202
  ]) {
221
- lawOwners.push(entry.law)
222
- ruleDeclarations.push(...Object.keys(entry.rules).map((name) => ({ law: entry.law, name })))
223
- Object.assign(ruleOwners, Object.fromEntries(Object.keys(entry.rules).map((name) => [name, entry.law])))
224
- Object.assign(rules, entry.rules)
225
- Object.assign(recommended, entry.recommended)
203
+ lawOwners.push(entry.law);
204
+ ruleDeclarations.push(...Object.keys(entry.rules).map((name) => ({ law: entry.law, name })));
205
+ Object.assign(ruleOwners, Object.fromEntries(Object.keys(entry.rules).map((name) => [name, entry.law])));
206
+ Object.assign(rules, entry.rules);
207
+ Object.assign(recommended, entry.recommended);
226
208
  }
@@ -0,0 +1,18 @@
1
+ import type { Recommended, RuleModule } from "./lib/rule.js";
2
+ /** A raw infrastructure library is used only inside the capability that owns it. */
3
+ export declare const infraImportOwner: RuleModule;
4
+ /**
5
+ * A provider is spoken to only by its integration (BE-INFRA-3): a call on the `HttpClient` port is made only in an
6
+ * `integrations` owner, in `platform/http` itself and in the test world. A domain service, a feature or another platform
7
+ * capability that calls an identity provider's token or admin endpoint, a mailer API or any other remote over HTTP holds a
8
+ * second copy of that provider's protocol, credentials and failure mapping; it calls the integration's public API instead.
9
+ */
10
+ export declare const httpClientOnlyInIntegrations: RuleModule;
11
+ /** The rules this law contributes to the plugin. */
12
+ export declare const rules: {
13
+ "third-party-import-owner": RuleModule;
14
+ "infra-import-owner": RuleModule;
15
+ "http-client-only-in-integrations": RuleModule;
16
+ };
17
+ /** Every rule of this law at `error`. */
18
+ export declare const recommended: Recommended;
@@ -24,29 +24,27 @@
24
24
  * by the receiver's TYPE) is called only in an `integrations` owner, `platform/http` itself and the test world, so an
25
25
  * identity provider's token or admin endpoint, a mailer API or any other remote is spoken to by one integration only.
26
26
  */
27
- import { hfsOf, inTestWorld } from "./lib/hfs.mjs"
28
- import { moduleReferences } from "./lib/import-source.mjs"
29
- import { isOwnedType } from "./lib/ports.mjs"
30
- import { recommended as thirdPartyRecommended, rules as thirdPartyRules } from "./third-party-owner.mjs"
31
-
27
+ import { hfsOf, inTestWorld } from "./lib/hfs.js";
28
+ import { moduleReferences } from "./lib/import-source.js";
29
+ import { isOwnedType } from "./lib/ports.js";
30
+ import { recommended as thirdPartyRecommended, rules as thirdPartyRules } from "./third-party-owner.js";
32
31
  /** The owner id of a file: the last two segments of its owner root (`platform/http`), or null when no owner holds it. */
33
32
  const ownerIdOf = (hfs, filename) => {
34
- const root = hfs.ownerOf(filename)
35
- return root === null ? null : root.split("/").slice(-2).join("/")
36
- }
37
-
33
+ const root = hfs.ownerOf(filename);
34
+ return root === null ? null : root.split("/").slice(-2).join("/");
35
+ };
38
36
  /** The table key a module specifier falls under (the specifier itself or a subpath of it, with or without `node:`), or null. */
39
37
  const keyOf = (table, specifier) => {
40
- const variants = [specifier, specifier.startsWith("node:") ? specifier.slice(5) : `node:${specifier}`]
41
- let best = null
38
+ const variants = [specifier, specifier.startsWith("node:") ? specifier.slice(5) : `node:${specifier}`];
39
+ let best = null;
42
40
  for (const variant of variants) {
43
41
  for (const key of Object.keys(table)) {
44
- if ((variant === key || variant.startsWith(`${key}/`)) && (best === null || key.length > best.length)) best = key
42
+ if ((variant === key || variant.startsWith(`${key}/`)) && (best === null || key.length > best.length))
43
+ best = key;
45
44
  }
46
45
  }
47
- return best
48
- }
49
-
46
+ return best;
47
+ };
50
48
  /** A raw infrastructure library is used only inside the capability that owns it. */
51
49
  export const infraImportOwner = {
52
50
  meta: {
@@ -59,42 +57,51 @@ export const infraImportOwner = {
59
57
  },
60
58
  },
61
59
  create(context) {
62
- const hfs = hfsOf(context)
63
- const table = hfs.ruleParams.infraOwners
64
- const here = ownerIdOf(hfs, context.filename)
65
- const isWorld = inTestWorld(hfs, context.filename)
60
+ const hfs = hfsOf(context);
61
+ const table = hfs.ruleParams.infraOwners;
62
+ const here = ownerIdOf(hfs, context.filename);
63
+ const isWorld = inTestWorld(hfs, context.filename);
66
64
  const check = (node, name, key) => {
67
- const owners = table[key]
68
- if (owners.includes(here) || (isWorld && owners.length > 0 && !owners.includes("platform/logging"))) return
69
- if (owners.length === 0) context.report({ node, messageId: "nowhere", data: { name } })
70
- else context.report({ node, messageId: "foreign", data: { name, owners: owners.map((owner) => `\`${owner}\``).join(", ") } })
71
- }
65
+ const owners = table[key];
66
+ if (!owners)
67
+ return;
68
+ if ((here !== null && owners.includes(here)) || (isWorld && owners.length > 0 && !owners.includes("platform/logging")))
69
+ return;
70
+ if (owners.length === 0)
71
+ context.report({ node, messageId: "nowhere", data: { name } });
72
+ else
73
+ context.report({ node, messageId: "foreign", data: { name, owners: owners.map((owner) => `\`${owner}\``).join(", ") } });
74
+ };
72
75
  return {
73
76
  ...moduleReferences(({ source, value }) => {
74
- const key = keyOf(table, value)
75
- if (key !== null) check(source, value, key)
77
+ const key = keyOf(table, value);
78
+ if (key !== null)
79
+ check(source, value, key);
76
80
  }),
77
81
  MemberExpression(node) {
78
- if (node.computed || node.object.type !== "Identifier" || node.object.name !== "globalThis" || node.property.type !== "Identifier") return
79
- if (Object.hasOwn(table, node.property.name)) check(node, `globalThis.${node.property.name}`, node.property.name)
82
+ if (node.computed || node.object.type !== "Identifier" || node.object.name !== "globalThis" || node.property.type !== "Identifier")
83
+ return;
84
+ if (Object.hasOwn(table, node.property.name))
85
+ check(node, `globalThis.${node.property.name}`, node.property.name);
80
86
  },
81
87
  "Program:exit"() {
82
- const globalScope = context.sourceCode.scopeManager.globalScope
83
- if (!globalScope) return
84
- const references = [...globalScope.through, ...globalScope.variables.filter((variable) => variable.defs.length === 0).flatMap((variable) => variable.references)]
88
+ const globalScope = context.sourceCode.scopeManager?.globalScope;
89
+ if (!globalScope)
90
+ return;
91
+ const references = [...globalScope.through, ...globalScope.variables.filter((variable) => variable.defs.length === 0).flatMap((variable) => variable.references)];
85
92
  for (const reference of references) {
86
- if (reference.isValueReference === false) continue
87
- const name = reference.identifier.name
88
- if (Object.hasOwn(table, name)) check(reference.identifier, name, name)
93
+ if (reference.isValueReference === false)
94
+ continue;
95
+ const name = reference.identifier.name;
96
+ if (Object.hasOwn(table, name))
97
+ check(reference.identifier, name, name);
89
98
  }
90
99
  },
91
- }
100
+ };
92
101
  },
93
- }
94
-
102
+ };
95
103
  /** The `HttpClient` port of `platform/http`: the one outbound HTTP door, judged by the receiver's TYPE. */
96
- const isHttpClient = (context, node) => isOwnedType(context, node, { name: "HttpClient", capability: "http", tier: "platform" })
97
-
104
+ const isHttpClient = (context, node) => isOwnedType(context, node, { name: "HttpClient", capability: "http", tier: "platform" });
98
105
  /**
99
106
  * A provider is spoken to only by its integration (BE-INFRA-3): a call on the `HttpClient` port is made only in an
100
107
  * `integrations` owner, in `platform/http` itself and in the test world. A domain service, a feature or another platform
@@ -111,29 +118,29 @@ export const httpClientOnlyInIntegrations = {
111
118
  },
112
119
  },
113
120
  create(context) {
114
- const hfs = hfsOf(context)
115
- const file = context.filename
116
- if (hfs.tierOf(file) === "integrations" || ownerIdOf(hfs, file) === "platform/http" || inTestWorld(hfs, file)) return {}
121
+ const hfs = hfsOf(context);
122
+ const file = context.filename;
123
+ if (hfs.tierOf(file) === "integrations" || ownerIdOf(hfs, file) === "platform/http" || inTestWorld(hfs, file))
124
+ return {};
117
125
  return {
118
126
  CallExpression(node) {
119
- const callee = node.callee
120
- if (callee.type !== "MemberExpression" || !isHttpClient(context, callee.object)) return
121
- context.report({ node, messageId: "foreign", data: { call: context.sourceCode.getText(callee) } })
127
+ const callee = node.callee;
128
+ if (callee.type !== "MemberExpression" || !isHttpClient(context, callee.object))
129
+ return;
130
+ context.report({ node, messageId: "foreign", data: { call: context.sourceCode.getText(callee) } });
122
131
  },
123
- }
132
+ };
124
133
  },
125
- }
126
-
134
+ };
127
135
  /** The rules this law contributes to the plugin. */
128
136
  export const rules = {
129
137
  "infra-import-owner": infraImportOwner,
130
138
  "http-client-only-in-integrations": httpClientOnlyInIntegrations,
131
139
  ...thirdPartyRules,
132
- }
133
-
140
+ };
134
141
  /** Every rule of this law at `error`. */
135
142
  export const recommended = {
136
143
  "starci-be/infra-import-owner": "error",
137
144
  "starci-be/http-client-only-in-integrations": "error",
138
145
  ...thirdPartyRecommended,
139
- }
146
+ };
@@ -0,0 +1,30 @@
1
+ import { type Recommended, type RuleModule } from "./lib/rule.js";
2
+ /** Raw injection lives only in `<owner>.decorators.ts`; injectors decorate constructor parameters. */
3
+ export declare const injectorOnly: RuleModule;
4
+ /** The shape of an injector, its token and the `provide:` tokens of a module. */
5
+ export declare const injectorShape: RuleModule;
6
+ /** `T` of the injector equals the parameter annotation. */
7
+ export declare const injectorTypeMatch: RuleModule;
8
+ /** A constructor parameter of an infrastructure type carries an injector. */
9
+ export declare const infraNeedsInjector: RuleModule;
10
+ /** An injected port of the table of `paramNames` is named the way every class names it. */
11
+ export declare const injectedParamName: RuleModule;
12
+ /** No service locator: `ModuleRef` is not imported, typed or called. */
13
+ export declare const noModuleRef: RuleModule;
14
+ /** No `forwardRef(`: a cycle is a layering finding, not a DI trick. */
15
+ export declare const noForwardRef: RuleModule;
16
+ /** A token is a class or a `unique symbol`, never a string. */
17
+ export declare const noStringToken: RuleModule;
18
+ /** The rules this law contributes to the plugin. */
19
+ export declare const rules: {
20
+ "injector-only": RuleModule;
21
+ "injector-shape": RuleModule;
22
+ "injector-type-match": RuleModule;
23
+ "infra-needs-injector": RuleModule;
24
+ "injected-param-name": RuleModule;
25
+ "no-module-ref": RuleModule;
26
+ "no-forward-ref": RuleModule;
27
+ "no-string-token": RuleModule;
28
+ };
29
+ /** All start at error: there is one way to inject and no baseline. */
30
+ export declare const recommended: Recommended;