@autotelic/plumb 0.6.0 → 0.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 (279) hide show
  1. package/README.md +81 -8
  2. package/dist/configs/recommended-rules.d.ts +36 -0
  3. package/dist/configs/recommended-rules.js +57 -0
  4. package/dist/effect/rules/guarded-op-must-return-effect.js +1 -1
  5. package/dist/effect/rules/no-cascading-layer-provide.js +1 -1
  6. package/dist/effect/rules/no-decode-unknown-option.js +1 -1
  7. package/dist/effect/rules/no-direct-browser-storage.js +3 -3
  8. package/dist/effect/rules/no-direct-fetch.js +1 -1
  9. package/dist/effect/rules/no-manual-field-guards.js +1 -1
  10. package/dist/effect/rules/no-nested-layer-provide.js +1 -1
  11. package/dist/effect/rules/no-nullish-default-on-partial-input.js +2 -2
  12. package/dist/effect/rules/no-raw-error-forwarding.d.ts +4 -0
  13. package/dist/effect/rules/no-raw-error-forwarding.js +7 -2
  14. package/dist/effect/rules/no-silent-error-swallow.js +1 -1
  15. package/dist/effect/rules/no-static-effect-service-forwarders.js +5 -4
  16. package/dist/effect/rules/no-try-catch.js +1 -1
  17. package/dist/effect/rules/no-unguarded-json-parse.js +1 -1
  18. package/dist/effect/rules/option-core-needs-effect-public.js +1 -1
  19. package/dist/effect/rules/prefer-die-for-precondition-defects.js +1 -1
  20. package/dist/effect/rules/prefer-effect-gen-for-guard-ladders.js +1 -1
  21. package/dist/effect/rules/prefer-effect-match.js +2 -2
  22. package/dist/effect/rules/prefer-effect-predicate-over-boolean-function.js +1 -1
  23. package/dist/effect/rules/prefer-named-guard-predicate.js +1 -1
  24. package/dist/effect/rules/prefer-option-pipeline.js +13 -12
  25. package/dist/effect/rules/prefer-ordering-match.js +1 -1
  26. package/dist/effect/rules/prefer-tagged-enum.js +1 -1
  27. package/dist/effect/rules/require-schema-type-derivation.d.ts +8 -2
  28. package/dist/effect/rules/require-schema-type-derivation.js +14 -4
  29. package/dist/index.js +8 -0
  30. package/dist/react/rules/require-dot-notation-exports.js +1 -1
  31. package/dist/react/rules/require-guarded-context-hook.js +1 -1
  32. package/dist/react/rules/require-tripartite-context.js +1 -1
  33. package/dist/react/rules/use-encapsulation.js +1 -1
  34. package/dist/rules/no-adapter-in-values.d.ts +12 -0
  35. package/dist/rules/no-adapter-in-values.js +110 -0
  36. package/dist/rules/no-builtin-throws.js +1 -1
  37. package/dist/rules/no-duplicated-literal-union.d.ts +7 -0
  38. package/dist/rules/no-duplicated-literal-union.js +5 -1
  39. package/dist/rules/no-generic-export-names.js +1 -1
  40. package/dist/rules/no-multiple-function-params.js +26 -12
  41. package/dist/rules/no-mutable-environment-capture.js +2 -2
  42. package/dist/rules/no-nondeterministic-core.js +1 -1
  43. package/dist/rules/no-nullable-value-field.d.ts +16 -0
  44. package/dist/rules/no-nullable-value-field.js +117 -0
  45. package/dist/rules/no-optional-function-parameters.js +1 -1
  46. package/dist/rules/no-row-coercion.d.ts +13 -0
  47. package/dist/rules/no-row-coercion.js +135 -0
  48. package/dist/rules/no-single-use-private-functions.js +1 -1
  49. package/dist/rules/no-sql-string-interpolation.js +2 -2
  50. package/dist/rules/no-stray-inline-comments.js +1 -1
  51. package/dist/rules/no-string-instant.d.ts +15 -0
  52. package/dist/rules/no-string-instant.js +108 -0
  53. package/dist/rules/no-swappable-primitive-params.js +1 -1
  54. package/dist/rules/no-tag-ladder-assertions.js +1 -1
  55. package/dist/rules/no-vague-test-filenames.js +1 -1
  56. package/dist/rules/prefer-property-tests.d.ts +5 -0
  57. package/dist/rules/prefer-property-tests.js +7 -0
  58. package/dist/rules/require-jsdoc-on-exported.js +1 -1
  59. package/dist/shared/ancestors.d.ts +1 -1
  60. package/dist/shared/ancestors.js +1 -1
  61. package/dist/shared/values-path.d.ts +12 -0
  62. package/dist/shared/values-path.js +56 -0
  63. package/dist/src/configs/recommended-rules.d.ts +20 -0
  64. package/dist/src/configs/recommended-rules.js +22 -0
  65. package/dist/src/effect/index.d.ts +3 -0
  66. package/dist/src/effect/index.js +60 -0
  67. package/dist/src/effect/rules/guarded-op-must-return-effect.d.ts +6 -0
  68. package/dist/src/effect/rules/guarded-op-must-return-effect.js +235 -0
  69. package/dist/src/effect/rules/guarded-op-must-return-option.d.ts +2 -0
  70. package/dist/src/effect/rules/guarded-op-must-return-option.js +88 -0
  71. package/dist/src/effect/rules/no-cascading-layer-provide.d.ts +6 -0
  72. package/dist/src/effect/rules/no-cascading-layer-provide.js +73 -0
  73. package/dist/src/effect/rules/no-decode-unknown-option.d.ts +7 -0
  74. package/dist/src/effect/rules/no-decode-unknown-option.js +34 -0
  75. package/dist/src/effect/rules/no-direct-browser-storage.d.ts +2 -0
  76. package/dist/src/effect/rules/no-direct-browser-storage.js +88 -0
  77. package/dist/src/effect/rules/no-direct-fetch.d.ts +2 -0
  78. package/dist/src/effect/rules/no-direct-fetch.js +37 -0
  79. package/dist/src/effect/rules/no-manual-field-guards.d.ts +6 -0
  80. package/dist/src/effect/rules/no-manual-field-guards.js +129 -0
  81. package/dist/src/effect/rules/no-nested-layer-provide.d.ts +2 -0
  82. package/dist/src/effect/rules/no-nested-layer-provide.js +50 -0
  83. package/dist/src/effect/rules/no-nullish-default-on-partial-input.d.ts +13 -0
  84. package/dist/src/effect/rules/no-nullish-default-on-partial-input.js +109 -0
  85. package/dist/src/effect/rules/no-raw-error-forwarding.d.ts +12 -0
  86. package/dist/src/effect/rules/no-raw-error-forwarding.js +103 -0
  87. package/dist/src/effect/rules/no-schema-class-modeling.d.ts +2 -0
  88. package/dist/src/effect/rules/no-schema-class-modeling.js +52 -0
  89. package/dist/src/effect/rules/no-service-constructor-imports.d.ts +2 -0
  90. package/dist/src/effect/rules/no-service-constructor-imports.js +42 -0
  91. package/dist/src/effect/rules/no-silent-error-swallow.d.ts +2 -0
  92. package/dist/src/effect/rules/no-silent-error-swallow.js +95 -0
  93. package/dist/src/effect/rules/no-static-effect-service-forwarders.d.ts +6 -0
  94. package/dist/src/effect/rules/no-static-effect-service-forwarders.js +222 -0
  95. package/dist/src/effect/rules/no-try-catch.d.ts +2 -0
  96. package/dist/src/effect/rules/no-try-catch.js +30 -0
  97. package/dist/src/effect/rules/no-unguarded-json-parse.d.ts +5 -0
  98. package/dist/src/effect/rules/no-unguarded-json-parse.js +200 -0
  99. package/dist/src/effect/rules/option-core-needs-effect-public.d.ts +5 -0
  100. package/dist/src/effect/rules/option-core-needs-effect-public.js +76 -0
  101. package/dist/src/effect/rules/prefer-die-for-precondition-defects.d.ts +5 -0
  102. package/dist/src/effect/rules/prefer-die-for-precondition-defects.js +112 -0
  103. package/dist/src/effect/rules/prefer-effect-gen-for-guard-ladders.d.ts +5 -0
  104. package/dist/src/effect/rules/prefer-effect-gen-for-guard-ladders.js +72 -0
  105. package/dist/src/effect/rules/prefer-effect-match.d.ts +2 -0
  106. package/dist/src/effect/rules/prefer-effect-match.js +74 -0
  107. package/dist/src/effect/rules/prefer-effect-predicate-over-boolean-function.d.ts +2 -0
  108. package/dist/src/effect/rules/prefer-effect-predicate-over-boolean-function.js +75 -0
  109. package/dist/src/effect/rules/prefer-named-guard-predicate.d.ts +2 -0
  110. package/dist/src/effect/rules/prefer-named-guard-predicate.js +93 -0
  111. package/dist/src/effect/rules/prefer-option-pipeline.d.ts +2 -0
  112. package/dist/src/effect/rules/prefer-option-pipeline.js +87 -0
  113. package/dist/src/effect/rules/prefer-ordering-match.d.ts +2 -0
  114. package/dist/src/effect/rules/prefer-ordering-match.js +135 -0
  115. package/dist/src/effect/rules/prefer-tagged-enum.d.ts +2 -0
  116. package/dist/src/effect/rules/prefer-tagged-enum.js +66 -0
  117. package/dist/src/effect/rules/require-schema-type-derivation.d.ts +7 -0
  118. package/dist/src/effect/rules/require-schema-type-derivation.js +80 -0
  119. package/dist/src/index.d.ts +3 -0
  120. package/dist/src/index.js +106 -0
  121. package/dist/src/meta/index.d.ts +7 -0
  122. package/dist/src/meta/index.js +22 -0
  123. package/dist/src/meta/rules/no-disable-directives.d.ts +6 -0
  124. package/dist/src/meta/rules/no-disable-directives.js +35 -0
  125. package/dist/src/meta/rules/no-manual-ancestor-walks.d.ts +2 -0
  126. package/dist/src/meta/rules/no-manual-ancestor-walks.js +26 -0
  127. package/dist/src/meta/rules/prefer-before-file-scope.d.ts +2 -0
  128. package/dist/src/meta/rules/prefer-before-file-scope.js +57 -0
  129. package/dist/src/meta/rules/require-create-once.d.ts +2 -0
  130. package/dist/src/meta/rules/require-create-once.js +51 -0
  131. package/dist/src/meta/rules/require-rule-tester.d.ts +2 -0
  132. package/dist/src/meta/rules/require-rule-tester.js +50 -0
  133. package/dist/src/react/index.d.ts +3 -0
  134. package/dist/src/react/index.js +16 -0
  135. package/dist/src/react/role.d.ts +23 -0
  136. package/dist/src/react/role.js +30 -0
  137. package/dist/src/react/rules/require-dot-notation-exports.d.ts +27 -0
  138. package/dist/src/react/rules/require-dot-notation-exports.js +144 -0
  139. package/dist/src/react/rules/require-guarded-context-hook.d.ts +19 -0
  140. package/dist/src/react/rules/require-guarded-context-hook.js +167 -0
  141. package/dist/src/react/rules/require-tripartite-context.d.ts +17 -0
  142. package/dist/src/react/rules/require-tripartite-context.js +160 -0
  143. package/dist/src/react/rules/use-encapsulation.d.ts +22 -0
  144. package/dist/src/react/rules/use-encapsulation.js +97 -0
  145. package/dist/src/rules/no-anonymous-wide-tuples.d.ts +7 -0
  146. package/dist/src/rules/no-anonymous-wide-tuples.js +34 -0
  147. package/dist/src/rules/no-barrel-export-star.d.ts +2 -0
  148. package/dist/src/rules/no-barrel-export-star.js +26 -0
  149. package/dist/src/rules/no-boolean-field-signals.d.ts +2 -0
  150. package/dist/src/rules/no-boolean-field-signals.js +279 -0
  151. package/dist/src/rules/no-builtin-throws.d.ts +6 -0
  152. package/dist/src/rules/no-builtin-throws.js +74 -0
  153. package/dist/src/rules/no-chained-type-assertions.d.ts +2 -0
  154. package/dist/src/rules/no-chained-type-assertions.js +54 -0
  155. package/dist/src/rules/no-conditional-empty-object-spread.d.ts +2 -0
  156. package/dist/src/rules/no-conditional-empty-object-spread.js +36 -0
  157. package/dist/src/rules/no-duplicated-literal-union.d.ts +6 -0
  158. package/dist/src/rules/no-duplicated-literal-union.js +66 -0
  159. package/dist/src/rules/no-exported-mutable-state.d.ts +7 -0
  160. package/dist/src/rules/no-exported-mutable-state.js +104 -0
  161. package/dist/src/rules/no-generic-export-names.d.ts +2 -0
  162. package/dist/src/rules/no-generic-export-names.js +141 -0
  163. package/dist/src/rules/no-impossible-branch-throw.d.ts +2 -0
  164. package/dist/src/rules/no-impossible-branch-throw.js +51 -0
  165. package/dist/src/rules/no-known-value-widening.d.ts +2 -0
  166. package/dist/src/rules/no-known-value-widening.js +176 -0
  167. package/dist/src/rules/no-module-mocking.d.ts +2 -0
  168. package/dist/src/rules/no-module-mocking.js +90 -0
  169. package/dist/src/rules/no-multiple-function-params.d.ts +2 -0
  170. package/dist/src/rules/no-multiple-function-params.js +155 -0
  171. package/dist/src/rules/no-mutable-environment-capture.d.ts +7 -0
  172. package/dist/src/rules/no-mutable-environment-capture.js +134 -0
  173. package/dist/src/rules/no-nondeterministic-core.d.ts +6 -0
  174. package/dist/src/rules/no-nondeterministic-core.js +63 -0
  175. package/dist/src/rules/no-object-parameters.d.ts +2 -0
  176. package/dist/src/rules/no-object-parameters.js +95 -0
  177. package/dist/src/rules/no-optional-function-parameters.d.ts +7 -0
  178. package/dist/src/rules/no-optional-function-parameters.js +44 -0
  179. package/dist/src/rules/no-product-of-state-booleans.d.ts +2 -0
  180. package/dist/src/rules/no-product-of-state-booleans.js +79 -0
  181. package/dist/src/rules/no-redundant-derived-field.d.ts +6 -0
  182. package/dist/src/rules/no-redundant-derived-field.js +194 -0
  183. package/dist/src/rules/no-reflect-apply.d.ts +2 -0
  184. package/dist/src/rules/no-reflect-apply.js +29 -0
  185. package/dist/src/rules/no-reflect-get.d.ts +2 -0
  186. package/dist/src/rules/no-reflect-get.js +29 -0
  187. package/dist/src/rules/no-reinterpret-cast.d.ts +2 -0
  188. package/dist/src/rules/no-reinterpret-cast.js +68 -0
  189. package/dist/src/rules/no-runtime-typeof.d.ts +2 -0
  190. package/dist/src/rules/no-runtime-typeof.js +54 -0
  191. package/dist/src/rules/no-sentinel-comparison-union.d.ts +2 -0
  192. package/dist/src/rules/no-sentinel-comparison-union.js +139 -0
  193. package/dist/src/rules/no-shape-in-symbol-names.d.ts +2 -0
  194. package/dist/src/rules/no-shape-in-symbol-names.js +39 -0
  195. package/dist/src/rules/no-single-use-private-functions.d.ts +17 -0
  196. package/dist/src/rules/no-single-use-private-functions.js +419 -0
  197. package/dist/src/rules/no-sql-string-interpolation.d.ts +7 -0
  198. package/dist/src/rules/no-sql-string-interpolation.js +62 -0
  199. package/dist/src/rules/no-stacked-jsdoc-blocks.d.ts +2 -0
  200. package/dist/src/rules/no-stacked-jsdoc-blocks.js +50 -0
  201. package/dist/src/rules/no-stray-inline-comments.d.ts +2 -0
  202. package/dist/src/rules/no-stray-inline-comments.js +74 -0
  203. package/dist/src/rules/no-swappable-primitive-params.d.ts +2 -0
  204. package/dist/src/rules/no-swappable-primitive-params.js +96 -0
  205. package/dist/src/rules/no-tag-ladder-assertions.d.ts +6 -0
  206. package/dist/src/rules/no-tag-ladder-assertions.js +63 -0
  207. package/dist/src/rules/no-transposed-field-reads.d.ts +8 -0
  208. package/dist/src/rules/no-transposed-field-reads.js +101 -0
  209. package/dist/src/rules/no-unit-return-validators.d.ts +2 -0
  210. package/dist/src/rules/no-unit-return-validators.js +64 -0
  211. package/dist/src/rules/no-unknown-parameters.d.ts +2 -0
  212. package/dist/src/rules/no-unknown-parameters.js +82 -0
  213. package/dist/src/rules/no-unknown-returns.d.ts +2 -0
  214. package/dist/src/rules/no-unknown-returns.js +86 -0
  215. package/dist/src/rules/no-unknown-type-aliases.d.ts +2 -0
  216. package/dist/src/rules/no-unknown-type-aliases.js +64 -0
  217. package/dist/src/rules/no-unsafe-dictionary-type.d.ts +2 -0
  218. package/dist/src/rules/no-unsafe-dictionary-type.js +116 -0
  219. package/dist/src/rules/no-vague-test-filenames.d.ts +2 -0
  220. package/dist/src/rules/no-vague-test-filenames.js +61 -0
  221. package/dist/src/rules/no-widen-then-assert.d.ts +2 -0
  222. package/dist/src/rules/no-widen-then-assert.js +268 -0
  223. package/dist/src/rules/prefer-payload-brand.d.ts +2 -0
  224. package/dist/src/rules/prefer-payload-brand.js +57 -0
  225. package/dist/src/rules/prefer-property-tests.d.ts +5 -0
  226. package/dist/src/rules/prefer-property-tests.js +39 -0
  227. package/dist/src/rules/require-canonical-stringify-for-identity.d.ts +8 -0
  228. package/dist/src/rules/require-canonical-stringify-for-identity.js +72 -0
  229. package/dist/src/rules/require-deprecated-tag-for-legacy-comments.d.ts +2 -0
  230. package/dist/src/rules/require-deprecated-tag-for-legacy-comments.js +34 -0
  231. package/dist/src/rules/require-exhaustive-tag-switch.d.ts +7 -0
  232. package/dist/src/rules/require-exhaustive-tag-switch.js +34 -0
  233. package/dist/src/rules/require-fc-block-predicate.d.ts +2 -0
  234. package/dist/src/rules/require-fc-block-predicate.js +37 -0
  235. package/dist/src/rules/require-jsdoc-on-exported.d.ts +2 -0
  236. package/dist/src/rules/require-jsdoc-on-exported.js +66 -0
  237. package/dist/src/rules/require-published-order.d.ts +2 -0
  238. package/dist/src/rules/require-published-order.js +102 -0
  239. package/dist/src/rules/require-safety-comment-for-type-assertion.d.ts +2 -0
  240. package/dist/src/rules/require-safety-comment-for-type-assertion.js +53 -0
  241. package/dist/src/rules/require-sort-comparator.d.ts +7 -0
  242. package/dist/src/rules/require-sort-comparator.js +34 -0
  243. package/dist/src/rules/test-utils.d.ts +35 -0
  244. package/dist/src/rules/test-utils.js +53 -0
  245. package/dist/src/shared/ancestors.d.ts +18 -0
  246. package/dist/src/shared/ancestors.js +19 -0
  247. package/dist/src/shared/child-nodes.d.ts +12 -0
  248. package/dist/src/shared/child-nodes.js +26 -0
  249. package/dist/src/shared/dictionary-types.d.ts +55 -0
  250. package/dist/src/shared/dictionary-types.js +413 -0
  251. package/dist/src/shared/is-node.d.ts +9 -0
  252. package/dist/src/shared/is-node.js +10 -0
  253. package/dist/src/shared/lexical-type-parameters.d.ts +12 -0
  254. package/dist/src/shared/lexical-type-parameters.js +50 -0
  255. package/dist/src/shared/reflect-method.d.ts +15 -0
  256. package/dist/src/shared/reflect-method.js +32 -0
  257. package/dist/src/shared/rule-options.d.ts +18 -0
  258. package/dist/src/shared/rule-options.js +12 -0
  259. package/dist/src/shared/structural.d.ts +54 -0
  260. package/dist/src/shared/structural.js +40 -0
  261. package/dist/src/testing/index.d.ts +2 -0
  262. package/dist/src/testing/index.js +1 -0
  263. package/dist/src/testing/testable-rule.d.ts +39 -0
  264. package/dist/src/testing/testable-rule.js +84 -0
  265. package/dist/src/ui/index.d.ts +12 -0
  266. package/dist/src/ui/index.js +18 -0
  267. package/dist/src/ui/manifest.d.ts +34 -0
  268. package/dist/src/ui/manifest.js +75 -0
  269. package/dist/src/ui/rules/no-deprecated-parts.d.ts +3 -0
  270. package/dist/src/ui/rules/no-deprecated-parts.js +131 -0
  271. package/dist/testing/testable-rule.d.ts +6 -5
  272. package/dist/testing/testable-rule.js +20 -6
  273. package/dist/ui/index.d.ts +12 -0
  274. package/dist/ui/index.js +18 -0
  275. package/dist/ui/manifest.d.ts +49 -0
  276. package/dist/ui/manifest.js +90 -0
  277. package/dist/ui/rules/no-deprecated-parts.d.ts +3 -0
  278. package/dist/ui/rules/no-deprecated-parts.js +172 -0
  279. package/package.json +20 -11
@@ -0,0 +1,134 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { ancestorsOf } from "../shared/ancestors.js";
3
+ const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
4
+ /**
5
+ * Whether the identifier sits inside a type annotation rather than a value position.
6
+ *
7
+ * @param {SourceCode} sourceCode - The rule's source-code accessor.
8
+ * @param {ESTree.Node} identifier - The reference identifier to test.
9
+ * @returns {boolean} True when an ancestor is a TypeScript type node.
10
+ */
11
+ function isTypePosition(sourceCode, identifier) {
12
+ for (const ancestor of ancestorsOf(sourceCode, identifier)) {
13
+ if (ancestor.type.startsWith("TS"))
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+ /**
19
+ * The name a function is called by at its definition site.
20
+ *
21
+ * @param {ESTree.Node} node - The function-like node.
22
+ * @param {SourceCode} sourceCode - The rule's source-code accessor.
23
+ * @returns {string} The function's name, or "(anonymous)".
24
+ */
25
+ function functionName(node, sourceCode) {
26
+ if (node.type === "FunctionDeclaration" && node.id !== null)
27
+ return node.id.name;
28
+ const parent = ancestorsOf(sourceCode, node)[0];
29
+ if (parent !== undefined) {
30
+ if (parent.type === "VariableDeclarator" && parent.id.type === "Identifier")
31
+ return parent.id.name;
32
+ if (parent.type === "AssignmentExpression" && parent.left.type === "Identifier")
33
+ return parent.left.name;
34
+ if (parent.type === "MethodDefinition" && parent.key.type === "Identifier")
35
+ return parent.key.name;
36
+ if (parent.type === "Property" && parent.key.type === "Identifier")
37
+ return parent.key.name;
38
+ if (parent.type === "ExportDefaultDeclaration")
39
+ return "default";
40
+ }
41
+ return "(anonymous)";
42
+ }
43
+ /**
44
+ * Collect module-scope let/var bindings, separating real state from
45
+ * function-valued helpers (which are legitimate module-private utilities).
46
+ *
47
+ * @param {ESTree.Program} program - The file's root node.
48
+ * @returns {ModuleState} Mutable state names and helper names.
49
+ */
50
+ function collectModuleState(program) {
51
+ const state = new Set();
52
+ const helpers = new Set();
53
+ for (const statement of program.body) {
54
+ const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
55
+ if (declaration === null || declaration === undefined)
56
+ continue;
57
+ if (declaration.type !== "VariableDeclaration")
58
+ continue;
59
+ if (declaration.kind !== "let" && declaration.kind !== "var")
60
+ continue;
61
+ for (const declarator of declaration.declarations) {
62
+ if (declarator.id.type !== "Identifier")
63
+ continue;
64
+ const init = declarator.init;
65
+ const isHelper = init !== null &&
66
+ init !== undefined &&
67
+ (init.type === "ArrowFunctionExpression" || init.type === "FunctionExpression");
68
+ (isHelper ? helpers : state).add(declarator.id.name);
69
+ }
70
+ }
71
+ return { state, helpers };
72
+ }
73
+ /**
74
+ * A function that reads or writes module state instead of taking it as a
75
+ * parameter is dishonest: its result depends on outside context, so it is not
76
+ * locally testable. Inject the value at the call site (the document's seed-the
77
+ * PRNG-once, pass-it-in pattern) so the dependency is explicit in the signature.
78
+ */
79
+ export const noMutableEnvironmentCaptureRule = defineRule({
80
+ meta: {
81
+ type: "problem",
82
+ docs: {
83
+ description: "Disallow functions that read or write module-scope mutable state (let/var) instead of receiving it as a parameter; hidden module state makes a function dishonest and not locally testable.",
84
+ },
85
+ messages: {
86
+ mutableModuleState: "Function `{{name}}` {{kind}} module-scope mutable state `{{binding}}` rather than receiving it as a parameter. Hidden module state makes the function dishonest: its result depends on outside context, so it is not locally testable. Inject `{{binding}}` at the call site or thread it through the signature so the dependency is explicit.",
87
+ },
88
+ },
89
+ createOnce(context) {
90
+ let moduleState = { state: new Set(), helpers: new Set() };
91
+ const check = (node) => {
92
+ if (node.type !== "FunctionDeclaration" &&
93
+ node.type !== "FunctionExpression" &&
94
+ node.type !== "ArrowFunctionExpression") {
95
+ return;
96
+ }
97
+ const scope = context.sourceCode.getScope(node);
98
+ const { state, helpers } = moduleState;
99
+ for (const reference of scope.references) {
100
+ const resolved = reference.resolved;
101
+ if (resolved === null || resolved === undefined)
102
+ continue;
103
+ const name = resolved.name;
104
+ if (helpers.has(name))
105
+ continue;
106
+ if (!state.has(name))
107
+ continue;
108
+ if (isTypePosition(context.sourceCode, reference.identifier))
109
+ continue;
110
+ context.report({
111
+ node: reference.identifier,
112
+ messageId: "mutableModuleState",
113
+ data: {
114
+ name: functionName(node, context.sourceCode),
115
+ kind: reference.isWrite() ? "writes" : "reads",
116
+ binding: name,
117
+ },
118
+ });
119
+ }
120
+ };
121
+ return {
122
+ before() {
123
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
124
+ return false;
125
+ },
126
+ Program(node) {
127
+ moduleState = collectModuleState(node);
128
+ },
129
+ FunctionDeclaration: check,
130
+ FunctionExpression: check,
131
+ ArrowFunctionExpression: check,
132
+ };
133
+ },
134
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Canonical form: identical inputs must produce identical outputs. Time and
3
+ * randomness are boundary inputs: capture them once at the edge and pass
4
+ * them in, so cores stay reproducible and their serialisations stable.
5
+ */
6
+ export declare const noNondeterministicCoreRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,63 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ const NONDETERMINISTIC_MEMBERS = new Set(["getRandomValues", "random", "randomUUID", "now"]);
3
+ const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$|\/test\//u;
4
+ function memberChain(node) {
5
+ if (node.type === "MemberExpression" && !node.computed) {
6
+ return [...memberChain(node.object), node.property.type === "Identifier" ? node.property.name : ""];
7
+ }
8
+ return [node.type === "Identifier" ? node.name : "?"];
9
+ }
10
+ /**
11
+ * Canonical form: identical inputs must produce identical outputs. Time and
12
+ * randomness are boundary inputs: capture them once at the edge and pass
13
+ * them in, so cores stay reproducible and their serialisations stable.
14
+ */
15
+ export const noNondeterministicCoreRule = defineRule({
16
+ meta: {
17
+ type: "problem",
18
+ docs: {
19
+ description: "Disallow nondeterministic sources (Math.random, Date.now, new Date(), crypto randomness) outside tests; inject them as boundary inputs so cores stay canonical.",
20
+ },
21
+ messages: {
22
+ nondeterministicSource: "`{{source}}` makes this code's output depend on when/where it runs, breaking canonical form (identical inputs, identical outputs). Capture it at the boundary and pass it in as a parameter.",
23
+ unseededDate: "`new Date()` captures wall-clock time here, making output non-reproducible. Take the instant as a parameter (or use a fixed epoch for pure conversions).",
24
+ },
25
+ },
26
+ createOnce(context) {
27
+ return {
28
+ before() {
29
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
30
+ return false;
31
+ },
32
+ MemberExpression(node) {
33
+ const property = node.property;
34
+ if (node.computed || property.type !== "Identifier" || !NONDETERMINISTIC_MEMBERS.has(property.name)) {
35
+ return;
36
+ }
37
+ const chain = memberChain(node.object);
38
+ const root = chain[0] ?? "";
39
+ if ((root === "Math" && property.name === "random") || (root === "crypto" && property.name !== "now")) {
40
+ context.report({
41
+ node,
42
+ messageId: "nondeterministicSource",
43
+ data: { source: `${root}.${property.name}` },
44
+ });
45
+ return;
46
+ }
47
+ if (property.name === "now" &&
48
+ ((root === "Date" && chain.length === 1) || (root === "performance" && chain.length === 1))) {
49
+ context.report({
50
+ node,
51
+ messageId: "nondeterministicSource",
52
+ data: { source: `${root}.now` },
53
+ });
54
+ }
55
+ },
56
+ NewExpression(node) {
57
+ if (node.callee.type === "Identifier" && node.callee.name === "Date" && node.arguments.length === 0) {
58
+ context.report({ node, messageId: "unseededDate" });
59
+ }
60
+ },
61
+ };
62
+ },
63
+ });
@@ -0,0 +1,2 @@
1
+ /** Ban the broad object type on function inputs, including local aliases to object. */
2
+ export declare const noObjectParametersRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,95 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { ancestorsOf } from "../shared/ancestors.js";
3
+ import { lexicalTypeParameterNames } from "../shared/lexical-type-parameters.js";
4
+ function parameterAnnotation(parameter) {
5
+ if (parameter.type === "TSParameterProperty") {
6
+ return parameterAnnotation(parameter.parameter);
7
+ }
8
+ if (parameter.type === "RestElement") {
9
+ return parameter.typeAnnotation ?? parameterAnnotation(parameter.argument);
10
+ }
11
+ if (parameter.type === "AssignmentPattern") {
12
+ return parameter.typeAnnotation ?? parameter.left.typeAnnotation;
13
+ }
14
+ return parameter.typeAnnotation;
15
+ }
16
+ /** Ban the broad object type on function inputs, including local aliases to object. */
17
+ export const noObjectParametersRule = defineRule({
18
+ meta: {
19
+ type: "problem",
20
+ docs: {
21
+ description: "Disallow object function parameters; inputs must use an owner-provided type and be parsed at their boundary.",
22
+ },
23
+ messages: {
24
+ objectParameter: "Parameter `{{parameter}}` uses the broad `object` type. Accept a named owner type; parse external input at its boundary before calling this function.",
25
+ },
26
+ },
27
+ createOnce(context) {
28
+ const aliases = new Map();
29
+ const resolvesToObject = (type, shadowedAliases, visited = new Set()) => {
30
+ if (type.type === "TSObjectKeyword")
31
+ return true;
32
+ if (type.type === "TSParenthesizedType")
33
+ return resolvesToObject(type.typeAnnotation, shadowedAliases, visited);
34
+ if (type.type === "TSUnionType") {
35
+ return type.types.some((member) => resolvesToObject(member, shadowedAliases, visited));
36
+ }
37
+ if (type.type !== "TSTypeReference" ||
38
+ type.typeName.type !== "Identifier" ||
39
+ (type.typeArguments !== null &&
40
+ type.typeArguments !== undefined &&
41
+ type.typeArguments.params.length > 0) ||
42
+ visited.has(type.typeName.name) ||
43
+ shadowedAliases.has(type.typeName.name)) {
44
+ return false;
45
+ }
46
+ const alias = aliases.get(type.typeName.name);
47
+ if (alias === undefined)
48
+ return false;
49
+ const nextVisited = new Set(visited);
50
+ nextVisited.add(type.typeName.name);
51
+ return resolvesToObject(alias, shadowedAliases, nextVisited);
52
+ };
53
+ const checkParameters = (node) => {
54
+ const shadowedAliases = lexicalTypeParameterNames(node, ancestorsOf(context.sourceCode, node), context.sourceCode.visitorKeys);
55
+ for (const parameter of node.params) {
56
+ const annotation = parameterAnnotation(parameter);
57
+ if (annotation === null || annotation === undefined)
58
+ continue;
59
+ if (!resolvesToObject(annotation.typeAnnotation, shadowedAliases))
60
+ continue;
61
+ context.report({
62
+ node: annotation.typeAnnotation,
63
+ messageId: "objectParameter",
64
+ data: {
65
+ parameter: parameter.type === "Identifier"
66
+ ? parameter.name
67
+ : context.sourceCode.getText(parameter).replace(/\s*:\s*object\s*$/u, ""),
68
+ },
69
+ });
70
+ }
71
+ };
72
+ return {
73
+ Program(node) {
74
+ aliases.clear();
75
+ for (const statement of node.body) {
76
+ const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
77
+ if (declaration?.type === "TSTypeAliasDeclaration" &&
78
+ (declaration.typeParameters === null || declaration.typeParameters === undefined)) {
79
+ aliases.set(declaration.id.name, declaration.typeAnnotation);
80
+ }
81
+ }
82
+ },
83
+ ArrowFunctionExpression: checkParameters,
84
+ FunctionDeclaration: checkParameters,
85
+ FunctionExpression: checkParameters,
86
+ TSCallSignatureDeclaration: checkParameters,
87
+ TSConstructSignatureDeclaration: checkParameters,
88
+ TSConstructorType: checkParameters,
89
+ TSDeclareFunction: checkParameters,
90
+ TSEmptyBodyFunctionExpression: checkParameters,
91
+ TSFunctionType: checkParameters,
92
+ TSMethodSignature: checkParameters,
93
+ };
94
+ },
95
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Optional parameters hide undefined from the signature; require the union spelled out.
3
+ *
4
+ * Optionality is a grammar-level flag present on every concrete ParamPattern
5
+ * shape, read after unwrapping TypeScript parameter-property wrappers.
6
+ */
7
+ export declare const noOptionalFunctionParametersRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,44 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
3
+ /**
4
+ * Optional parameters hide undefined from the signature; require the union spelled out.
5
+ *
6
+ * Optionality is a grammar-level flag present on every concrete ParamPattern
7
+ * shape, read after unwrapping TypeScript parameter-property wrappers.
8
+ */
9
+ export const noOptionalFunctionParametersRule = defineRule({
10
+ meta: {
11
+ type: "problem",
12
+ docs: {
13
+ description: "Disallow optional function parameters (`param?:`); require an explicit union with undefined so callers see the possibility in the type.",
14
+ },
15
+ messages: {
16
+ optionalParameter: "Optional parameters hide `undefined` from callers. Annotate the parameter as `T | undefined` so the possibility is spelled out in the type.",
17
+ },
18
+ },
19
+ createOnce(context) {
20
+ const check = (node) => {
21
+ if (node.type !== "FunctionDeclaration" &&
22
+ node.type !== "FunctionExpression" &&
23
+ node.type !== "ArrowFunctionExpression")
24
+ return;
25
+ for (const parameter of node.params) {
26
+ let pattern = parameter;
27
+ if (pattern.type === "TSParameterProperty")
28
+ pattern = pattern.parameter;
29
+ if (pattern.optional !== true)
30
+ continue;
31
+ context.report({ node: parameter, messageId: "optionalParameter" });
32
+ }
33
+ };
34
+ return {
35
+ before() {
36
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
37
+ return false;
38
+ },
39
+ FunctionDeclaration: check,
40
+ FunctionExpression: check,
41
+ ArrowFunctionExpression: check,
42
+ };
43
+ },
44
+ });
@@ -0,0 +1,2 @@
1
+ /** A product of booleans inside a variant tends to admit an illegal combination. */
2
+ export declare const noProductOfStateBooleansRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,79 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { readField } from "../shared/structural.js";
3
+ import { ancestorsOf } from "../shared/ancestors.js";
4
+ function lastTypeNameSegment(typeName) {
5
+ if (typeName.type === "Identifier")
6
+ return typeName.name;
7
+ if (typeName.type === "TSQualifiedName")
8
+ return lastTypeNameSegment(typeName.right);
9
+ return null;
10
+ }
11
+ /**
12
+ * Returns the enclosing TSPropertySignature when the literal is a variant
13
+ * payload of a Data.TaggedEnum (i.e. `{ Variant: Payload }` inside the enum's
14
+ * type argument), otherwise null.
15
+ *
16
+ * @param {ESTree.TSTypeLiteral} node - The visited type literal (candidate payload).
17
+ * @param {ReadonlyArray<ESTree.Node>} ancestors - Nearest-first ancestor chain of `node`.
18
+ * @returns {ESTree.TSPropertySignature | null} The variant property signature, or null.
19
+ */
20
+ function variantPayloadSignature(node, ancestors) {
21
+ const at = (depth) => ancestors[ancestors.length - 1 - depth];
22
+ const annotation = at(0);
23
+ if (annotation?.type !== "TSTypeAnnotation")
24
+ return null;
25
+ const signature = at(1);
26
+ if (signature?.type !== "TSPropertySignature")
27
+ return null;
28
+ const outer = at(2);
29
+ if (outer?.type !== "TSTypeLiteral")
30
+ return null;
31
+ const args = at(3);
32
+ if (args === undefined)
33
+ return null;
34
+ const reference = at(4);
35
+ if (reference?.type !== "TSTypeReference")
36
+ return null;
37
+ const name = lastTypeNameSegment(reference.typeName);
38
+ return name !== null && /TaggedEnum$/u.test(name) ? signature : null;
39
+ }
40
+ /** A product of booleans inside a variant tends to admit an illegal combination. */
41
+ export const noProductOfStateBooleansRule = defineRule({
42
+ meta: {
43
+ type: "problem",
44
+ docs: {
45
+ description: "Disallow tagged-enum variant payloads with two or more boolean state flags; replace them with a nested tag union so impossible combinations can't be represented.",
46
+ },
47
+ messages: {
48
+ productOfStateBooleans: "Variant payload `{{name}}` carries {{count}} boolean state flags. Replace them with a nested tag union (e.g. Sign) so combinations like {zero, negative} can't be represented.",
49
+ },
50
+ },
51
+ createOnce(context) {
52
+ return {
53
+ TSTypeLiteral(node) {
54
+ const signature = variantPayloadSignature(node, ancestorsOf(context.sourceCode, node));
55
+ if (signature === null)
56
+ return;
57
+ let count = 0;
58
+ for (const member of node.members) {
59
+ if (member.type !== "TSPropertySignature")
60
+ continue;
61
+ const annotation = member.typeAnnotation;
62
+ if (annotation === null || annotation === undefined)
63
+ continue;
64
+ if (annotation.typeAnnotation.type === "TSBooleanKeyword")
65
+ count += 1;
66
+ }
67
+ if (count < 2)
68
+ return;
69
+ const key = signature.key;
70
+ const name = key.type === "Identifier" ? key.name : "variant";
71
+ context.report({
72
+ node,
73
+ messageId: "productOfStateBooleans",
74
+ data: { name, count: String(count) },
75
+ });
76
+ },
77
+ };
78
+ },
79
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * One fact, one place: a type that stores data *and* a field derivable from
3
+ * that data keeps two sources of truth that drift apart independently. Counts
4
+ * belong to read sites; ordering belongs in the structure itself.
5
+ */
6
+ export declare const noRedundantDerivedFieldRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,194 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { isRecordObject, isString } from "../shared/structural.js";
3
+ const COUNT_SUFFIX = /(?:Count|Length|Size)$/u;
4
+ const COUNT_PREFIX = /^(?:count|num|numberOf|total)(?=[A-Z])/u;
5
+ const KEYED_COLLECTION_NAMES = new Set(["Array", "Map", "Record", "ReadonlyArray", "ReadonlyMap", "ReadonlySet", "Set"]);
6
+ function lastTypeNameSegment(typeName) {
7
+ if (typeName.type === "Identifier")
8
+ return typeName.name;
9
+ if (typeName.type === "TSQualifiedName")
10
+ return lastTypeNameSegment(typeName.right);
11
+ return null;
12
+ }
13
+ function propertyName(member) {
14
+ if (member.type !== "TSPropertySignature")
15
+ return null;
16
+ const key = member.key;
17
+ return key.type === "Identifier" ? key.name : null;
18
+ }
19
+ function propertyAnnotation(member) {
20
+ if (member.type !== "TSPropertySignature")
21
+ return null;
22
+ return member.typeAnnotation?.typeAnnotation ?? null;
23
+ }
24
+ /** Lowercase, strip separators, and naive-singularise so `seatOrder`/`seats`, `entryIndex`/`entries` stems can be compared.
25
+ *
26
+ * @param {string} name - The field or property name to fold.
27
+ * @returns {string} The comparison stem.
28
+ */
29
+ function normaliseName(name) {
30
+ const folded = name.replaceAll(/[^a-zA-Z0-9]/gu, "").toLowerCase();
31
+ if (folded.endsWith("ies") && folded.length > 4)
32
+ return `${folded.slice(0, -3)}y`;
33
+ return folded.endsWith("s") && folded.length > 3 ? folded.slice(0, -1) : folded;
34
+ }
35
+ /** Extract the `x` from `xCount`, `countX`, `numberOfX`, … otherwise null.
36
+ *
37
+ * @param {string} name - The candidate count-field name.
38
+ * @returns {string | null} The counted stem, or null when the name isn't a count pattern.
39
+ */
40
+ function countStem(name) {
41
+ const suffixMatch = name.match(COUNT_SUFFIX);
42
+ if (suffixMatch !== null && suffixMatch.index !== null)
43
+ return name.slice(0, suffixMatch.index);
44
+ const prefixMatch = name.match(COUNT_PREFIX);
45
+ if (prefixMatch !== null) {
46
+ const stem = name.slice(prefixMatch[0].length);
47
+ return stem.charAt(0).toLowerCase() + stem.slice(1);
48
+ }
49
+ return null;
50
+ }
51
+ /** Whether the annotation is any array/map/set/record shape.
52
+ *
53
+ * @param {ESTree.TSType | null | undefined} annotation - The annotation to inspect.
54
+ * @returns {boolean} True when the annotation denotes a keyed collection.
55
+ */
56
+ function isCollectionLike(annotation) {
57
+ if (annotation === null || annotation === undefined)
58
+ return false;
59
+ if (annotation.type === "TSTypeReference") {
60
+ const name = lastTypeNameSegment(annotation.typeName);
61
+ return name !== null && KEYED_COLLECTION_NAMES.has(name);
62
+ }
63
+ return annotation.type === "TSTypeOperator" && annotation.operator === "readonly"
64
+ ? isCollectionLike(annotation.typeAnnotation)
65
+ : annotation.type === "TSArrayType";
66
+ }
67
+ /** Whether the annotation is an array (or readonly array reference) whose element is a primitive keyword.
68
+ *
69
+ * @param {ESTree.TSType | null | undefined} annotation - The annotation to inspect.
70
+ * @returns {"string" | "number" | null} The primitive keyword of the element type, or null.
71
+ */
72
+ function arrayOfPrimitiveKeys(annotation) {
73
+ if (annotation === null || annotation === undefined)
74
+ return null;
75
+ let elementType;
76
+ if (annotation.type === "TSArrayType") {
77
+ elementType = annotation.elementType;
78
+ }
79
+ else if (annotation.type === "TSTypeOperator" &&
80
+ annotation.operator === "readonly" &&
81
+ annotation.typeAnnotation.type === "TSArrayType") {
82
+ elementType = annotation.typeAnnotation.elementType;
83
+ }
84
+ else if (annotation.type === "TSTypeReference" &&
85
+ annotation.typeArguments != null &&
86
+ annotation.typeArguments.params.length === 1) {
87
+ const name = lastTypeNameSegment(annotation.typeName);
88
+ if (name === "Array" || name === "ReadonlyArray")
89
+ elementType = annotation.typeArguments.params[0];
90
+ }
91
+ if (elementType === undefined)
92
+ return null;
93
+ if (elementType.type === "TSStringKeyword")
94
+ return "string";
95
+ if (elementType.type === "TSNumberKeyword")
96
+ return "number";
97
+ return null;
98
+ }
99
+ /** First type argument's primitive keyword for a keyed collection like `Record<string, T>` / `Map<string, T>`.
100
+ *
101
+ * @param {ESTree.TSType | null | undefined} annotation - The annotation to inspect.
102
+ * @returns {"string" | "number" | null} The key keyword, or null when not a keyed reference.
103
+ */
104
+ function keyKeywordOf(annotation) {
105
+ if (annotation?.type !== "TSTypeReference")
106
+ return null;
107
+ const first = annotation.typeArguments?.params[0] ?? null;
108
+ if (first === null || first === undefined)
109
+ return null;
110
+ if (first.type === "TSStringKeyword")
111
+ return "string";
112
+ if (first.type === "TSNumberKeyword")
113
+ return "number";
114
+ return null;
115
+ }
116
+ /**
117
+ * One fact, one place: a type that stores data *and* a field derivable from
118
+ * that data keeps two sources of truth that drift apart independently. Counts
119
+ * belong to read sites; ordering belongs in the structure itself.
120
+ */
121
+ export const noRedundantDerivedFieldRule = defineRule({
122
+ meta: {
123
+ type: "suggestion",
124
+ docs: {
125
+ description: "Disallow fields that duplicate information derivable from a sibling field on the same type (derived counts, parallel key/order arrays); compute or encode them instead.",
126
+ },
127
+ messages: {
128
+ redundantCount: "`{{name}}` restates what is derivable from `{{sibling}}`, giving the type two sources of truth that can drift. Drop it and compute the count at read time.",
129
+ parallelKeyArray: "`{{name}}` mirrors the keys of `{{sibling}}` as a second source of truth that can drift. Encode the canonical form (e.g. ordering) in the collection itself instead of a parallel array.",
130
+ },
131
+ },
132
+ createOnce(context) {
133
+ function checkMembers(members) {
134
+ for (const member of members) {
135
+ const name = propertyName(member);
136
+ if (name === null)
137
+ continue;
138
+ const annotation = propertyAnnotation(member);
139
+ const stem = countStem(name);
140
+ if (stem !== null && annotation?.type === "TSNumberKeyword") {
141
+ const stemNorm = normaliseName(stem);
142
+ const sibling = members.find((other) => {
143
+ if (other === member)
144
+ return false;
145
+ const otherName = propertyName(other);
146
+ return otherName !== null && normaliseName(otherName) === stemNorm && isCollectionLike(propertyAnnotation(other));
147
+ });
148
+ if (sibling !== undefined) {
149
+ context.report({
150
+ node: member,
151
+ messageId: "redundantCount",
152
+ data: { name, sibling: propertyName(sibling) ?? "" },
153
+ });
154
+ continue;
155
+ }
156
+ }
157
+ const elementKey = arrayOfPrimitiveKeys(annotation);
158
+ if (elementKey === null)
159
+ continue;
160
+ const nameNorm = normaliseName(name);
161
+ const sibling = members.find((other) => {
162
+ if (other === member)
163
+ return false;
164
+ const otherName = propertyName(other);
165
+ if (otherName === null)
166
+ return false;
167
+ if (keyKeywordOf(propertyAnnotation(other)) !== elementKey)
168
+ return false;
169
+ const otherNorm = normaliseName(otherName);
170
+ return otherNorm.includes(nameNorm) || nameNorm.includes(otherNorm);
171
+ });
172
+ if (sibling !== undefined) {
173
+ context.report({
174
+ node: member,
175
+ messageId: "parallelKeyArray",
176
+ data: { name, sibling: propertyName(sibling) ?? "" },
177
+ });
178
+ }
179
+ }
180
+ }
181
+ function memberList(bodyNode) {
182
+ return [...bodyNode.body];
183
+ }
184
+ return {
185
+ TSInterfaceDeclaration(node) {
186
+ checkMembers(memberList(node.body));
187
+ },
188
+ TSTypeAliasDeclaration(node) {
189
+ if (node.typeAnnotation.type === "TSTypeLiteral")
190
+ checkMembers(node.typeAnnotation.members);
191
+ },
192
+ };
193
+ },
194
+ });
@@ -0,0 +1,2 @@
1
+ /** Ban Reflect.apply, which bypasses ordinary typed function calls. */
2
+ export declare const noReflectApplyRule: import("@oxlint/plugins").Rule;