@starci/eslint-canon-be 3.5.0 → 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 (195) hide show
  1. package/CHANGELOG.md +15 -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 +17 -10
  177. package/async-discipline.mjs +0 -83
  178. package/comments.mjs +0 -416
  179. package/edge-hardening.mjs +0 -139
  180. package/health-ready.mjs +0 -539
  181. package/jwt-alg.mjs +0 -45
  182. package/lib/ast.mjs +0 -88
  183. package/lib/import-source.mjs +0 -104
  184. package/lib/specifier.mjs +0 -27
  185. package/lib/subject-values.mjs +0 -55
  186. package/lib/types.mjs +0 -133
  187. package/log-safety.mjs +0 -303
  188. package/module-layering.mjs +0 -270
  189. package/naming.mjs +0 -251
  190. package/observability.mjs +0 -241
  191. package/resilience.mjs +0 -304
  192. package/service-isolation.mjs +0 -75
  193. package/spec-no-skip.mjs +0 -85
  194. package/testing.mjs +0 -384
  195. package/type-safety.mjs +0 -323
package/type-safety.mjs DELETED
@@ -1,323 +0,0 @@
1
- /**
2
- * The rules that hold the type-safety law (catalog R72 `BE_TYPE_ESCAPE` and the type-shape rows).
3
- *
4
- * WHAT THE FACTORY BORROWS, SO THIS FILE DOES NOT REIMPLEMENT IT. `starciBeConfig` turns on, at `error`, in every file
5
- * of the repository and with no lane of exemption (a spec, a fixture and an e2e setup file get the same law):
6
- * `@typescript-eslint/consistent-type-assertions` with `assertionStyle: "never"` (no `x as T`, no `<T>x`, hence no
7
- * `as never`, no `as unknown as T`, no cast out of an `unknown` value; only `as const` stays),
8
- * `@typescript-eslint/no-non-null-assertion` (no `x!`) and `@typescript-eslint/no-explicit-any`. One obligation, one
9
- * rule: this canon writes no second copy of any of them, so the four house rules that once restated them
10
- * (`no-never-cast`, `no-non-null-assertion`, `no-double-cast`, `no-unguarded-unknown-cast`) are deleted.
11
- *
12
- * What is house-written is what the borrowed set does not cover: `Function` as a type and `eval` (R72), the inline
13
- * parameter type and the inline object type in every other position (TYPE-3), the const enum (TYPE-4) and the
14
- * handler return type (R75).
15
- *
16
- * TYPE-5 (the boolean-flag product) is NOT among them, and that absence was tested rather than assumed: a rule was
17
- * written, measured against the reference backend and withdrawn because both of its real firings were wrong. It stays
18
- * a reader's job, exactly as the law's own `Layer held` table says.
19
- */
20
-
21
- /** A parameter property (`private readonly x: T`) wraps the parameter it declares. */
22
- const unwrapParam = (param) => (param.type === "TSParameterProperty" ? param.parameter : param)
23
-
24
- // -- TYPE-3 ----------------------------------------------------------------------------------------
25
-
26
- /** A destructured parameter's type is named, so a second caller can reference it. */
27
- export const noInlineParamType = {
28
- meta: {
29
- type: "problem",
30
- docs: { description: "A destructured parameter takes a named type, not an inline literal." },
31
- schema: [],
32
- messages: {
33
- inline:
34
- "An inline object type on a destructured parameter cannot be referenced, imported or extended - so the second caller writes it again, and when a third field arrives only one of the two copies gets it. Move it to a named interface in the module's `types/`.",
35
- },
36
- },
37
- create(context) {
38
- const check = (params) => {
39
- for (const raw of params || []) {
40
- const param = unwrapParam(raw)
41
- if (param.type !== "ObjectPattern" || !param.typeAnnotation) continue
42
- const annotation = param.typeAnnotation.typeAnnotation
43
- if (annotation && annotation.type === "TSTypeLiteral") {
44
- context.report({ node: param.typeAnnotation, messageId: "inline" })
45
- }
46
- }
47
- }
48
- return {
49
- FunctionDeclaration(node) {
50
- check(node.params)
51
- },
52
- FunctionExpression(node) {
53
- check(node.params)
54
- },
55
- ArrowFunctionExpression(node) {
56
- check(node.params)
57
- },
58
- }
59
- },
60
- }
61
-
62
- // -- TYPE-3, extended (law 4) ------------------------------------------------------------------------
63
-
64
- /**
65
- * `no-inline-param-type` holds only the destructured-parameter half of law 4: "a destructured
66
- * parameter's type has a name and a home a second caller can import from." The same sentence, read
67
- * without the word "destructured", covers every inline object type -- a positional parameter, a
68
- * property signature, a function return, a variable -- because the failure is identical in all four:
69
- * the shape cannot be referenced, imported or extended, so a second site retypes it and the two
70
- * copies drift apart in silence.
71
- *
72
- * Three things are deliberately left alone, and each is a different reason:
73
- *
74
- * - An EMPTY `{}` means "no properties", not "an unnamed shape". That is a different smell (the
75
- * fix is a stricter type, not a name) and this rule does not touch it.
76
- * - A type literal inside a `declare module` / module augmentation describes a vendor's own shape.
77
- * It cannot be pulled into a named type this repository owns without the two drifting the moment
78
- * the vendor changes theirs, so the ambient lane is out of scope.
79
- * - A type literal that is already the right-hand side of a named type alias (`type Foo = { ... }`)
80
- * IS the fix this rule asks for. Flagging it would make the rule unsatisfiable -- there would be no
81
- * way to hold an object type by name that this rule accepted. A type literal declared elsewhere is
82
- * still checked in the ordinary way; only the exact node a type alias names is exempt.
83
- */
84
-
85
- /** A type literal with no members means "no properties" -- a different smell with a different fix. */
86
- const isEmptyTypeLiteral = (typeLiteral) => !typeLiteral.members || typeLiteral.members.length === 0
87
-
88
- /** A vendor's own declaration lives in a `declare module` / module augmentation and cannot be named separately. */
89
- const isInsideAmbientModule = (node) => {
90
- let current = node.parent
91
- while (current) {
92
- if (current.type === "TSModuleDeclaration" && current.declare) return true
93
- current = current.parent
94
- }
95
- return false
96
- }
97
-
98
- /** The non-empty inline object type at `typeAnnotation.typeAnnotation`, or null if this is out of scope. */
99
- const inlineObjectTypeOf = (typeAnnotation, scopeNode) => {
100
- if (!typeAnnotation) return null
101
- const literal = typeAnnotation.typeAnnotation
102
- if (!literal || literal.type !== "TSTypeLiteral") return null
103
- if (isEmptyTypeLiteral(literal)) return null
104
- if (isInsideAmbientModule(scopeNode)) return null
105
- return literal
106
- }
107
-
108
- export const noInlineObjectType = {
109
- meta: {
110
- type: "problem",
111
- docs: {
112
- description:
113
- "A TypeScript object type written inline takes a named type instead, in every position (TYPE-3, law 4).",
114
- },
115
- schema: [],
116
- messages: {
117
- inlineObjectType:
118
- "This inline object type ({{position}}) cannot be referenced, imported or extended, so a second site retypes it and the two copies drift apart in silence the moment a third field arrives on only one of them. Give it a name in the module's `types/` and reference that name here instead.",
119
- },
120
- },
121
- create(context) {
122
- const reportLiteral = (node, position) => {
123
- context.report({ node, messageId: "inlineObjectType", data: { position } })
124
- }
125
-
126
- const checkParams = (fnNode) => {
127
- for (const raw of fnNode.params || []) {
128
- const param = unwrapParam(raw)
129
- if (inlineObjectTypeOf(param.typeAnnotation, param)) {
130
- reportLiteral(param.typeAnnotation, "parameter")
131
- }
132
- }
133
- }
134
-
135
- const checkReturnType = (fnNode) => {
136
- if (inlineObjectTypeOf(fnNode.returnType, fnNode)) {
137
- reportLiteral(fnNode.returnType, "return type")
138
- }
139
- }
140
-
141
- return {
142
- FunctionDeclaration(node) {
143
- checkParams(node)
144
- checkReturnType(node)
145
- },
146
- FunctionExpression(node) {
147
- checkParams(node)
148
- checkReturnType(node)
149
- },
150
- ArrowFunctionExpression(node) {
151
- checkParams(node)
152
- checkReturnType(node)
153
- },
154
- TSPropertySignature(node) {
155
- if (inlineObjectTypeOf(node.typeAnnotation, node)) {
156
- reportLiteral(node.typeAnnotation, "property signature")
157
- }
158
- },
159
- VariableDeclarator(node) {
160
- if (node.id.type !== "Identifier") return
161
- if (inlineObjectTypeOf(node.id.typeAnnotation, node)) {
162
- reportLiteral(node.id.typeAnnotation, "variable")
163
- }
164
- },
165
- }
166
- },
167
- }
168
-
169
- // -- TYPE-4 ----------------------------------------------------------------------------------------
170
-
171
- /** An enum keeps its runtime object. */
172
- export const noConstEnum = {
173
- meta: {
174
- type: "problem",
175
- docs: { description: "Enums are declared plain, never `const enum`." },
176
- schema: [],
177
- messages: {
178
- constEnum:
179
- "`const enum {{name}}` is inlined at compile time and has no runtime object: it cannot be iterated, cannot be reverse-mapped, and cannot cross the isolated-modules boundary this repository compiles under. It saves a few bytes and costs a family of things that simply do not work. Declare a plain `enum`.",
180
- },
181
- },
182
- create(context) {
183
- return {
184
- TSEnumDeclaration(node) {
185
- if (!node.const) return
186
- context.report({ node, messageId: "constEnum", data: { name: node.id.name } })
187
- },
188
- }
189
- },
190
- }
191
-
192
- // -- R72 -------------------------------------------------------------------------------------------
193
-
194
- /** A global name (`Function`, `eval`) that no declaration of this file shadows. */
195
- const isGlobalName = (context, node, name) => {
196
- let scope = (context.sourceCode || context.getSourceCode()).getScope(node)
197
- while (scope) {
198
- const variable = scope.set.get(name)
199
- if (variable) return variable.defs.length === 0
200
- scope = scope.upper
201
- }
202
- return true
203
- }
204
-
205
- /** `Function` as a type, `eval` and `new Function` run or accept code the compiler cannot see. */
206
- export const noFunctionOrEval = {
207
- meta: {
208
- type: "problem",
209
- docs: { description: "No `Function` type, no `eval`, no `new Function` (the type escapes the borrowed assertion rules do not cover)." },
210
- schema: [],
211
- messages: {
212
- functionType:
213
- "The `Function` type accepts any callable and returns `any`, so the compiler stops checking every call through it. Write the signature: `(input: Input) => Result`.",
214
- evaluated:
215
- "`{{name}}` builds code from a string, which the compiler cannot type and a reader cannot follow. Call a real function, or map a key to a function in a typed record.",
216
- },
217
- },
218
- create(context) {
219
- return {
220
- TSTypeReference(node) {
221
- if (node.typeName.type === "Identifier" && node.typeName.name === "Function" && isGlobalName(context, node, "Function")) {
222
- context.report({ node, messageId: "functionType" })
223
- }
224
- },
225
- CallExpression(node) {
226
- const callee = node.callee
227
- if (callee.type !== "Identifier" || (callee.name !== "eval" && callee.name !== "Function")) return
228
- if (isGlobalName(context, node, callee.name)) context.report({ node, messageId: "evaluated", data: { name: callee.name } })
229
- },
230
- NewExpression(node) {
231
- if (node.callee.type === "Identifier" && node.callee.name === "Function" && isGlobalName(context, node, "Function")) {
232
- context.report({ node, messageId: "evaluated", data: { name: "new Function" } })
233
- }
234
- },
235
- }
236
- },
237
- }
238
-
239
- // -- R75 -------------------------------------------------------------------------------------------
240
-
241
- const HANDLER_DECORATORS = new Set(["Query", "Mutation", "Subscription", "ResolveField", "Get", "Post", "Put", "Patch", "Delete", "MessagePattern", "EventPattern", "Cron", "Interval"])
242
- const SURFACE_CLASS_DECORATORS = new Set(["Injectable", "Resolver", "Controller"])
243
-
244
- const decoratorIdentifier = (decorator) => {
245
- const expression = decorator?.expression
246
- if (!expression) return null
247
- if (expression.type === "Identifier") return expression.name
248
- if (expression.type === "CallExpression" && expression.callee.type === "Identifier") return expression.callee.name
249
- return null
250
- }
251
-
252
- /** A method that a caller or the framework reaches states what it returns. */
253
- export const explicitHandlerReturnType = {
254
- meta: {
255
- type: "problem",
256
- docs: { description: "Handlers and public methods of an Injectable, Resolver or Controller declare a return type." },
257
- schema: [],
258
- messages: {
259
- handler:
260
- "This handler declares no return type, so the transport contract is whatever the body happens to return today and a change of the body silently changes the wire. Declare the return type (`Promise<Type>`).",
261
- publicMethod:
262
- "This public method declares no return type, so its callers depend on an inferred shape that changes with the body. Declare the return type.",
263
- },
264
- },
265
- create(context) {
266
- return {
267
- MethodDefinition(node) {
268
- if (node.kind !== "method" || node.static || !node.value.body || node.value.returnType) return
269
- if (node.computed || node.key.type !== "Identifier") return
270
- const isHandler = (node.decorators ?? []).some((decorator) => HANDLER_DECORATORS.has(decoratorIdentifier(decorator)))
271
- if (isHandler) {
272
- context.report({ node: node.key, messageId: "handler" })
273
- return
274
- }
275
- if (node.accessibility === "private" || node.accessibility === "protected" || node.override) return
276
- const klass = node.parent?.parent
277
- if (!klass || klass.type !== "ClassDeclaration") return
278
- const exported = klass.parent?.type === "ExportNamedDeclaration" || klass.parent?.type === "ExportDefaultDeclaration"
279
- const decorators = [...(klass.decorators ?? []), ...(klass.parent?.decorators ?? [])].map(decoratorIdentifier)
280
- if (!exported || !decorators.some((name) => SURFACE_CLASS_DECORATORS.has(name))) return
281
- context.report({ node: node.key, messageId: "publicMethod" })
282
- },
283
- }
284
- },
285
- }
286
-
287
- // -- TYPE-5 (rule 6) -- ATTEMPTED, NOT SHIPPED ------------------------------------------------------
288
- //
289
- // A rule was written here: two-or-more `is`/`has`-prefixed booleans sharing a type literal with a
290
- // field that is optional and not itself boolean. It was measured against the reference backend
291
- // before shipping, per this canon's own standard -- and both of its two real firings were wrong.
292
- // `GlobalSearchItem` (`isEnrolled` / `isFree` / `isPremium` beside an unrelated optional
293
- // `parentPath`) and `AdvertisementSeedItem` (`isHouseAd` / `isActive` beside an unrelated optional
294
- // `ctaText`) are both genuinely independent facts about one entity, not a product of states -- the
295
- // exact "transport type" and "independent booleans" exceptions `type-safety.md` already names. A
296
- // rule reporting a defect on 2 of its 2 real firings is not a rule with debt to burn down; it is
297
- // wrong, and shipping it at any level would teach a reader to distrust the machine rather than the
298
- // code. TYPE-5 stays `documented`, exactly as the law's own `Layer held` table already says: seeing
299
- // past a transport DTO to whether its flags are truly one situation needs the meaning of the code,
300
- // which is a reader's job, not a decidable question of syntax.
301
-
302
- /** The rules this law contributes to the plugin. */
303
- export const rules = {
304
- "no-function-or-eval": noFunctionOrEval,
305
- "no-inline-param-type": noInlineParamType,
306
- "no-inline-object-type": noInlineObjectType,
307
- "no-const-enum": noConstEnum,
308
- "explicit-handler-return-type": explicitHandlerReturnType,
309
- }
310
-
311
- /**
312
- * The level this law asks for: every rule at `error`, in every file, specs included.
313
- *
314
- * The borrowed type-escape rules (`consistent-type-assertions` never, `no-non-null-assertion`, `no-explicit-any`)
315
- * are added by the factory (`lib/config.mjs`), not listed here. The array spelling rule stays with this law.
316
- */
317
- export const recommended = {
318
- "starci-be/no-function-or-eval": "error",
319
- "starci-be/no-inline-param-type": "error",
320
- "starci-be/no-inline-object-type": "error",
321
- "starci-be/no-const-enum": "error",
322
- "starci-be/explicit-handler-return-type": "error",
323
- }