eslint-plugin-runtime-cleanup 1.2.8

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 (217) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +117 -0
  4. package/dist/_internal/ast-node.d.ts +19 -0
  5. package/dist/_internal/ast-node.d.ts.map +1 -0
  6. package/dist/_internal/ast-node.js +42 -0
  7. package/dist/_internal/ast-node.js.map +1 -0
  8. package/dist/_internal/bounded-cache.d.ts +37 -0
  9. package/dist/_internal/bounded-cache.d.ts.map +1 -0
  10. package/dist/_internal/bounded-cache.js +63 -0
  11. package/dist/_internal/bounded-cache.js.map +1 -0
  12. package/dist/_internal/cycle-safe-linked-search.d.ts +48 -0
  13. package/dist/_internal/cycle-safe-linked-search.d.ts.map +1 -0
  14. package/dist/_internal/cycle-safe-linked-search.js +70 -0
  15. package/dist/_internal/cycle-safe-linked-search.js.map +1 -0
  16. package/dist/_internal/expression-boolean-memoizer.d.ts +17 -0
  17. package/dist/_internal/expression-boolean-memoizer.d.ts.map +1 -0
  18. package/dist/_internal/expression-boolean-memoizer.js +22 -0
  19. package/dist/_internal/expression-boolean-memoizer.js.map +1 -0
  20. package/dist/_internal/filter-callback.d.ts +52 -0
  21. package/dist/_internal/filter-callback.d.ts.map +1 -0
  22. package/dist/_internal/filter-callback.js +108 -0
  23. package/dist/_internal/filter-callback.js.map +1 -0
  24. package/dist/_internal/floating-resource.d.ts +29 -0
  25. package/dist/_internal/floating-resource.d.ts.map +1 -0
  26. package/dist/_internal/floating-resource.js +114 -0
  27. package/dist/_internal/floating-resource.js.map +1 -0
  28. package/dist/_internal/member-call.d.ts +53 -0
  29. package/dist/_internal/member-call.d.ts.map +1 -0
  30. package/dist/_internal/member-call.js +61 -0
  31. package/dist/_internal/member-call.js.map +1 -0
  32. package/dist/_internal/normalize-expression-text.d.ts +21 -0
  33. package/dist/_internal/normalize-expression-text.d.ts.map +1 -0
  34. package/dist/_internal/normalize-expression-text.js +186 -0
  35. package/dist/_internal/normalize-expression-text.js.map +1 -0
  36. package/dist/_internal/nullish-comparison.d.ts +44 -0
  37. package/dist/_internal/nullish-comparison.d.ts.map +1 -0
  38. package/dist/_internal/nullish-comparison.js +162 -0
  39. package/dist/_internal/nullish-comparison.js.map +1 -0
  40. package/dist/_internal/plugin-settings.d.ts +30 -0
  41. package/dist/_internal/plugin-settings.d.ts.map +1 -0
  42. package/dist/_internal/plugin-settings.js +90 -0
  43. package/dist/_internal/plugin-settings.js.map +1 -0
  44. package/dist/_internal/report-adapter.d.ts +24 -0
  45. package/dist/_internal/report-adapter.d.ts.map +1 -0
  46. package/dist/_internal/report-adapter.js +35 -0
  47. package/dist/_internal/report-adapter.js.map +1 -0
  48. package/dist/_internal/rule-catalog.d.ts +47 -0
  49. package/dist/_internal/rule-catalog.d.ts.map +1 -0
  50. package/dist/_internal/rule-catalog.js +97 -0
  51. package/dist/_internal/rule-catalog.js.map +1 -0
  52. package/dist/_internal/rule-docs-metadata.d.ts +35 -0
  53. package/dist/_internal/rule-docs-metadata.d.ts.map +1 -0
  54. package/dist/_internal/rule-docs-metadata.js +172 -0
  55. package/dist/_internal/rule-docs-metadata.js.map +1 -0
  56. package/dist/_internal/rule-docs-url.d.ts +15 -0
  57. package/dist/_internal/rule-docs-url.d.ts.map +1 -0
  58. package/dist/_internal/rule-docs-url.js +15 -0
  59. package/dist/_internal/rule-docs-url.js.map +1 -0
  60. package/dist/_internal/rules-registry.d.ts +11 -0
  61. package/dist/_internal/rules-registry.d.ts.map +1 -0
  62. package/dist/_internal/rules-registry.js +53 -0
  63. package/dist/_internal/rules-registry.js.map +1 -0
  64. package/dist/_internal/runtime-cleanup-config-references.d.ts +38 -0
  65. package/dist/_internal/runtime-cleanup-config-references.d.ts.map +1 -0
  66. package/dist/_internal/runtime-cleanup-config-references.js +78 -0
  67. package/dist/_internal/runtime-cleanup-config-references.js.map +1 -0
  68. package/dist/_internal/safe-type-operation.d.ts +89 -0
  69. package/dist/_internal/safe-type-operation.d.ts.map +1 -0
  70. package/dist/_internal/safe-type-operation.js +147 -0
  71. package/dist/_internal/safe-type-operation.js.map +1 -0
  72. package/dist/_internal/scope-variable.d.ts +17 -0
  73. package/dist/_internal/scope-variable.d.ts.map +1 -0
  74. package/dist/_internal/scope-variable.js +30 -0
  75. package/dist/_internal/scope-variable.js.map +1 -0
  76. package/dist/_internal/type-checker.d.ts +11 -0
  77. package/dist/_internal/type-checker.d.ts.map +1 -0
  78. package/dist/_internal/type-checker.js +25 -0
  79. package/dist/_internal/type-checker.js.map +1 -0
  80. package/dist/_internal/type-predicate-autofix-safety.d.ts +16 -0
  81. package/dist/_internal/type-predicate-autofix-safety.d.ts.map +1 -0
  82. package/dist/_internal/type-predicate-autofix-safety.js +54 -0
  83. package/dist/_internal/type-predicate-autofix-safety.js.map +1 -0
  84. package/dist/_internal/type-reference-node.d.ts +23 -0
  85. package/dist/_internal/type-reference-node.d.ts.map +1 -0
  86. package/dist/_internal/type-reference-node.js +41 -0
  87. package/dist/_internal/type-reference-node.js.map +1 -0
  88. package/dist/_internal/typed-rule.d.ts +91 -0
  89. package/dist/_internal/typed-rule.d.ts.map +1 -0
  90. package/dist/_internal/typed-rule.js +121 -0
  91. package/dist/_internal/typed-rule.js.map +1 -0
  92. package/dist/_internal/value-rewrite-autofix-safety.d.ts +29 -0
  93. package/dist/_internal/value-rewrite-autofix-safety.d.ts.map +1 -0
  94. package/dist/_internal/value-rewrite-autofix-safety.js +108 -0
  95. package/dist/_internal/value-rewrite-autofix-safety.js.map +1 -0
  96. package/dist/plugin.cjs +3693 -0
  97. package/dist/plugin.cjs.map +7 -0
  98. package/dist/plugin.d.cts +75 -0
  99. package/dist/plugin.d.ts +75 -0
  100. package/dist/plugin.d.ts.map +1 -0
  101. package/dist/plugin.js +223 -0
  102. package/dist/plugin.js.map +1 -0
  103. package/dist/rules/no-floating-abort-controllers.d.ts +9 -0
  104. package/dist/rules/no-floating-abort-controllers.d.ts.map +1 -0
  105. package/dist/rules/no-floating-abort-controllers.js +144 -0
  106. package/dist/rules/no-floating-abort-controllers.js.map +1 -0
  107. package/dist/rules/no-floating-audio-contexts.d.ts +9 -0
  108. package/dist/rules/no-floating-audio-contexts.d.ts.map +1 -0
  109. package/dist/rules/no-floating-audio-contexts.js +95 -0
  110. package/dist/rules/no-floating-audio-contexts.js.map +1 -0
  111. package/dist/rules/no-floating-broadcast-channels.d.ts +9 -0
  112. package/dist/rules/no-floating-broadcast-channels.d.ts.map +1 -0
  113. package/dist/rules/no-floating-broadcast-channels.js +151 -0
  114. package/dist/rules/no-floating-broadcast-channels.js.map +1 -0
  115. package/dist/rules/no-floating-child-processes.d.ts +9 -0
  116. package/dist/rules/no-floating-child-processes.d.ts.map +1 -0
  117. package/dist/rules/no-floating-child-processes.js +259 -0
  118. package/dist/rules/no-floating-child-processes.js.map +1 -0
  119. package/dist/rules/no-floating-disposable-stacks.d.ts +9 -0
  120. package/dist/rules/no-floating-disposable-stacks.d.ts.map +1 -0
  121. package/dist/rules/no-floating-disposable-stacks.js +177 -0
  122. package/dist/rules/no-floating-disposable-stacks.js.map +1 -0
  123. package/dist/rules/no-floating-file-watchers.d.ts +9 -0
  124. package/dist/rules/no-floating-file-watchers.d.ts.map +1 -0
  125. package/dist/rules/no-floating-file-watchers.js +241 -0
  126. package/dist/rules/no-floating-file-watchers.js.map +1 -0
  127. package/dist/rules/no-floating-geolocation-watches.d.ts +9 -0
  128. package/dist/rules/no-floating-geolocation-watches.d.ts.map +1 -0
  129. package/dist/rules/no-floating-geolocation-watches.js +156 -0
  130. package/dist/rules/no-floating-geolocation-watches.js.map +1 -0
  131. package/dist/rules/no-floating-infinite-animations.d.ts +9 -0
  132. package/dist/rules/no-floating-infinite-animations.d.ts.map +1 -0
  133. package/dist/rules/no-floating-infinite-animations.js +131 -0
  134. package/dist/rules/no-floating-infinite-animations.js.map +1 -0
  135. package/dist/rules/no-floating-media-streams.d.ts +9 -0
  136. package/dist/rules/no-floating-media-streams.d.ts.map +1 -0
  137. package/dist/rules/no-floating-media-streams.js +175 -0
  138. package/dist/rules/no-floating-media-streams.js.map +1 -0
  139. package/dist/rules/no-floating-message-channels.d.ts +9 -0
  140. package/dist/rules/no-floating-message-channels.d.ts.map +1 -0
  141. package/dist/rules/no-floating-message-channels.js +150 -0
  142. package/dist/rules/no-floating-message-channels.js.map +1 -0
  143. package/dist/rules/no-floating-network-connections.d.ts +9 -0
  144. package/dist/rules/no-floating-network-connections.d.ts.map +1 -0
  145. package/dist/rules/no-floating-network-connections.js +170 -0
  146. package/dist/rules/no-floating-network-connections.js.map +1 -0
  147. package/dist/rules/no-floating-object-urls.d.ts +9 -0
  148. package/dist/rules/no-floating-object-urls.d.ts.map +1 -0
  149. package/dist/rules/no-floating-object-urls.js +83 -0
  150. package/dist/rules/no-floating-object-urls.js.map +1 -0
  151. package/dist/rules/no-floating-observers.d.ts +9 -0
  152. package/dist/rules/no-floating-observers.d.ts.map +1 -0
  153. package/dist/rules/no-floating-observers.js +160 -0
  154. package/dist/rules/no-floating-observers.js.map +1 -0
  155. package/dist/rules/no-floating-servers.d.ts +9 -0
  156. package/dist/rules/no-floating-servers.d.ts.map +1 -0
  157. package/dist/rules/no-floating-servers.js +282 -0
  158. package/dist/rules/no-floating-servers.js.map +1 -0
  159. package/dist/rules/no-floating-streams.d.ts +9 -0
  160. package/dist/rules/no-floating-streams.d.ts.map +1 -0
  161. package/dist/rules/no-floating-streams.js +222 -0
  162. package/dist/rules/no-floating-streams.js.map +1 -0
  163. package/dist/rules/no-floating-timers.d.ts +9 -0
  164. package/dist/rules/no-floating-timers.d.ts.map +1 -0
  165. package/dist/rules/no-floating-timers.js +145 -0
  166. package/dist/rules/no-floating-timers.js.map +1 -0
  167. package/dist/rules/no-floating-wake-locks.d.ts +9 -0
  168. package/dist/rules/no-floating-wake-locks.d.ts.map +1 -0
  169. package/dist/rules/no-floating-wake-locks.js +159 -0
  170. package/dist/rules/no-floating-wake-locks.js.map +1 -0
  171. package/dist/rules/no-floating-web-stream-locks.d.ts +9 -0
  172. package/dist/rules/no-floating-web-stream-locks.d.ts.map +1 -0
  173. package/dist/rules/no-floating-web-stream-locks.js +87 -0
  174. package/dist/rules/no-floating-web-stream-locks.js.map +1 -0
  175. package/dist/rules/no-floating-workers.d.ts +9 -0
  176. package/dist/rules/no-floating-workers.d.ts.map +1 -0
  177. package/dist/rules/no-floating-workers.js +185 -0
  178. package/dist/rules/no-floating-workers.js.map +1 -0
  179. package/dist/rules/no-unmanaged-event-listeners.d.ts +9 -0
  180. package/dist/rules/no-unmanaged-event-listeners.d.ts.map +1 -0
  181. package/dist/rules/no-unmanaged-event-listeners.js +210 -0
  182. package/dist/rules/no-unmanaged-event-listeners.js.map +1 -0
  183. package/docs/rules/getting-started.md +29 -0
  184. package/docs/rules/guides/adoption-checklist.md +31 -0
  185. package/docs/rules/guides/preset-selection-strategy.md +24 -0
  186. package/docs/rules/guides/rollout-and-fix-safety.md +42 -0
  187. package/docs/rules/guides/snapshot-testing.md +20 -0
  188. package/docs/rules/guides/type-aware-linting-readiness.md +20 -0
  189. package/docs/rules/no-floating-abort-controllers.md +126 -0
  190. package/docs/rules/no-floating-audio-contexts.md +104 -0
  191. package/docs/rules/no-floating-broadcast-channels.md +105 -0
  192. package/docs/rules/no-floating-child-processes.md +123 -0
  193. package/docs/rules/no-floating-disposable-stacks.md +118 -0
  194. package/docs/rules/no-floating-file-watchers.md +111 -0
  195. package/docs/rules/no-floating-geolocation-watches.md +95 -0
  196. package/docs/rules/no-floating-infinite-animations.md +110 -0
  197. package/docs/rules/no-floating-media-streams.md +113 -0
  198. package/docs/rules/no-floating-message-channels.md +114 -0
  199. package/docs/rules/no-floating-network-connections.md +116 -0
  200. package/docs/rules/no-floating-object-urls.md +102 -0
  201. package/docs/rules/no-floating-observers.md +108 -0
  202. package/docs/rules/no-floating-servers.md +127 -0
  203. package/docs/rules/no-floating-streams.md +120 -0
  204. package/docs/rules/no-floating-timers.md +120 -0
  205. package/docs/rules/no-floating-wake-locks.md +109 -0
  206. package/docs/rules/no-floating-web-stream-locks.md +105 -0
  207. package/docs/rules/no-floating-workers.md +123 -0
  208. package/docs/rules/no-unmanaged-event-listeners.md +143 -0
  209. package/docs/rules/overview.md +44 -0
  210. package/docs/rules/presets/all.md +35 -0
  211. package/docs/rules/presets/experimental.md +44 -0
  212. package/docs/rules/presets/index.md +54 -0
  213. package/docs/rules/presets/minimal.md +17 -0
  214. package/docs/rules/presets/recommended-type-checked.md +43 -0
  215. package/docs/rules/presets/recommended.md +34 -0
  216. package/docs/rules/presets/strict.md +36 -0
  217. package/package.json +323 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullish-comparison.d.ts","sourceRoot":"","sources":["../../src/_internal/nullish-comparison.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD;;GAEG;AACH,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IAC9B,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC;IACxC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,EAAE,yBAAyB,CAAC;CACvC,CAAC,CAAC;AAEH,gEAAgE;AAChE,KAAK,qBAAqB,GAAG,MAAM,GAAG,WAAW,CAAC;AAElD,4DAA4D;AAC5D,KAAK,yBAAyB,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAU7D;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,2BAGjC,QAAQ,CAAC;IACR,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB,CAAC,KAAG,SAAS,QAAQ,CAAC,UAAU,EAuBhC,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GACzB,OAAO,SAAS,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,KAChD,KAAK,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAChB,CAAC;AA+J/C;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,mIAMlC,QAAQ,CAAC;IACR,gBAAgB,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACxD,yCAAyC,CAAC,EAAE,OAAO,CAAC;IACpD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,2BAA2B,EAAE,CACzB,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KACxC,OAAO,CAAC;CAChB,CAAC,KAAG,IAAI,GAAG,iBAyDX,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { AST_NODE_TYPES } from "@typescript-eslint/utils";
2
+ /** Default accepted operators for nullish comparison parsing. */
3
+ const defaultNullishComparisonOperators = [
4
+ "!=",
5
+ "!==",
6
+ "==",
7
+ "===",
8
+ ];
9
+ /**
10
+ * Flatten a logical-expression tree for one specific operator.
11
+ *
12
+ * @param options - Expression and logical operator to flatten.
13
+ *
14
+ * @returns Left-to-right list of terms participating in that operator chain.
15
+ */
16
+ export const flattenLogicalTerms = ({ expression, operator, }) => {
17
+ const flattenedTerms = [];
18
+ const pendingTerms = [expression];
19
+ while (pendingTerms.length > 0) {
20
+ const currentTerm = pendingTerms.pop();
21
+ if (!currentTerm) {
22
+ continue;
23
+ }
24
+ if (currentTerm.type === AST_NODE_TYPES.LogicalExpression &&
25
+ currentTerm.operator === operator) {
26
+ pendingTerms.push(currentTerm.right, currentTerm.left);
27
+ continue;
28
+ }
29
+ flattenedTerms.push(currentTerm);
30
+ }
31
+ return flattenedTerms;
32
+ };
33
+ const STRICT_NULLISH_TERM_COUNT = 2;
34
+ /**
35
+ * Narrow a list of expressions to an exact two-term tuple.
36
+ */
37
+ export const isExpressionPair = (terms) => terms.length === STRICT_NULLISH_TERM_COUNT;
38
+ /**
39
+ * Check whether an expression is the literal `null`.
40
+ */
41
+ const isNullLiteral = (expression) => expression.type === AST_NODE_TYPES.Literal && expression.value === null;
42
+ /**
43
+ * Check whether an expression is the string literal `"undefined"`.
44
+ */
45
+ const isUndefinedStringLiteral = (expression) => expression.type === AST_NODE_TYPES.Literal &&
46
+ expression.value === "undefined";
47
+ /**
48
+ * Check whether an expression is `typeof <identifierName>`.
49
+ */
50
+ const isTypeofIdentifierExpression = (expression, identifierName) => expression.type === AST_NODE_TYPES.UnaryExpression &&
51
+ expression.operator === "typeof" &&
52
+ expression.argument.type === AST_NODE_TYPES.Identifier &&
53
+ expression.argument.name === identifierName;
54
+ /**
55
+ * Narrow a binary-operator string to supported nullish comparison operators.
56
+ */
57
+ const isAllowedNullishComparisonOperator = (operator) => operator === "!=" ||
58
+ operator === "!==" ||
59
+ operator === "==" ||
60
+ operator === "===";
61
+ /**
62
+ * Narrow an ESTree expression-like union to regular expressions (excluding
63
+ * private identifiers).
64
+ */
65
+ const isExpressionNode = (expression) => expression.type !== AST_NODE_TYPES.PrivateIdentifier;
66
+ const getNullLiteralComparison = (left, right, operator, matchesComparedExpression) => {
67
+ if (isNullLiteral(right) &&
68
+ isExpressionNode(left) &&
69
+ matchesComparedExpression(left)) {
70
+ return {
71
+ comparedExpression: left,
72
+ kind: "null",
73
+ operator,
74
+ };
75
+ }
76
+ if (isExpressionNode(left) &&
77
+ isNullLiteral(left) &&
78
+ matchesComparedExpression(right)) {
79
+ return {
80
+ comparedExpression: right,
81
+ kind: "null",
82
+ operator,
83
+ };
84
+ }
85
+ return null;
86
+ };
87
+ const getUndefinedIdentifierComparison = (left, right, operator, matchesComparedExpression, isGlobalUndefinedIdentifier) => {
88
+ if (right.type === AST_NODE_TYPES.Identifier &&
89
+ isGlobalUndefinedIdentifier(right) &&
90
+ isExpressionNode(left) &&
91
+ matchesComparedExpression(left)) {
92
+ return {
93
+ comparedExpression: left,
94
+ kind: "undefined",
95
+ operator,
96
+ };
97
+ }
98
+ if (isExpressionNode(left) &&
99
+ left.type === AST_NODE_TYPES.Identifier &&
100
+ isGlobalUndefinedIdentifier(left) &&
101
+ matchesComparedExpression(right)) {
102
+ return {
103
+ comparedExpression: right,
104
+ kind: "undefined",
105
+ operator,
106
+ };
107
+ }
108
+ return null;
109
+ };
110
+ const getTypeofUndefinedStringComparison = (left, right, operator, comparedIdentifierName) => {
111
+ if (isExpressionNode(left) &&
112
+ isTypeofIdentifierExpression(left, comparedIdentifierName) &&
113
+ isUndefinedStringLiteral(right)) {
114
+ return {
115
+ comparedExpression: left.argument,
116
+ kind: "undefined",
117
+ operator,
118
+ };
119
+ }
120
+ if (isExpressionNode(left) &&
121
+ isTypeofIdentifierExpression(right, comparedIdentifierName) &&
122
+ isUndefinedStringLiteral(left)) {
123
+ return {
124
+ comparedExpression: right.argument,
125
+ kind: "undefined",
126
+ operator,
127
+ };
128
+ }
129
+ return null;
130
+ };
131
+ /**
132
+ * Extract a normalized nullish comparison from an expression.
133
+ */
134
+ export const getNullishComparison = ({ allowedOperators = defaultNullishComparisonOperators, allowTypeofComparedIdentifierForUndefined = false, comparedIdentifierName, expression, isGlobalUndefinedIdentifier, }) => {
135
+ if (expression.type !== AST_NODE_TYPES.BinaryExpression) {
136
+ return null;
137
+ }
138
+ if (!isAllowedNullishComparisonOperator(expression.operator)) {
139
+ return null;
140
+ }
141
+ if (allowedOperators !== defaultNullishComparisonOperators &&
142
+ !allowedOperators.includes(expression.operator)) {
143
+ return null;
144
+ }
145
+ const matchesComparedExpression = (candidateExpression) => comparedIdentifierName === undefined ||
146
+ (candidateExpression.type === AST_NODE_TYPES.Identifier &&
147
+ candidateExpression.name === comparedIdentifierName);
148
+ const nullLiteralComparison = getNullLiteralComparison(expression.left, expression.right, expression.operator, matchesComparedExpression);
149
+ if (nullLiteralComparison !== null) {
150
+ return nullLiteralComparison;
151
+ }
152
+ const undefinedIdentifierComparison = getUndefinedIdentifierComparison(expression.left, expression.right, expression.operator, matchesComparedExpression, isGlobalUndefinedIdentifier);
153
+ if (undefinedIdentifierComparison !== null) {
154
+ return undefinedIdentifierComparison;
155
+ }
156
+ if (comparedIdentifierName === undefined ||
157
+ !allowTypeofComparedIdentifierForUndefined) {
158
+ return null;
159
+ }
160
+ return getTypeofUndefinedStringComparison(expression.left, expression.right, expression.operator, comparedIdentifierName);
161
+ };
162
+ //# sourceMappingURL=nullish-comparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullish-comparison.js","sourceRoot":"","sources":["../../src/_internal/nullish-comparison.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAiB1D,iEAAiE;AACjE,MAAM,iCAAiC,GAAG;IACtC,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;CACgD,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,UAAU,EACV,QAAQ,GAIV,EAAkC,EAAE;IAClC,MAAM,cAAc,GAA0B,EAAE,CAAC;IACjD,MAAM,YAAY,GAA0B,CAAC,UAAU,CAAC,CAAC;IAEzD,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,SAAS;QACb,CAAC;QAED,IACI,WAAW,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;YACrD,WAAW,CAAC,QAAQ,KAAK,QAAQ,EACnC,CAAC;YACC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YACvD,SAAS;QACb,CAAC;QAED,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM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CAAC;IACF,IAAI,qBAAqB,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED,MAAM,6BAA6B,GAAG,gCAAgC,CAClE,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,QAAQ,EACnB,yBAAyB,EACzB,2BAA2B,CAC9B,CAAC;IACF,IAAI,6BAA6B,KAAK,IAAI,EAAE,CAAC;QACzC,OAAO,6BAA6B,CAAC;IACzC,CAAC;IAED,IACI,sBAAsB,KAAK,SAAS;QACpC,CAAC,yCAAyC,EAC5C,CAAC;QACC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,kCAAkC,CACrC,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,QAAQ,EACnB,sBAAsB,CACzB,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Parsing and memoization helpers for plugin-level runtime settings.
4
+ */
5
+ import type { TSESLint, TSESTree } from "@typescript-eslint/utils";
6
+ /**
7
+ * Normalized per-program settings consumed by fix-generation helpers.
8
+ */
9
+ interface ProgramSettings {
10
+ disableAllAutofixes: boolean;
11
+ }
12
+ /**
13
+ * Register parsed plugin settings for the current file program.
14
+ *
15
+ * @param context - Active ESLint rule context.
16
+ *
17
+ * @returns Memoized immutable settings for the context's program node.
18
+ */
19
+ export declare const registerProgramSettingsForContext: (context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>) => Readonly<ProgramSettings>;
20
+ /**
21
+ * Determine whether autofixes are globally disabled for the file containing the
22
+ * provided node.
23
+ *
24
+ * @param node - AST node used to resolve the enclosing Program.
25
+ *
26
+ * @returns `true` when fixes should be suppressed.
27
+ */
28
+ export declare const areAutofixesDisabledForNode: (node: Readonly<TSESTree.Node>) => boolean;
29
+ export {};
30
+ //# sourceMappingURL=plugin-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-settings.d.ts","sourceRoot":"","sources":["../../src/_internal/plugin-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUnE;;GAEG;AACH,UAAU,eAAe;IACrB,mBAAmB,EAAE,OAAO,CAAC;CAChC;AAmED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,GAC1C,SAAS,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,CAAC,KACpE,QAAQ,CAAC,eAAe,CAiB1B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACpC,MAAM,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAC9B,OASF,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { getProgramNode } from "./ast-node.js";
2
+ /** Top-level `settings` key for this plugin. */
3
+ const RUNTIME_CLEANUP_SETTINGS_KEY = "runtime-cleanup";
4
+ /** Flag that disables all plugin autofix behavior. */
5
+ const DISABLE_ALL_AUTOFIXES_KEY = "disableAllAutofixes";
6
+ /**
7
+ * Cache of parsed settings keyed by the Program node for the active file.
8
+ */
9
+ const settingsByProgram = new WeakMap();
10
+ /**
11
+ * Narrow an unknown value to an object-like record.
12
+ *
13
+ * @param value - Value to narrow.
14
+ *
15
+ * @returns `true` when the value is a non-null, non-array object.
16
+ */
17
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
18
+ /**
19
+ * Extract the `settings["runtime-cleanup"]` object when present and valid.
20
+ *
21
+ * @param settings - ESLint settings value from rule context.
22
+ *
23
+ * @returns Parsed plugin settings object when valid; otherwise `null`.
24
+ */
25
+ const getRuntimeCleanupSettings = (settings) => {
26
+ if (!isObject(settings)) {
27
+ return null;
28
+ }
29
+ const pluginSettings = settings[RUNTIME_CLEANUP_SETTINGS_KEY];
30
+ return isObject(pluginSettings) ? pluginSettings : null;
31
+ };
32
+ /**
33
+ * Read a strict boolean flag (`true`) from an object by key.
34
+ *
35
+ * @param object - Source settings object.
36
+ * @param key - Flag key to read.
37
+ *
38
+ * @returns `true` only when the key exists and equals literal `true`.
39
+ */
40
+ const readBooleanFlag = (object, key) => Object.hasOwn(object, key) && object[key] === true;
41
+ /**
42
+ * Reads the global autofix disable flag from plugin settings.
43
+ *
44
+ * @param settings - ESLint settings value from rule context.
45
+ *
46
+ * @returns `true` when all plugin autofixes are explicitly disabled.
47
+ */
48
+ const readDisableAllAutofixesFromSettings = (settings) => {
49
+ const pluginSettings = getRuntimeCleanupSettings(settings);
50
+ if (pluginSettings === null) {
51
+ return false;
52
+ }
53
+ return readBooleanFlag(pluginSettings, DISABLE_ALL_AUTOFIXES_KEY);
54
+ };
55
+ /**
56
+ * Register parsed plugin settings for the current file program.
57
+ *
58
+ * @param context - Active ESLint rule context.
59
+ *
60
+ * @returns Memoized immutable settings for the context's program node.
61
+ */
62
+ export const registerProgramSettingsForContext = (context) => {
63
+ const programNode = context.sourceCode.ast;
64
+ const parsedSettings = Object.freeze({
65
+ disableAllAutofixes: readDisableAllAutofixesFromSettings(context.settings),
66
+ });
67
+ const existingProgramSettings = settingsByProgram.get(programNode);
68
+ if (existingProgramSettings !== undefined) {
69
+ return existingProgramSettings;
70
+ }
71
+ settingsByProgram.set(programNode, parsedSettings);
72
+ return parsedSettings;
73
+ };
74
+ /**
75
+ * Determine whether autofixes are globally disabled for the file containing the
76
+ * provided node.
77
+ *
78
+ * @param node - AST node used to resolve the enclosing Program.
79
+ *
80
+ * @returns `true` when fixes should be suppressed.
81
+ */
82
+ export const areAutofixesDisabledForNode = (node) => {
83
+ const programNode = getProgramNode(node);
84
+ if (programNode === null) {
85
+ return false;
86
+ }
87
+ const settings = settingsByProgram.get(programNode);
88
+ return settings?.disableAllAutofixes === true;
89
+ };
90
+ //# sourceMappingURL=plugin-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-settings.js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C;AACtE,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC7C,OAAmE,EAC1C,EAAE;IAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;IAE3C,MAAM,cAAc,GAA8B,MAAM,CAAC,MAAM,CAAC;QAC5D,mBAAmB,EAAE,mCAAmC,CACpD,OAAO,CAAC,QAAQ,CACnB;KACJ,CAAC,CAAC;IAEH,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnE,IAAI,uBAAuB,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED,iBAAiB,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACvC,IAA6B,EACtB,EAAE;IACT,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEpD,OAAO,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAClD,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Explicit report-adapter utilities for rule-level autofix policy handling.
4
+ */
5
+ import type { TSESLint } from "@typescript-eslint/utils";
6
+ /**
7
+ * Report callback type for a given message/options pair.
8
+ */
9
+ type ReportCallback<MessageIds extends string, Options extends readonly unknown[]> = TSESLint.RuleContext<MessageIds, Options>["report"];
10
+ /**
11
+ * Canonical report descriptor type for a given message/options pair.
12
+ */
13
+ type ReportDescriptor<MessageIds extends string, Options extends readonly unknown[]> = Parameters<ReportCallback<MessageIds, Options>>[0];
14
+ /**
15
+ * Remove top-level autofix from a report descriptor while preserving all other
16
+ * fields (including suggestions).
17
+ */
18
+ export declare const omitAutofixFromReportDescriptor: <MessageIds extends string, Options extends readonly unknown[]>(descriptor: Readonly<ReportDescriptor<MessageIds, Options>>) => ReportDescriptor<MessageIds, Options>;
19
+ /**
20
+ * Build a report callback that enforces no-top-level-autofix semantics.
21
+ */
22
+ export declare const createReportWithoutAutofixes: <MessageIds extends string, Options extends readonly unknown[]>(report: ReportCallback<MessageIds, Options>) => ReportCallback<MessageIds, Options>;
23
+ export {};
24
+ //# sourceMappingURL=report-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-adapter.d.ts","sourceRoot":"","sources":["../../src/_internal/report-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,KAAK,cAAc,CACf,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,IAClC,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;AAExD;;GAEG;AACH,KAAK,gBAAgB,CACjB,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,IAClC,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAwBvD;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GACxC,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,EAElC,YAAY,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,KAC5D,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAYtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACpC,UAAU,SAAS,MAAM,EAAE,OAAO,SAAS,SAAS,OAAO,EAAE,EAC1D,QAAQ,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,KAC5C,cAAc,CAAC,UAAU,EAAE,OAAO,CAGpC,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Determine whether a report descriptor has a callable own data-property `fix`
3
+ * value that can be safely omitted.
4
+ */
5
+ const hasCallableOwnFixDataProperty = (descriptor) => {
6
+ const ownFixDescriptor = Object.getOwnPropertyDescriptor(descriptor, "fix");
7
+ if (ownFixDescriptor === undefined) {
8
+ return false;
9
+ }
10
+ if (!Object.hasOwn(ownFixDescriptor, "value")) {
11
+ return false;
12
+ }
13
+ return typeof ownFixDescriptor.value === "function";
14
+ };
15
+ /**
16
+ * Remove top-level autofix from a report descriptor while preserving all other
17
+ * fields (including suggestions).
18
+ */
19
+ export const omitAutofixFromReportDescriptor = (descriptor) => {
20
+ if (!hasCallableOwnFixDataProperty(descriptor)) {
21
+ return descriptor;
22
+ }
23
+ const descriptorWithoutFix = {
24
+ ...descriptor,
25
+ };
26
+ delete descriptorWithoutFix.fix;
27
+ return descriptorWithoutFix;
28
+ };
29
+ /**
30
+ * Build a report callback that enforces no-top-level-autofix semantics.
31
+ */
32
+ export const createReportWithoutAutofixes = (report) => (descriptor) => {
33
+ report(omitAutofixFromReportDescriptor(descriptor));
34
+ };
35
+ //# sourceMappingURL=report-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-adapter.js","sourceRoot":"","sources":["../../src/_internal/report-adapter.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,MAAM,6BAA6B,GAAG,CAIlC,UAA2D,EACpD,EAAE;IACT,MAAM,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC5E,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,gBAAgB,CAAC,KAAK,KAAK,UAAU,CAAC;AACxD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAI3C,UAA2D,EACtB,EAAE;IACvC,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM,oBAAoB,GAAG;QACzB,GAAG,UAAU;KAChB,CAAC;IAEF,OAAO,oBAAoB,CAAC,GAAG,CAAC;IAEhC,OAAO,oBAAoB,CAAC;AAChC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACrC,CACI,MAA2C,EACR,EAAE,CACzC,CAAC,UAAU,EAAE,EAAE;IACX,MAAM,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Stable catalog IDs for all plugin rules.
4
+ */
5
+ /**
6
+ * Catalog metadata for a single rule.
7
+ */
8
+ export type RuntimeCleanupRuleCatalogEntry = Readonly<{
9
+ ruleId: RuntimeCleanupRuleCatalogId;
10
+ ruleName: string;
11
+ ruleNumber: number;
12
+ }>;
13
+ /**
14
+ * Stable machine-friendly rule id format (for example: `R001`).
15
+ */
16
+ export type RuntimeCleanupRuleCatalogId = `R${string}`;
17
+ /**
18
+ * Canonical catalog metadata entries in stable display/order form.
19
+ */
20
+ export declare const runtimeCleanupRuleCatalogEntries: readonly RuntimeCleanupRuleCatalogEntry[];
21
+ /**
22
+ * Fast lookup map for rule catalog metadata by rule name.
23
+ */
24
+ export declare const runtimeCleanupRuleCatalogByRuleName: Readonly<Partial<Record<string, RuntimeCleanupRuleCatalogEntry>>>;
25
+ /**
26
+ * Resolve stable catalog metadata for a rule name when available.
27
+ */
28
+ export declare const getRuleCatalogEntryForRuleNameOrNull: (ruleName: string) => null | RuntimeCleanupRuleCatalogEntry;
29
+ /**
30
+ * Resolve stable catalog metadata for a rule name.
31
+ *
32
+ * @throws When the rule is missing from the catalog.
33
+ */
34
+ export declare const getRuleCatalogEntryForRuleName: (ruleName: string) => RuntimeCleanupRuleCatalogEntry;
35
+ /**
36
+ * Resolve stable catalog metadata by rule id.
37
+ */
38
+ export declare const runtimeCleanupRuleCatalogByRuleId: ReadonlyMap<RuntimeCleanupRuleCatalogId, RuntimeCleanupRuleCatalogEntry>;
39
+ /**
40
+ * Resolve stable catalog metadata for a catalog id.
41
+ */
42
+ export declare const getRuleCatalogEntryForRuleId: (ruleId: RuntimeCleanupRuleCatalogId) => RuntimeCleanupRuleCatalogEntry | undefined;
43
+ /**
44
+ * Validate that catalog IDs are unique and sequential.
45
+ */
46
+ export declare const validateRuleCatalogIntegrity: () => boolean;
47
+ //# sourceMappingURL=rule-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-catalog.d.ts","sourceRoot":"","sources":["../../src/_internal/rule-catalog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC;IAClD,MAAM,EAAE,2BAA2B,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,MAAM,EAAE,CAAC;AAqCvD;;GAEG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,8BAA8B,EAShF,CAAC;AAEP;;GAEG;AACH,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CACtD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC,CAG1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC,GAC7C,UAAU,MAAM,KACjB,IAAI,GAAG,8BAC+C,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GACvC,UAAU,MAAM,KACjB,8BAUF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,WAAW,CACvD,2BAA2B,EAC3B,8BAA8B,CAGjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACrC,QAAQ,2BAA2B,KACpC,8BAA8B,GAAG,SACa,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAO,OAsB/C,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Stable catalog IDs for all plugin rules.
4
+ */
5
+ /**
6
+ * Stable global ordering used for rule catalog IDs.
7
+ *
8
+ * @remarks
9
+ * Append new rules to preserve existing IDs once the first runtime-cleanup
10
+ * rules are added.
11
+ */
12
+ /* eslint-disable perfectionist/sort-arrays -- Catalog order is append-only so existing rule IDs remain stable. */
13
+ const orderedRuleNames = [
14
+ "no-floating-timers",
15
+ "no-unmanaged-event-listeners",
16
+ "no-floating-observers",
17
+ "no-floating-workers",
18
+ "no-floating-child-processes",
19
+ "no-floating-abort-controllers",
20
+ "no-floating-streams",
21
+ "no-floating-disposable-stacks",
22
+ "no-floating-network-connections",
23
+ "no-floating-file-watchers",
24
+ "no-floating-broadcast-channels",
25
+ "no-floating-message-channels",
26
+ "no-floating-servers",
27
+ "no-floating-geolocation-watches",
28
+ "no-floating-media-streams",
29
+ "no-floating-wake-locks",
30
+ "no-floating-object-urls",
31
+ "no-floating-audio-contexts",
32
+ "no-floating-web-stream-locks",
33
+ "no-floating-infinite-animations",
34
+ ];
35
+ /* eslint-enable perfectionist/sort-arrays -- Re-enable sorting outside the stable rule catalog. */
36
+ const toRuleCatalogId = (ruleNumber) => `R${String(ruleNumber).padStart(3, "0")}`;
37
+ /**
38
+ * Canonical catalog metadata entries in stable display/order form.
39
+ */
40
+ export const runtimeCleanupRuleCatalogEntries = orderedRuleNames.map((ruleName, index) => {
41
+ const ruleNumber = index + 1;
42
+ return {
43
+ ruleId: toRuleCatalogId(ruleNumber),
44
+ ruleName,
45
+ ruleNumber,
46
+ };
47
+ });
48
+ /**
49
+ * Fast lookup map for rule catalog metadata by rule name.
50
+ */
51
+ export const runtimeCleanupRuleCatalogByRuleName = Object.fromEntries(runtimeCleanupRuleCatalogEntries.map((entry) => [entry.ruleName, entry]));
52
+ /**
53
+ * Resolve stable catalog metadata for a rule name when available.
54
+ */
55
+ export const getRuleCatalogEntryForRuleNameOrNull = (ruleName) => runtimeCleanupRuleCatalogByRuleName[ruleName] ?? null;
56
+ /**
57
+ * Resolve stable catalog metadata for a rule name.
58
+ *
59
+ * @throws When the rule is missing from the catalog.
60
+ */
61
+ export const getRuleCatalogEntryForRuleName = (ruleName) => {
62
+ const catalogEntry = getRuleCatalogEntryForRuleNameOrNull(ruleName);
63
+ if (catalogEntry === null) {
64
+ throw new TypeError(`Rule '${ruleName}' is missing from the stable rule catalog.`);
65
+ }
66
+ return catalogEntry;
67
+ };
68
+ /**
69
+ * Resolve stable catalog metadata by rule id.
70
+ */
71
+ export const runtimeCleanupRuleCatalogByRuleId = new Map(runtimeCleanupRuleCatalogEntries.map((entry) => [entry.ruleId, entry]));
72
+ /**
73
+ * Resolve stable catalog metadata for a catalog id.
74
+ */
75
+ export const getRuleCatalogEntryForRuleId = (ruleId) => runtimeCleanupRuleCatalogByRuleId.get(ruleId);
76
+ /**
77
+ * Validate that catalog IDs are unique and sequential.
78
+ */
79
+ export const validateRuleCatalogIntegrity = () => {
80
+ const entries = runtimeCleanupRuleCatalogEntries;
81
+ const seenRuleIds = new Set();
82
+ for (const [index, entry] of entries.entries()) {
83
+ if (seenRuleIds.has(entry.ruleId)) {
84
+ return false;
85
+ }
86
+ seenRuleIds.add(entry.ruleId);
87
+ const expectedRuleNumber = index + 1;
88
+ if (entry.ruleNumber !== expectedRuleNumber) {
89
+ return false;
90
+ }
91
+ if (entry.ruleId !== toRuleCatalogId(expectedRuleNumber)) {
92
+ return false;
93
+ }
94
+ }
95
+ return true;
96
+ };
97
+ //# sourceMappingURL=rule-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-catalog.js","sourceRoot":"","sources":["../../src/_internal/rule-catalog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;;;;;GAMG;AACH,kHAAkH;AAClH,MAAM,gBAAgB,GAAG;IACrB,oBAAoB;IACpB,8BAA8B;IAC9B,uBAAuB;IACvB,qBAAqB;IACrB,6BAA6B;IAC7B,+BAA+B;IAC/B,qBAAqB;IACrB,+BAA+B;IAC/B,iCAAiC;IACjC,2BAA2B;IAC3B,gCAAgC;IAChC,8BAA8B;IAC9B,qBAAqB;IACrB,iCAAiC;IACjC,2BAA2B;IAC3B,wBAAwB;IACxB,yBAAyB;IACzB,4BAA4B;IAC5B,8BAA8B;IAC9B,iCAAiC;CACC,CAAC;AACvC,mGAAmG;AAEnG,MAAM,eAAe,GAAG,CAAC,UAAkB,EAA+B,EAAE,CACxE,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GACzC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;IACrC,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC;IAE7B,OAAO;QACH,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC;QACnC,QAAQ;QACR,UAAU;KACb,CAAC;AACN,CAAC,CAAC,CAAC;AAEP;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAE5C,MAAM,CAAC,WAAW,CAClB,gCAAgC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAC3E,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MA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,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,eAAe,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Derivation helpers for canonical rule docs metadata.
4
+ */
5
+ import type { TSESLint } from "@typescript-eslint/utils";
6
+ import { type RuntimeCleanupConfigName, type RuntimeCleanupConfigReference } from "./runtime-cleanup-config-references.js";
7
+ /** Normalized docs metadata derived for each rule. */
8
+ export type RuleDocsMetadata = Readonly<{
9
+ description: string;
10
+ recommended: boolean;
11
+ requiresTypeChecking: boolean;
12
+ ruleId: string;
13
+ ruleNumber: number;
14
+ runtimeCleanupConfigNames: readonly RuntimeCleanupConfigName[];
15
+ runtimeCleanupConfigReferences: readonly RuntimeCleanupConfigReference[];
16
+ url: string;
17
+ }>;
18
+ /** Rule-name keyed metadata map derived from static docs contracts. */
19
+ export type RuleDocsMetadataByName = Readonly<Record<string, RuleDocsMetadata>>;
20
+ /** Rule-map contract accepted by docs metadata derivation helpers. */
21
+ type RuleMap = Readonly<Record<string, TSESLint.RuleModule<string, readonly unknown[]>>>;
22
+ /**
23
+ * Derive normalized docs metadata for all plugin rules.
24
+ */
25
+ export declare const deriveRuleDocsMetadataByName: (rules: RuleMap) => RuleDocsMetadataByName;
26
+ /**
27
+ * Derive a typed-rule set from normalized docs metadata.
28
+ */
29
+ export declare const deriveTypeCheckedRuleNameSet: (ruleDocsMetadataByName: RuleDocsMetadataByName) => ReadonlySet<string>;
30
+ /**
31
+ * Derive canonical preset-membership map from normalized docs metadata.
32
+ */
33
+ export declare const deriveRulePresetMembershipByRuleName: (ruleDocsMetadataByName: RuleDocsMetadataByName) => Readonly<Record<string, readonly RuntimeCleanupConfigName[]>>;
34
+ export {};
35
+ //# sourceMappingURL=rule-docs-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-docs-metadata.d.ts","sourceRoot":"","sources":["../../src/_internal/rule-docs-metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAEH,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAErC,MAAM,wCAAwC,CAAC;AAEhD,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC/D,8BAA8B,EAAE,SAAS,6BAA6B,EAAE,CAAC;IACzE,GAAG,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CACzC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CACnC,CAAC;AAEF,sEAAsE;AACtE,KAAK,OAAO,GAAG,QAAQ,CACnB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,CAAC,CAClE,CAAC;AAmNF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACrC,OAAO,OAAO,KACf,sBA8BF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACrC,wBAAwB,sBAAsB,KAC/C,WAAW,CAAC,MAAM,CAcpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC,GAC7C,wBAAwB,sBAAsB,KAC/C,QAAQ,CACP,MAAM,CAAC,MAAM,EAAE,SAAS,wBAAwB,EAAE,CAAC,CActD,CAAC"}