@autotelic/plumb 0.3.1 → 0.4.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 (268) hide show
  1. package/dist/effect/index.d.ts +3 -0
  2. package/dist/effect/index.js +56 -0
  3. package/dist/effect/rules/guarded-op-must-return-effect.d.ts +6 -0
  4. package/dist/effect/rules/guarded-op-must-return-effect.js +235 -0
  5. package/dist/effect/rules/guarded-op-must-return-option.d.ts +2 -0
  6. package/dist/effect/rules/guarded-op-must-return-option.js +88 -0
  7. package/dist/effect/rules/no-cascading-layer-provide.d.ts +6 -0
  8. package/dist/effect/rules/no-cascading-layer-provide.js +73 -0
  9. package/dist/effect/rules/no-decode-unknown-option.d.ts +7 -0
  10. package/dist/effect/rules/no-decode-unknown-option.js +34 -0
  11. package/dist/effect/rules/no-direct-browser-storage.d.ts +2 -0
  12. package/dist/effect/rules/no-direct-browser-storage.js +88 -0
  13. package/dist/effect/rules/no-direct-fetch.d.ts +2 -0
  14. package/dist/effect/rules/no-direct-fetch.js +37 -0
  15. package/dist/effect/rules/no-manual-field-guards.d.ts +6 -0
  16. package/dist/effect/rules/no-manual-field-guards.js +129 -0
  17. package/dist/effect/rules/no-nested-layer-provide.d.ts +2 -0
  18. package/dist/effect/rules/no-nested-layer-provide.js +50 -0
  19. package/dist/effect/rules/no-schema-class-modeling.d.ts +2 -0
  20. package/dist/effect/rules/no-schema-class-modeling.js +52 -0
  21. package/dist/effect/rules/no-service-constructor-imports.d.ts +2 -0
  22. package/dist/effect/rules/no-service-constructor-imports.js +42 -0
  23. package/dist/effect/rules/no-silent-error-swallow.d.ts +2 -0
  24. package/dist/effect/rules/no-silent-error-swallow.js +95 -0
  25. package/dist/effect/rules/no-static-effect-service-forwarders.d.ts +6 -0
  26. package/dist/effect/rules/no-static-effect-service-forwarders.js +222 -0
  27. package/dist/effect/rules/no-try-catch.d.ts +2 -0
  28. package/dist/effect/rules/no-try-catch.js +30 -0
  29. package/dist/effect/rules/no-unguarded-json-parse.d.ts +5 -0
  30. package/dist/effect/rules/no-unguarded-json-parse.js +200 -0
  31. package/dist/effect/rules/option-core-needs-effect-public.d.ts +5 -0
  32. package/dist/effect/rules/option-core-needs-effect-public.js +76 -0
  33. package/dist/effect/rules/prefer-die-for-precondition-defects.d.ts +5 -0
  34. package/dist/effect/rules/prefer-die-for-precondition-defects.js +112 -0
  35. package/dist/effect/rules/prefer-effect-gen-for-guard-ladders.d.ts +5 -0
  36. package/dist/effect/rules/prefer-effect-gen-for-guard-ladders.js +72 -0
  37. package/dist/effect/rules/prefer-effect-match.d.ts +2 -0
  38. package/dist/effect/rules/prefer-effect-match.js +74 -0
  39. package/dist/effect/rules/prefer-effect-predicate-over-boolean-function.d.ts +2 -0
  40. package/dist/effect/rules/prefer-effect-predicate-over-boolean-function.js +75 -0
  41. package/dist/effect/rules/prefer-named-guard-predicate.d.ts +2 -0
  42. package/dist/effect/rules/prefer-named-guard-predicate.js +93 -0
  43. package/dist/effect/rules/prefer-option-pipeline.d.ts +2 -0
  44. package/dist/effect/rules/prefer-option-pipeline.js +87 -0
  45. package/dist/effect/rules/prefer-ordering-match.d.ts +2 -0
  46. package/dist/effect/rules/prefer-ordering-match.js +135 -0
  47. package/dist/effect/rules/prefer-tagged-enum.d.ts +2 -0
  48. package/dist/effect/rules/prefer-tagged-enum.js +66 -0
  49. package/dist/effect/rules/require-schema-type-derivation.d.ts +7 -0
  50. package/dist/effect/rules/require-schema-type-derivation.js +80 -0
  51. package/dist/index.d.ts +3 -0
  52. package/dist/index.js +104 -0
  53. package/dist/meta/index.d.ts +7 -0
  54. package/{src/meta/index.ts → dist/meta/index.js} +13 -16
  55. package/dist/meta/rules/no-disable-directives.d.ts +6 -0
  56. package/dist/meta/rules/no-disable-directives.js +35 -0
  57. package/dist/meta/rules/no-manual-ancestor-walks.d.ts +2 -0
  58. package/dist/meta/rules/no-manual-ancestor-walks.js +26 -0
  59. package/dist/meta/rules/prefer-before-file-scope.d.ts +2 -0
  60. package/dist/meta/rules/prefer-before-file-scope.js +57 -0
  61. package/dist/meta/rules/require-create-once.d.ts +2 -0
  62. package/dist/meta/rules/require-create-once.js +51 -0
  63. package/dist/meta/rules/require-rule-tester.d.ts +2 -0
  64. package/dist/meta/rules/require-rule-tester.js +50 -0
  65. package/dist/rules/no-anonymous-wide-tuples.d.ts +7 -0
  66. package/dist/rules/no-anonymous-wide-tuples.js +34 -0
  67. package/dist/rules/no-barrel-export-star.d.ts +2 -0
  68. package/dist/rules/no-barrel-export-star.js +26 -0
  69. package/dist/rules/no-boolean-field-signals.d.ts +2 -0
  70. package/dist/rules/no-boolean-field-signals.js +279 -0
  71. package/dist/rules/no-builtin-throws.d.ts +6 -0
  72. package/dist/rules/no-builtin-throws.js +74 -0
  73. package/dist/rules/no-chained-type-assertions.d.ts +2 -0
  74. package/dist/rules/no-chained-type-assertions.js +54 -0
  75. package/dist/rules/no-conditional-empty-object-spread.d.ts +2 -0
  76. package/dist/rules/no-conditional-empty-object-spread.js +36 -0
  77. package/dist/rules/no-duplicated-literal-union.d.ts +6 -0
  78. package/dist/rules/no-duplicated-literal-union.js +62 -0
  79. package/dist/rules/no-exported-mutable-state.d.ts +7 -0
  80. package/dist/rules/no-exported-mutable-state.js +104 -0
  81. package/dist/rules/no-generic-export-names.d.ts +2 -0
  82. package/dist/rules/no-generic-export-names.js +141 -0
  83. package/dist/rules/no-impossible-branch-throw.d.ts +2 -0
  84. package/dist/rules/no-impossible-branch-throw.js +51 -0
  85. package/dist/rules/no-known-value-widening.d.ts +2 -0
  86. package/dist/rules/no-known-value-widening.js +176 -0
  87. package/dist/rules/no-module-mocking.d.ts +2 -0
  88. package/dist/rules/no-module-mocking.js +90 -0
  89. package/dist/rules/no-multiple-function-params.d.ts +2 -0
  90. package/dist/rules/no-multiple-function-params.js +155 -0
  91. package/dist/rules/no-mutable-environment-capture.d.ts +7 -0
  92. package/dist/rules/no-mutable-environment-capture.js +134 -0
  93. package/dist/rules/no-nondeterministic-core.d.ts +6 -0
  94. package/dist/rules/no-nondeterministic-core.js +63 -0
  95. package/dist/rules/no-object-parameters.d.ts +2 -0
  96. package/dist/rules/no-object-parameters.js +95 -0
  97. package/dist/rules/no-optional-function-parameters.d.ts +7 -0
  98. package/dist/rules/no-optional-function-parameters.js +44 -0
  99. package/dist/rules/no-product-of-state-booleans.d.ts +2 -0
  100. package/dist/rules/no-product-of-state-booleans.js +79 -0
  101. package/dist/rules/no-redundant-derived-field.d.ts +6 -0
  102. package/dist/rules/no-redundant-derived-field.js +194 -0
  103. package/dist/rules/no-reflect-apply.d.ts +2 -0
  104. package/dist/rules/no-reflect-apply.js +29 -0
  105. package/dist/rules/no-reflect-get.d.ts +2 -0
  106. package/dist/rules/no-reflect-get.js +29 -0
  107. package/dist/rules/no-reinterpret-cast.d.ts +2 -0
  108. package/dist/rules/no-reinterpret-cast.js +68 -0
  109. package/dist/rules/no-runtime-typeof.d.ts +2 -0
  110. package/dist/rules/no-runtime-typeof.js +54 -0
  111. package/dist/rules/no-sentinel-comparison-union.d.ts +2 -0
  112. package/dist/rules/no-sentinel-comparison-union.js +139 -0
  113. package/dist/rules/no-shape-in-symbol-names.d.ts +2 -0
  114. package/dist/rules/no-shape-in-symbol-names.js +39 -0
  115. package/dist/rules/no-single-use-private-functions.d.ts +17 -0
  116. package/dist/rules/no-single-use-private-functions.js +419 -0
  117. package/dist/rules/no-stacked-jsdoc-blocks.d.ts +2 -0
  118. package/dist/rules/no-stacked-jsdoc-blocks.js +50 -0
  119. package/dist/rules/no-stray-inline-comments.d.ts +2 -0
  120. package/dist/rules/no-stray-inline-comments.js +74 -0
  121. package/dist/rules/no-swappable-primitive-params.d.ts +2 -0
  122. package/dist/rules/no-swappable-primitive-params.js +96 -0
  123. package/dist/rules/no-tag-ladder-assertions.d.ts +6 -0
  124. package/dist/rules/no-tag-ladder-assertions.js +63 -0
  125. package/dist/rules/no-transposed-field-reads.d.ts +8 -0
  126. package/dist/rules/no-transposed-field-reads.js +101 -0
  127. package/dist/rules/no-unit-return-validators.d.ts +2 -0
  128. package/dist/rules/no-unit-return-validators.js +64 -0
  129. package/dist/rules/no-unknown-parameters.d.ts +2 -0
  130. package/dist/rules/no-unknown-parameters.js +82 -0
  131. package/dist/rules/no-unknown-returns.d.ts +2 -0
  132. package/dist/rules/no-unknown-returns.js +86 -0
  133. package/dist/rules/no-unknown-type-aliases.d.ts +2 -0
  134. package/dist/rules/no-unknown-type-aliases.js +64 -0
  135. package/dist/rules/no-unsafe-dictionary-type.d.ts +2 -0
  136. package/dist/rules/no-unsafe-dictionary-type.js +116 -0
  137. package/dist/rules/no-vague-test-filenames.d.ts +2 -0
  138. package/dist/rules/no-vague-test-filenames.js +61 -0
  139. package/dist/rules/no-widen-then-assert.d.ts +2 -0
  140. package/dist/rules/no-widen-then-assert.js +268 -0
  141. package/dist/rules/prefer-payload-brand.d.ts +2 -0
  142. package/dist/rules/prefer-payload-brand.js +57 -0
  143. package/dist/rules/prefer-property-tests.d.ts +5 -0
  144. package/dist/rules/prefer-property-tests.js +39 -0
  145. package/dist/rules/require-canonical-stringify-for-identity.d.ts +8 -0
  146. package/dist/rules/require-canonical-stringify-for-identity.js +72 -0
  147. package/dist/rules/require-deprecated-tag-for-legacy-comments.d.ts +2 -0
  148. package/dist/rules/require-deprecated-tag-for-legacy-comments.js +34 -0
  149. package/dist/rules/require-exhaustive-tag-switch.d.ts +7 -0
  150. package/dist/rules/require-exhaustive-tag-switch.js +34 -0
  151. package/dist/rules/require-fc-block-predicate.d.ts +2 -0
  152. package/dist/rules/require-fc-block-predicate.js +37 -0
  153. package/dist/rules/require-jsdoc-on-exported.d.ts +2 -0
  154. package/dist/rules/require-jsdoc-on-exported.js +66 -0
  155. package/dist/rules/require-published-order.d.ts +2 -0
  156. package/dist/rules/require-published-order.js +102 -0
  157. package/dist/rules/require-safety-comment-for-type-assertion.d.ts +2 -0
  158. package/dist/rules/require-safety-comment-for-type-assertion.js +53 -0
  159. package/dist/rules/require-sort-comparator.d.ts +7 -0
  160. package/dist/rules/require-sort-comparator.js +34 -0
  161. package/dist/rules/test-utils.d.ts +35 -0
  162. package/dist/rules/test-utils.js +53 -0
  163. package/{src/shared/ancestors.ts → dist/shared/ancestors.d.ts} +1 -4
  164. package/dist/shared/ancestors.js +19 -0
  165. package/dist/shared/child-nodes.d.ts +12 -0
  166. package/dist/shared/child-nodes.js +26 -0
  167. package/dist/shared/dictionary-types.d.ts +55 -0
  168. package/dist/shared/dictionary-types.js +413 -0
  169. package/{src/shared/is-node.ts → dist/shared/is-node.d.ts} +2 -6
  170. package/dist/shared/is-node.js +10 -0
  171. package/dist/shared/lexical-type-parameters.d.ts +12 -0
  172. package/dist/shared/lexical-type-parameters.js +50 -0
  173. package/dist/shared/reflect-method.d.ts +15 -0
  174. package/dist/shared/reflect-method.js +32 -0
  175. package/{src/shared/rule-options.ts → dist/shared/rule-options.d.ts} +2 -7
  176. package/dist/shared/rule-options.js +12 -0
  177. package/{src/shared/structural.ts → dist/shared/structural.d.ts} +17 -44
  178. package/dist/shared/structural.js +40 -0
  179. package/{src/testing/index.ts → dist/testing/index.d.ts} +0 -1
  180. package/dist/testing/index.js +1 -0
  181. package/dist/testing/testable-rule.d.ts +38 -0
  182. package/dist/testing/testable-rule.js +70 -0
  183. package/package.json +7 -6
  184. package/src/effect/index.ts +0 -59
  185. package/src/effect/rules/guarded-op-must-return-effect.ts +0 -236
  186. package/src/effect/rules/guarded-op-must-return-option.ts +0 -97
  187. package/src/effect/rules/no-cascading-layer-provide.ts +0 -80
  188. package/src/effect/rules/no-decode-unknown-option.ts +0 -41
  189. package/src/effect/rules/no-direct-browser-storage.ts +0 -91
  190. package/src/effect/rules/no-direct-fetch.ts +0 -44
  191. package/src/effect/rules/no-manual-field-guards.ts +0 -144
  192. package/src/effect/rules/no-nested-layer-provide.ts +0 -51
  193. package/src/effect/rules/no-schema-class-modeling.ts +0 -59
  194. package/src/effect/rules/no-service-constructor-imports.ts +0 -50
  195. package/src/effect/rules/no-silent-error-swallow.ts +0 -99
  196. package/src/effect/rules/no-static-effect-service-forwarders.ts +0 -227
  197. package/src/effect/rules/no-try-catch.ts +0 -32
  198. package/src/effect/rules/no-unguarded-json-parse.ts +0 -211
  199. package/src/effect/rules/option-core-needs-effect-public.ts +0 -81
  200. package/src/effect/rules/prefer-die-for-precondition-defects.ts +0 -118
  201. package/src/effect/rules/prefer-effect-gen-for-guard-ladders.ts +0 -76
  202. package/src/effect/rules/prefer-effect-match.ts +0 -78
  203. package/src/effect/rules/prefer-effect-predicate-over-boolean-function.ts +0 -79
  204. package/src/effect/rules/prefer-named-guard-predicate.ts +0 -105
  205. package/src/effect/rules/prefer-option-pipeline.ts +0 -95
  206. package/src/effect/rules/prefer-ordering-match.ts +0 -152
  207. package/src/effect/rules/prefer-tagged-enum.ts +0 -68
  208. package/src/effect/rules/require-schema-type-derivation.ts +0 -83
  209. package/src/index.ts +0 -106
  210. package/src/meta/rules/no-disable-directives.ts +0 -38
  211. package/src/meta/rules/no-manual-ancestor-walks.ts +0 -27
  212. package/src/meta/rules/prefer-before-file-scope.ts +0 -57
  213. package/src/meta/rules/require-create-once.ts +0 -51
  214. package/src/meta/rules/require-rule-tester.ts +0 -57
  215. package/src/rules/no-anonymous-wide-tuples.ts +0 -38
  216. package/src/rules/no-barrel-export-star.ts +0 -30
  217. package/src/rules/no-boolean-field-signals.ts +0 -305
  218. package/src/rules/no-builtin-throws.ts +0 -83
  219. package/src/rules/no-chained-type-assertions.ts +0 -65
  220. package/src/rules/no-conditional-empty-object-spread.ts +0 -42
  221. package/src/rules/no-duplicated-literal-union.ts +0 -66
  222. package/src/rules/no-exported-mutable-state.ts +0 -111
  223. package/src/rules/no-generic-export-names.ts +0 -149
  224. package/src/rules/no-impossible-branch-throw.ts +0 -55
  225. package/src/rules/no-known-value-widening.ts +0 -225
  226. package/src/rules/no-module-mocking.ts +0 -95
  227. package/src/rules/no-multiple-function-params.ts +0 -192
  228. package/src/rules/no-nondeterministic-core.ts +0 -73
  229. package/src/rules/no-object-parameters.ts +0 -127
  230. package/src/rules/no-optional-function-parameters.ts +0 -49
  231. package/src/rules/no-product-of-state-booleans.ts +0 -80
  232. package/src/rules/no-redundant-derived-field.ts +0 -192
  233. package/src/rules/no-reflect-apply.ts +0 -32
  234. package/src/rules/no-reflect-get.ts +0 -32
  235. package/src/rules/no-reinterpret-cast.ts +0 -78
  236. package/src/rules/no-runtime-typeof.ts +0 -59
  237. package/src/rules/no-sentinel-comparison-union.ts +0 -148
  238. package/src/rules/no-shape-in-symbol-names.ts +0 -45
  239. package/src/rules/no-single-use-private-functions.ts +0 -329
  240. package/src/rules/no-stacked-jsdoc-blocks.ts +0 -65
  241. package/src/rules/no-stray-inline-comments.ts +0 -79
  242. package/src/rules/no-swappable-primitive-params.ts +0 -109
  243. package/src/rules/no-tag-ladder-assertions.ts +0 -71
  244. package/src/rules/no-transposed-field-reads.ts +0 -135
  245. package/src/rules/no-unit-return-validators.ts +0 -65
  246. package/src/rules/no-unknown-parameters.ts +0 -97
  247. package/src/rules/no-unknown-returns.ts +0 -120
  248. package/src/rules/no-unknown-type-aliases.ts +0 -70
  249. package/src/rules/no-unsafe-dictionary-type.ts +0 -132
  250. package/src/rules/no-vague-test-filenames.ts +0 -67
  251. package/src/rules/no-widen-then-assert.ts +0 -345
  252. package/src/rules/prefer-payload-brand.ts +0 -67
  253. package/src/rules/prefer-property-tests.ts +0 -43
  254. package/src/rules/require-canonical-stringify-for-identity.ts +0 -80
  255. package/src/rules/require-deprecated-tag-for-legacy-comments.ts +0 -45
  256. package/src/rules/require-exhaustive-tag-switch.ts +0 -42
  257. package/src/rules/require-fc-block-predicate.ts +0 -42
  258. package/src/rules/require-jsdoc-on-exported.ts +0 -74
  259. package/src/rules/require-published-order.ts +0 -109
  260. package/src/rules/require-safety-comment-for-type-assertion.ts +0 -61
  261. package/src/rules/require-sort-comparator.ts +0 -41
  262. package/src/rules/test-utils.ts +0 -68
  263. package/src/shared/child-nodes.ts +0 -27
  264. package/src/shared/dictionary-types.ts +0 -524
  265. package/src/shared/lexical-type-parameters.ts +0 -62
  266. package/src/shared/reflect-method.ts +0 -41
  267. package/src/testing/testable-rule.test.ts +0 -68
  268. package/src/testing/testable-rule.ts +0 -86
@@ -0,0 +1,93 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { childNodes } from "../../shared/child-nodes.js";
3
+ import { readField } from "../../shared/structural.js";
4
+ const PREDICATE_NAME = /^is[A-Z]/u;
5
+ const TEST_FILE = /.(?:test|spec).[cm]?[jt]sx?$/u;
6
+ /** True for a logical chain (>= 2 operands) whose every leaf is a domain-predicate call.
7
+ *
8
+ * @param {ESTree.Expression} expression - The guard test expression.
9
+ * @returns {boolean} True when the chain is composed of domain predicates only.
10
+ */
11
+ function isPredicateChain(expression) {
12
+ if (expression.type !== "LogicalExpression")
13
+ return false;
14
+ return chainLeaf(expression.left) && chainLeaf(expression.right);
15
+ }
16
+ /**
17
+ * Whether a leaf expression is a domain predicate call, not an Option combinator.
18
+ *
19
+ * @param {ESTree.Expression} expression - The leaf expression to test.
20
+ * @returns {boolean} True when the callee matches the domain predicate naming scheme.
21
+ */
22
+ function chainLeaf(expression) {
23
+ if (expression.type === "LogicalExpression") {
24
+ return chainLeaf(expression.left) && chainLeaf(expression.right);
25
+ }
26
+ if (expression.type === "ParenthesizedExpression") {
27
+ return chainLeaf(expression.expression);
28
+ }
29
+ if (expression.type !== "CallExpression")
30
+ return false;
31
+ const callee = expression.callee;
32
+ if (callee.type === "MemberExpression" &&
33
+ callee.object.type === "Identifier" &&
34
+ callee.object.name === "Option") {
35
+ return false;
36
+ }
37
+ if (callee.type === "Identifier")
38
+ return PREDICATE_NAME.test(callee.name);
39
+ return (callee.type === "MemberExpression" &&
40
+ callee.property.type === "Identifier" &&
41
+ PREDICATE_NAME.test(callee.property.name));
42
+ }
43
+ /** True when the subtree produces an Option.none()/Option.some(...) result.
44
+ *
45
+ * @param {ESTree.Node | null | undefined} node - The subtree root to scan.
46
+ * @returns {boolean} True when an Option constructor call appears in the subtree.
47
+ */
48
+ function containsOptionResult(node) {
49
+ if (node === null || node === undefined)
50
+ return false;
51
+ if (node.type === "CallExpression" &&
52
+ node.callee.type === "MemberExpression" &&
53
+ node.callee.object.type === "Identifier" &&
54
+ node.callee.object.name === "Option" &&
55
+ node.callee.property.type === "Identifier" &&
56
+ (node.callee.property.name === "none" || node.callee.property.name === "some")) {
57
+ return true;
58
+ }
59
+ return childNodes(node).some(containsOptionResult);
60
+ }
61
+ /** Inline chains of domain predicates guarding Options should be named Predicates. */
62
+ export const preferNamedGuardPredicateRule = defineRule({
63
+ meta: {
64
+ type: "problem",
65
+ docs: {
66
+ description: "Require guards built from chained domain predicates to be extracted into a named P.Predicate and lifted through Option.liftPredicate so the guard composes and carries a name.",
67
+ },
68
+ messages: {
69
+ namedGuardPredicate: "This guard anonymously chains domain predicates. Extract a named `P.Predicate` (composed via P.and/P.or/P.not) and lift the value with `Option.liftPredicate` so the guard is reusable, testable and self-describing.",
70
+ },
71
+ },
72
+ createOnce(context) {
73
+ const checkGuard = (test, branches) => {
74
+ if (!isPredicateChain(test))
75
+ return;
76
+ if (!branches.some((branch) => containsOptionResult(branch)))
77
+ return;
78
+ context.report({ node: test, messageId: "namedGuardPredicate" });
79
+ };
80
+ return {
81
+ before() {
82
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
83
+ return false;
84
+ },
85
+ ConditionalExpression(node) {
86
+ checkGuard(node.test, [node.consequent, node.alternate]);
87
+ },
88
+ IfStatement(node) {
89
+ checkGuard(node.test, [node.consequent, node.alternate]);
90
+ },
91
+ };
92
+ },
93
+ });
@@ -0,0 +1,2 @@
1
+ /** Guard-gauntlets over Option should compose into liftPredicate/filter pipelines. */
2
+ export declare const preferOptionPipelineRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,87 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { childNodes } from "../../shared/child-nodes.js";
3
+ import { readField } from "../../shared/structural.js";
4
+ const TEST_FILE = /.(?:test|spec).[cm]?[jt]sx?$/u;
5
+ /**
6
+ * Count Option.none() returns in this function's own body. Nested scopes belong to
7
+ * themselves, and loop bodies hold algorithmic exits rather than guard scatters.
8
+ *
9
+ * @param {ESTree.Node} body - The function body to walk.
10
+ * @returns {number} Number of direct `Option.none()` return exits.
11
+ */
12
+ function countDirectNoneReturns(body) {
13
+ let count = 0;
14
+ const visit = (node) => {
15
+ if (node.type === "ArrowFunctionExpression" ||
16
+ node.type === "FunctionExpression" ||
17
+ node.type === "FunctionDeclaration")
18
+ return;
19
+ if (node.type === "ForStatement" ||
20
+ node.type === "ForInStatement" ||
21
+ node.type === "ForOfStatement" ||
22
+ node.type === "WhileStatement" ||
23
+ node.type === "DoWhileStatement") {
24
+ return;
25
+ }
26
+ if (node.type !== "ReturnStatement")
27
+ return void 0;
28
+ const argument = node.argument;
29
+ if (argument?.type === "CallExpression" &&
30
+ argument.callee.type === "MemberExpression" &&
31
+ argument.callee.object.type === "Identifier" &&
32
+ argument.callee.object.name === "Option" &&
33
+ argument.callee.property.type === "Identifier" &&
34
+ argument.callee.property.name === "none")
35
+ count += 1;
36
+ for (const child of childNodes(node))
37
+ visit(child);
38
+ };
39
+ visit(body);
40
+ return count;
41
+ }
42
+ /** Guard-gauntlets over Option should compose into liftPredicate/filter pipelines. */
43
+ export const preferOptionPipelineRule = defineRule({
44
+ meta: {
45
+ type: "problem",
46
+ docs: {
47
+ description: "Require Option-returning functions to reject through composed pipelines (named Predicates lifted via Option.liftPredicate / narrowed via Option.filter) instead of scattering multiple `return Option.none()` guard exits through the body.",
48
+ },
49
+ messages: {
50
+ preferPipeline: "This Option-returning function rejects through {{count}} scattered `Option.none()` guards. Extract named Predicates and compose them via pipe + Option.liftPredicate / Option.filter so the happy path reads as one pipeline.",
51
+ },
52
+ },
53
+ createOnce(context) {
54
+ const check = (node) => {
55
+ const returnType = node.returnType?.typeAnnotation;
56
+ if (returnType === null || returnType === undefined)
57
+ return;
58
+ if (returnType.type !== "TSTypeReference")
59
+ return;
60
+ const typeName = returnType.typeName;
61
+ const declaresOption = typeName.type === "Identifier"
62
+ ? typeName.name === "Option"
63
+ : typeName.type === "TSQualifiedName" &&
64
+ typeName.left.type === "Identifier" &&
65
+ typeName.left.name === "Option" &&
66
+ typeName.right.type === "Identifier" &&
67
+ typeName.right.name === "Option";
68
+ if (!declaresOption)
69
+ return;
70
+ if (node.body === null || node.body === undefined)
71
+ return;
72
+ const count = countDirectNoneReturns(node.body);
73
+ if (count < 2)
74
+ return;
75
+ context.report({ node, messageId: "preferPipeline", data: { count: String(count) } });
76
+ };
77
+ return {
78
+ before() {
79
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
80
+ return false;
81
+ },
82
+ ArrowFunctionExpression: check,
83
+ FunctionExpression: check,
84
+ FunctionDeclaration: check,
85
+ };
86
+ },
87
+ });
@@ -0,0 +1,2 @@
1
+ /** Hand-mapping an ordering comparison to domain values duplicates Ordering.match. */
2
+ export declare const preferOrderingMatchRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,135 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ const TEST_FILE = /.(?:test|spec).[cm]?[jt]sx?$/u;
3
+ const ORDERING_OPERATORS = new Set(["<", ">", "<=", ">=", "===", "=="]);
4
+ function isZeroLiteral(expression) {
5
+ return (expression !== null &&
6
+ expression !== undefined &&
7
+ expression.type === "Literal" &&
8
+ expression.value === 0);
9
+ }
10
+ /** Source text of the operand compared against zero, or null when this is not one.
11
+ *
12
+ * @param {{ test: ESTree.Expression; sourceText: string }} payload - The compared test and its source text.
13
+ * @returns {string | null} Source text of the non-zero side, or null.
14
+ */
15
+ function orderingZeroSubject(payload) {
16
+ const { test, sourceText } = payload;
17
+ let binary = test;
18
+ while (binary.type === "ParenthesizedExpression") {
19
+ binary = binary.expression;
20
+ }
21
+ if (binary.type !== "BinaryExpression" || !ORDERING_OPERATORS.has(binary.operator)) {
22
+ return null;
23
+ }
24
+ const slice = (expression) => sourceText.slice(expression.range?.[0] ?? 0, expression.range?.[1] ?? 0).trim();
25
+ if (isZeroLiteral(binary.right))
26
+ return slice(binary.left);
27
+ if (isZeroLiteral(binary.left))
28
+ return slice(binary.right);
29
+ return null;
30
+ }
31
+ function isSentinelValue(expression) {
32
+ if (expression === null || expression === undefined)
33
+ return false;
34
+ if (expression.type === "ParenthesizedExpression") {
35
+ return isSentinelValue(expression.expression);
36
+ }
37
+ if (expression.type === "UnaryExpression") {
38
+ return (expression.operator === "-" &&
39
+ expression.argument.type === "Literal" &&
40
+ expression.argument.value === 1);
41
+ }
42
+ return expression.type === "Literal" && (expression.value === 0 || expression.value === 1);
43
+ }
44
+ function lastReturnedValue(block) {
45
+ const statement = block.body[block.body.length - 1];
46
+ return statement !== undefined && statement.type === "ReturnStatement"
47
+ ? statement.argument
48
+ : undefined;
49
+ }
50
+ /** Hand-mapping an ordering comparison to domain values duplicates Ordering.match. */
51
+ export const preferOrderingMatchRule = defineRule({
52
+ meta: {
53
+ type: "problem",
54
+ docs: {
55
+ description: "Require ladders of conditional branches re-testing the same ordering comparison against zero to be expressed as one Ordering.match table.",
56
+ },
57
+ messages: {
58
+ preferOrderingMatch: "This ladder re-tests `{{subject}}` against zero {{links}} times to pick domain values. Replace it with a single Ordering.match({ onLessThan, onEqual, onGreaterThan }) over the comparison result so the direction mapping lives in one exhaustive table.",
59
+ },
60
+ },
61
+ createOnce(context) {
62
+ const checkChain = (tests, leaves) => {
63
+ if (tests.length < 2)
64
+ return;
65
+ if (tests.some((test) => test.subject === null))
66
+ return;
67
+ const subject = tests[0].subject;
68
+ if (tests.some((test) => test.subject !== subject))
69
+ return;
70
+ if (leaves.every((leaf) => isSentinelValue(leaf)))
71
+ return;
72
+ context.report({
73
+ node: tests[0].node,
74
+ messageId: "preferOrderingMatch",
75
+ data: { subject, links: String(tests.length) },
76
+ });
77
+ };
78
+ return {
79
+ before() {
80
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
81
+ return false;
82
+ },
83
+ ConditionalExpression(node) {
84
+ const tests = [];
85
+ const leaves = [];
86
+ let current = node;
87
+ while (current !== null && current.type === "ConditionalExpression") {
88
+ tests.push({
89
+ subject: orderingZeroSubject({ test: current.test, sourceText: context.sourceCode.text }),
90
+ node: current.test,
91
+ });
92
+ leaves.push(current.consequent);
93
+ const alternate = current.alternate;
94
+ if (alternate.type === "ConditionalExpression") {
95
+ current = alternate;
96
+ }
97
+ else {
98
+ leaves.push(alternate);
99
+ current = null;
100
+ }
101
+ }
102
+ checkChain(tests, leaves);
103
+ },
104
+ IfStatement(node) {
105
+ const tests = [];
106
+ const leaves = [];
107
+ let current = node;
108
+ while (current !== null && current.type === "IfStatement") {
109
+ tests.push({
110
+ subject: orderingZeroSubject({ test: current.test, sourceText: context.sourceCode.text }),
111
+ node: current.test,
112
+ });
113
+ const consequent = current.consequent;
114
+ leaves.push(consequent.type === "BlockStatement"
115
+ ? lastReturnedValue(consequent)
116
+ : consequent);
117
+ const alternate = current.alternate;
118
+ if (alternate === null) {
119
+ current = null;
120
+ }
121
+ else if (alternate.type === "IfStatement") {
122
+ current = alternate;
123
+ }
124
+ else {
125
+ leaves.push(alternate.type === "BlockStatement"
126
+ ? lastReturnedValue(alternate)
127
+ : alternate);
128
+ current = null;
129
+ }
130
+ }
131
+ checkChain(tests, leaves);
132
+ },
133
+ };
134
+ },
135
+ });
@@ -0,0 +1,2 @@
1
+ /** Hand-rolled _tag unions duplicate what Data.TaggedEnum gives for free. */
2
+ export declare const preferTaggedEnumRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,66 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { isRecordObject, isString } from "../../shared/structural.js";
3
+ const TEST_FILE = /.(?:test|spec).[cm]?[jt]sx?$/u;
4
+ /** Whether a type-literal member declares a literal-typed `_tag` property.
5
+ *
6
+ * @param {ESTree.Node} member - A member of a type literal.
7
+ * @returns {boolean} True when the member is `_tag` with a string literal type.
8
+ */
9
+ function hasLiteralTagProperty(member) {
10
+ if (member.type !== "TSPropertySignature")
11
+ return false;
12
+ const key = member.key;
13
+ const isTagKey = (key.type === "Identifier" && key.name === "_tag") ||
14
+ (key.type === "Literal" && key.value === "_tag");
15
+ if (!isTagKey)
16
+ return false;
17
+ const annotation = member.typeAnnotation?.typeAnnotation;
18
+ if (annotation === undefined || annotation === null || annotation.type !== "TSLiteralType") {
19
+ return false;
20
+ }
21
+ return annotation.literal.type === "Literal" && isString(annotation.literal.value);
22
+ }
23
+ /** Whether every union constituent is a type literal carrying a `_tag` property.
24
+ *
25
+ * @param {ESTree.TSType} member - One constituent of a union annotation.
26
+ * @returns {boolean} True when the member is a type literal with a `_tag`.
27
+ */
28
+ function isTaggedLiteralMember(member) {
29
+ if (member.type !== "TSTypeLiteral")
30
+ return false;
31
+ return member.members.some(hasLiteralTagProperty);
32
+ }
33
+ /** Hand-rolled _tag unions duplicate what Data.TaggedEnum gives for free. */
34
+ export const preferTaggedEnumRule = defineRule({
35
+ meta: {
36
+ type: "problem",
37
+ docs: {
38
+ description: "Require internal tagged unions to be declared with Data.TaggedEnum (constructors, $is guards and exhaustive $match) instead of hand-rolled _tag object-literal unions with manual type guards.",
39
+ },
40
+ messages: {
41
+ preferTaggedEnum: "This union hand-rolls `_tag` discrimination. Declare it as `type {{name}} = Data.TaggedEnum<{...}>` and derive constructors, `$is` guards and exhaustive `$match` via `Data.taggedEnum<{{name}}>()`, matching the rational.ts idiom.",
42
+ },
43
+ },
44
+ createOnce(context) {
45
+ return {
46
+ before() {
47
+ if (TEST_FILE.test(context.filename.replaceAll("\\", "/")))
48
+ return false;
49
+ },
50
+ TSTypeAliasDeclaration(node) {
51
+ const annotation = node.typeAnnotation;
52
+ if (annotation.type !== "TSUnionType")
53
+ return;
54
+ if (annotation.types.length < 2)
55
+ return;
56
+ if (!annotation.types.every((member) => isTaggedLiteralMember(member)))
57
+ return;
58
+ context.report({
59
+ node: node.id,
60
+ messageId: "preferTaggedEnum",
61
+ data: { name: node.id.name },
62
+ });
63
+ },
64
+ };
65
+ },
66
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Single source of truth: once a Schema exists, it is the canonical shape.
3
+ * A hand-written twin type drifts from it silently: derive the static side
4
+ * with `Schema.Type<typeof x>` so identical data can only have one declared
5
+ * form.
6
+ */
7
+ export declare const requireSchemaTypeDerivationRule: import("@oxlint/plugins").Rule;
@@ -0,0 +1,80 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ const STRUCT_PROPERTIES = new Set(["Struct", "TaggedStruct"]);
3
+ /**
4
+ * Whether an expression calls `Schema.struct`/`Schema.fields` on a schema-ish object.
5
+ *
6
+ * @param {ESTree.Expression | ESTree.SpreadElement | null} expression - The candidate call expression.
7
+ * @returns {boolean} True when the expression is a schema struct-style call.
8
+ */
9
+ function isSchemaStructCall(expression) {
10
+ if (expression === null || expression.type !== "CallExpression")
11
+ return false;
12
+ const callee = expression.callee;
13
+ if (callee.type !== "MemberExpression" || callee.computed)
14
+ return false;
15
+ if (callee.property.type !== "Identifier" || !STRUCT_PROPERTIES.has(callee.property.name))
16
+ return false;
17
+ const object = callee.object;
18
+ return (object.type === "Identifier" && /schema$/iu.test(object.name));
19
+ }
20
+ /** Fold a declared name to its stem so `RationalSchema`/`rational` and `rationalSchema` collide.
21
+ *
22
+ * @param {string} name - The declared name to fold.
23
+ * @returns {string} The case-insensitive comparison stem.
24
+ */
25
+ function normaliseName(name) {
26
+ const folded = name.replaceAll(/[^a-zA-Z0-9]/gu, "").toLowerCase();
27
+ return folded.endsWith("schema") ? folded.slice(0, -6) : folded;
28
+ }
29
+ /**
30
+ * Single source of truth: once a Schema exists, it is the canonical shape.
31
+ * A hand-written twin type drifts from it silently: derive the static side
32
+ * with `Schema.Type<typeof x>` so identical data can only have one declared
33
+ * form.
34
+ */
35
+ export const requireSchemaTypeDerivationRule = defineRule({
36
+ meta: {
37
+ type: "problem",
38
+ docs: {
39
+ description: "Require static types paired with an Effect Schema to be derived via Schema.Type<typeof schema> instead of re-declaring the shape by hand.",
40
+ },
41
+ messages: {
42
+ handWrittenTwin: "`{{name}}` re-declares the shape of `{{schema}}` by hand, giving the data two sources of truth that drift. Derive it as `Schema.Type<typeof {{schema}}>` (or rename if unrelated).",
43
+ },
44
+ },
45
+ createOnce(context) {
46
+ const schemas = new Map();
47
+ const typeAliases = new Map();
48
+ return {
49
+ VariableDeclarator(node) {
50
+ if (node.id.type !== "Identifier" || node.init === null || node.init === undefined)
51
+ return;
52
+ if (!isSchemaStructCall(node.init))
53
+ return;
54
+ schemas.set(normaliseName(node.id.name), node.id.name);
55
+ },
56
+ TSTypeAliasDeclaration(node) {
57
+ if (node.typeAnnotation.type !== "TSTypeLiteral")
58
+ return;
59
+ typeAliases.set(normaliseName(node.id.name), { node, name: node.id.name });
60
+ },
61
+ TSInterfaceDeclaration(node) {
62
+ if (node.id.type !== "Identifier")
63
+ return;
64
+ typeAliases.set(normaliseName(node.id.name), { node, name: node.id.name });
65
+ },
66
+ "Program:exit"() {
67
+ for (const [stem, alias] of typeAliases) {
68
+ const schema = schemas.get(stem);
69
+ if (schema === undefined)
70
+ continue;
71
+ context.report({
72
+ node: alias.node,
73
+ messageId: "handWrittenTwin",
74
+ data: { name: alias.name, schema },
75
+ });
76
+ }
77
+ },
78
+ };
79
+ },
80
+ });
@@ -0,0 +1,3 @@
1
+ /** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */
2
+ declare const plumbPlugin: import("@oxlint/plugins").Plugin;
3
+ export default plumbPlugin;
package/dist/index.js ADDED
@@ -0,0 +1,104 @@
1
+ import { eslintCompatPlugin } from "@oxlint/plugins";
2
+ import { preferPropertyTestsRule } from "./rules/prefer-property-tests.js";
3
+ import { noChainedTypeAssertionsRule } from "./rules/no-chained-type-assertions.js";
4
+ import { noConditionalEmptyObjectSpreadRule } from "./rules/no-conditional-empty-object-spread.js";
5
+ import { noBooleanFieldSignalsRule } from "./rules/no-boolean-field-signals.js";
6
+ import { noImpossibleBranchThrowRule } from "./rules/no-impossible-branch-throw.js";
7
+ import { noKnownValueWideningRule } from "./rules/no-known-value-widening.js";
8
+ import { noModuleMockingRule } from "./rules/no-module-mocking.js";
9
+ import { noObjectParametersRule } from "./rules/no-object-parameters.js";
10
+ import { noReinterpretCastRule } from "./rules/no-reinterpret-cast.js";
11
+ import { preferPayloadBrandRule } from "./rules/prefer-payload-brand.js";
12
+ import { noProductOfStateBooleansRule } from "./rules/no-product-of-state-booleans.js";
13
+ import { noReflectApplyRule } from "./rules/no-reflect-apply.js";
14
+ import { requireFcBlockPredicateRule } from "./rules/require-fc-block-predicate.js";
15
+ import { requireJsdocOnExportedRule } from "./rules/require-jsdoc-on-exported.js";
16
+ import { requirePublishedOrderRule } from "./rules/require-published-order.js";
17
+ import { noReflectGetRule } from "./rules/no-reflect-get.js";
18
+ import { noRuntimeTypeofRule } from "./rules/no-runtime-typeof.js";
19
+ import { noSentinelComparisonUnionRule } from "./rules/no-sentinel-comparison-union.js";
20
+ import { noStackedJsdocBlocksRule } from "./rules/no-stacked-jsdoc-blocks.js";
21
+ import { noForbiddenTermInSymbolNamesRule } from "./rules/no-shape-in-symbol-names.js";
22
+ import { noUnitReturnValidatorsRule } from "./rules/no-unit-return-validators.js";
23
+ import { noUnknownParametersRule } from "./rules/no-unknown-parameters.js";
24
+ import { noUnknownReturnsRule } from "./rules/no-unknown-returns.js";
25
+ import { noUnknownTypeAliasesRule } from "./rules/no-unknown-type-aliases.js";
26
+ import { noUnsafeDictionaryTypeRule } from "./rules/no-unsafe-dictionary-type.js";
27
+ import { noStrayInlineCommentsRule } from "./rules/no-stray-inline-comments.js";
28
+ import { noWidenThenAssertRule } from "./rules/no-widen-then-assert.js";
29
+ import { requireSafetyCommentForTypeAssertionRule } from "./rules/require-safety-comment-for-type-assertion.js";
30
+ import { requireSortComparatorRule } from "./rules/require-sort-comparator.js";
31
+ import { noGenericExportNamesRule } from "./rules/no-generic-export-names.js";
32
+ import { noBarrelExportStarRule } from "./rules/no-barrel-export-star.js";
33
+ import { requireDeprecatedTagForLegacyCommentsRule } from "./rules/require-deprecated-tag-for-legacy-comments.js";
34
+ import { noVagueTestFilenamesRule } from "./rules/no-vague-test-filenames.js";
35
+ import { noSwappablePrimitiveParamsRule } from "./rules/no-swappable-primitive-params.js";
36
+ import { noTransposedFieldReadsRule } from "./rules/no-transposed-field-reads.js";
37
+ import { noBuiltinThrowsRule } from "./rules/no-builtin-throws.js";
38
+ import { noNondeterministicCoreRule } from "./rules/no-nondeterministic-core.js";
39
+ import { noExportedMutableStateRule } from "./rules/no-exported-mutable-state.js";
40
+ import { noDuplicatedLiteralUnionRule } from "./rules/no-duplicated-literal-union.js";
41
+ import { requireCanonicalStringifyForIdentityRule } from "./rules/require-canonical-stringify-for-identity.js";
42
+ import { noAnonymousWideTuplesRule } from "./rules/no-anonymous-wide-tuples.js";
43
+ import { noTagLadderAssertionsRule } from "./rules/no-tag-ladder-assertions.js";
44
+ import { noRedundantDerivedFieldRule } from "./rules/no-redundant-derived-field.js";
45
+ import { requireExhaustiveTagSwitchRule } from "./rules/require-exhaustive-tag-switch.js";
46
+ import { noMultipleFunctionParamsRule } from "./rules/no-multiple-function-params.js";
47
+ import { noOptionalFunctionParametersRule } from "./rules/no-optional-function-parameters.js";
48
+ import { noSingleUsePrivateFunctionsRule } from "./rules/no-single-use-private-functions.js";
49
+ import { noMutableEnvironmentCaptureRule } from "./rules/no-mutable-environment-capture.js";
50
+ /** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */
51
+ const plumbPlugin = eslintCompatPlugin({
52
+ meta: { name: "plumb" },
53
+ rules: {
54
+ "no-chained-type-assertions": noChainedTypeAssertionsRule,
55
+ "no-boolean-field-signals": noBooleanFieldSignalsRule,
56
+ "no-conditional-empty-object-spread": noConditionalEmptyObjectSpreadRule,
57
+ "no-impossible-branch-throw": noImpossibleBranchThrowRule,
58
+ "no-known-value-widening": noKnownValueWideningRule,
59
+ "no-module-mocking": noModuleMockingRule,
60
+ "no-object-parameters": noObjectParametersRule,
61
+ "no-reinterpret-cast": noReinterpretCastRule,
62
+ "prefer-payload-brand": preferPayloadBrandRule,
63
+ "no-product-of-state-booleans": noProductOfStateBooleansRule,
64
+ "no-reflect-apply": noReflectApplyRule,
65
+ "require-published-order": requirePublishedOrderRule,
66
+ "no-reflect-get": noReflectGetRule,
67
+ "no-runtime-typeof": noRuntimeTypeofRule,
68
+ "no-sentinel-comparison-union": noSentinelComparisonUnionRule,
69
+ "no-stacked-jsdoc-blocks": noStackedJsdocBlocksRule,
70
+ "no-stray-inline-comments": noStrayInlineCommentsRule,
71
+ "no-unit-return-validators": noUnitReturnValidatorsRule,
72
+ "no-unsafe-dictionary-type": noUnsafeDictionaryTypeRule,
73
+ "no-shape-in-symbol-names": noForbiddenTermInSymbolNamesRule,
74
+ "no-unknown-parameters": noUnknownParametersRule,
75
+ "no-unknown-returns": noUnknownReturnsRule,
76
+ "no-unknown-type-aliases": noUnknownTypeAliasesRule,
77
+ "no-widen-then-assert": noWidenThenAssertRule,
78
+ "require-fc-block-predicate": requireFcBlockPredicateRule,
79
+ "require-jsdoc-on-exported": requireJsdocOnExportedRule,
80
+ "require-safety-comment-for-type-assertion": requireSafetyCommentForTypeAssertionRule,
81
+ "require-sort-comparator": requireSortComparatorRule,
82
+ "no-generic-export-names": noGenericExportNamesRule,
83
+ "no-barrel-export-star": noBarrelExportStarRule,
84
+ "require-deprecated-tag-for-legacy-comments": requireDeprecatedTagForLegacyCommentsRule,
85
+ "no-vague-test-filenames": noVagueTestFilenamesRule,
86
+ "no-swappable-primitive-params": noSwappablePrimitiveParamsRule,
87
+ "no-transposed-field-reads": noTransposedFieldReadsRule,
88
+ "no-builtin-throws": noBuiltinThrowsRule,
89
+ "no-nondeterministic-core": noNondeterministicCoreRule,
90
+ "no-exported-mutable-state": noExportedMutableStateRule,
91
+ "no-tag-ladder-assertions": noTagLadderAssertionsRule,
92
+ "no-anonymous-wide-tuples": noAnonymousWideTuplesRule,
93
+ "no-duplicated-literal-union": noDuplicatedLiteralUnionRule,
94
+ "require-canonical-stringify-for-identity": requireCanonicalStringifyForIdentityRule,
95
+ "no-redundant-derived-field": noRedundantDerivedFieldRule,
96
+ "require-exhaustive-tag-switch": requireExhaustiveTagSwitchRule,
97
+ "prefer-property-tests": preferPropertyTestsRule,
98
+ "no-multiple-function-params": noMultipleFunctionParamsRule,
99
+ "no-optional-function-parameters": noOptionalFunctionParametersRule,
100
+ "no-single-use-private-functions": noSingleUsePrivateFunctionsRule,
101
+ "no-mutable-environment-capture": noMutableEnvironmentCaptureRule,
102
+ },
103
+ });
104
+ export default plumbPlugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Meta-rules that keep rule authorship itself idiomatic (createOnce API, engine-native
3
+ * traversal, RuleTester suites, property-based coverage). Opt-in: only meaningful in
4
+ * lint-plugin codebases, so consumers enable `plumb-meta` deliberately.
5
+ */
6
+ declare const plumbMetaPlugin: import("@oxlint/plugins").Plugin;
7
+ export default plumbMetaPlugin;
@@ -1,25 +1,22 @@
1
1
  import { eslintCompatPlugin } from "@oxlint/plugins";
2
-
3
- import { noDisableDirectivesRule } from "./rules/no-disable-directives.ts";
4
- import { noManualAncestorWalksRule } from "./rules/no-manual-ancestor-walks.ts";
5
- import { preferBeforeFileScopeRule } from "./rules/prefer-before-file-scope.ts";
6
- import { requireCreateOnceRule } from "./rules/require-create-once.ts";
7
- import { requireRuleTesterRule } from "./rules/require-rule-tester.ts";
8
-
2
+ import { noDisableDirectivesRule } from "./rules/no-disable-directives.js";
3
+ import { noManualAncestorWalksRule } from "./rules/no-manual-ancestor-walks.js";
4
+ import { preferBeforeFileScopeRule } from "./rules/prefer-before-file-scope.js";
5
+ import { requireCreateOnceRule } from "./rules/require-create-once.js";
6
+ import { requireRuleTesterRule } from "./rules/require-rule-tester.js";
9
7
  /**
10
8
  * Meta-rules that keep rule authorship itself idiomatic (createOnce API, engine-native
11
9
  * traversal, RuleTester suites, property-based coverage). Opt-in: only meaningful in
12
10
  * lint-plugin codebases, so consumers enable `plumb-meta` deliberately.
13
11
  */
14
12
  const plumbMetaPlugin = eslintCompatPlugin({
15
- meta: { name: "plumb-meta" },
16
- rules: {
17
- "no-disable-directives": noDisableDirectivesRule,
18
- "no-manual-ancestor-walks": noManualAncestorWalksRule,
19
- "prefer-before-file-scope": preferBeforeFileScopeRule,
20
- "require-create-once": requireCreateOnceRule,
21
- "require-rule-tester": requireRuleTesterRule,
22
- },
13
+ meta: { name: "plumb-meta" },
14
+ rules: {
15
+ "no-disable-directives": noDisableDirectivesRule,
16
+ "no-manual-ancestor-walks": noManualAncestorWalksRule,
17
+ "prefer-before-file-scope": preferBeforeFileScopeRule,
18
+ "require-create-once": requireCreateOnceRule,
19
+ "require-rule-tester": requireRuleTesterRule,
20
+ },
23
21
  });
24
-
25
22
  export default plumbMetaPlugin;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Inline suppression comments hide lint failures from the exact files where
3
+ * enforcement matters most. Fix the code or scope a justified override in the
4
+ * config; do not silence rules line-by-line.
5
+ */
6
+ export declare const noDisableDirectivesRule: import("@oxlint/plugins").Rule;