oxlint-plugin-eslint 1.52.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 (305) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +36 -0
  3. package/common/ast-utils.cjs +5843 -0
  4. package/common/chunk.cjs +9 -0
  5. package/common/eslint-utils.cjs +1633 -0
  6. package/common/fix-tracker.cjs +89 -0
  7. package/common/ignore.cjs +123 -0
  8. package/common/keywords.cjs +15 -0
  9. package/common/regexpp.cjs +1720 -0
  10. package/common/regular-expressions.cjs +40 -0
  11. package/common/string-utils.cjs +39 -0
  12. package/index.js +7477 -0
  13. package/package.json +34 -0
  14. package/rules/accessor-pairs.cjs +233 -0
  15. package/rules/array-bracket-newline.cjs +172 -0
  16. package/rules/array-bracket-spacing.cjs +184 -0
  17. package/rules/array-callback-return.cjs +262 -0
  18. package/rules/array-element-newline.cjs +178 -0
  19. package/rules/arrow-body-style.cjs +135 -0
  20. package/rules/arrow-parens.cjs +130 -0
  21. package/rules/arrow-spacing.cjs +129 -0
  22. package/rules/block-scoped-var.cjs +101 -0
  23. package/rules/block-spacing.cjs +125 -0
  24. package/rules/brace-style.cjs +141 -0
  25. package/rules/callback-return.cjs +117 -0
  26. package/rules/camelcase.cjs +194 -0
  27. package/rules/capitalized-comments.cjs +168 -0
  28. package/rules/class-methods-use-this.cjs +155 -0
  29. package/rules/comma-dangle.cjs +274 -0
  30. package/rules/comma-spacing.cjs +111 -0
  31. package/rules/comma-style.cjs +180 -0
  32. package/rules/complexity.cjs +100 -0
  33. package/rules/computed-property-spacing.cjs +155 -0
  34. package/rules/consistent-return.cjs +113 -0
  35. package/rules/consistent-this.cjs +109 -0
  36. package/rules/constructor-super.cjs +207 -0
  37. package/rules/curly.cjs +173 -0
  38. package/rules/default-case-last.cjs +36 -0
  39. package/rules/default-case.cjs +50 -0
  40. package/rules/default-param-last.cjs +61 -0
  41. package/rules/dot-location.cjs +87 -0
  42. package/rules/dot-notation.cjs +77 -0
  43. package/rules/eol-last.cjs +91 -0
  44. package/rules/eqeqeq.cjs +127 -0
  45. package/rules/for-direction.cjs +94 -0
  46. package/rules/func-call-spacing.cjs +127 -0
  47. package/rules/func-name-matching.cjs +138 -0
  48. package/rules/func-names.cjs +121 -0
  49. package/rules/func-style.cjs +103 -0
  50. package/rules/function-call-argument-newline.cjs +109 -0
  51. package/rules/function-paren-newline.cjs +173 -0
  52. package/rules/generator-star-spacing.cjs +174 -0
  53. package/rules/getter-return.cjs +129 -0
  54. package/rules/global-require.cjs +84 -0
  55. package/rules/grouped-accessor-pairs.cjs +146 -0
  56. package/rules/guard-for-in.cjs +39 -0
  57. package/rules/handle-callback-err.cjs +86 -0
  58. package/rules/id-blacklist.cjs +135 -0
  59. package/rules/id-denylist.cjs +126 -0
  60. package/rules/id-length.cjs +119 -0
  61. package/rules/id-match.cjs +139 -0
  62. package/rules/implicit-arrow-linebreak.cjs +76 -0
  63. package/rules/indent-legacy.cjs +520 -0
  64. package/rules/indent.cjs +842 -0
  65. package/rules/init-declarations.cjs +88 -0
  66. package/rules/jsx-quotes.cjs +84 -0
  67. package/rules/key-spacing.cjs +399 -0
  68. package/rules/keyword-spacing.cjs +464 -0
  69. package/rules/line-comment-position.cjs +75 -0
  70. package/rules/linebreak-style.cjs +89 -0
  71. package/rules/lines-around-comment.cjs +290 -0
  72. package/rules/lines-around-directive.cjs +129 -0
  73. package/rules/lines-between-class-members.cjs +212 -0
  74. package/rules/logical-assignment-operators.cjs +305 -0
  75. package/rules/max-classes-per-file.cjs +61 -0
  76. package/rules/max-depth.cjs +117 -0
  77. package/rules/max-len.cjs +256 -0
  78. package/rules/max-lines-per-function.cjs +116 -0
  79. package/rules/max-lines.cjs +109 -0
  80. package/rules/max-nested-callbacks.cjs +78 -0
  81. package/rules/max-params.cjs +78 -0
  82. package/rules/max-statements-per-line.cjs +147 -0
  83. package/rules/max-statements.cjs +119 -0
  84. package/rules/multiline-comment-style.cjs +319 -0
  85. package/rules/multiline-ternary.cjs +106 -0
  86. package/rules/new-cap.cjs +139 -0
  87. package/rules/new-parens.cjs +70 -0
  88. package/rules/newline-after-var.cjs +159 -0
  89. package/rules/newline-before-return.cjs +128 -0
  90. package/rules/newline-per-chained-call.cjs +100 -0
  91. package/rules/no-alert.cjs +84 -0
  92. package/rules/no-array-constructor.cjs +91 -0
  93. package/rules/no-async-promise-executor.cjs +33 -0
  94. package/rules/no-await-in-loop.cjs +75 -0
  95. package/rules/no-bitwise.cjs +106 -0
  96. package/rules/no-buffer-constructor.cjs +51 -0
  97. package/rules/no-caller.cjs +34 -0
  98. package/rules/no-case-declarations.cjs +56 -0
  99. package/rules/no-catch-shadow.cjs +57 -0
  100. package/rules/no-class-assign.cjs +55 -0
  101. package/rules/no-compare-neg-zero.cjs +52 -0
  102. package/rules/no-cond-assign.cjs +104 -0
  103. package/rules/no-confusing-arrow.cjs +87 -0
  104. package/rules/no-console.cjs +138 -0
  105. package/rules/no-const-assign.cjs +50 -0
  106. package/rules/no-constant-binary-expression.cjs +284 -0
  107. package/rules/no-constant-condition.cjs +119 -0
  108. package/rules/no-constructor-return.cjs +43 -0
  109. package/rules/no-continue.cjs +33 -0
  110. package/rules/no-control-regex.cjs +74 -0
  111. package/rules/no-debugger.cjs +33 -0
  112. package/rules/no-delete-var.cjs +32 -0
  113. package/rules/no-div-regex.cjs +39 -0
  114. package/rules/no-dupe-args.cjs +61 -0
  115. package/rules/no-dupe-class-members.cjs +77 -0
  116. package/rules/no-dupe-else-if.cjs +74 -0
  117. package/rules/no-dupe-keys.cjs +88 -0
  118. package/rules/no-duplicate-case.cjs +49 -0
  119. package/rules/no-duplicate-imports.cjs +166 -0
  120. package/rules/no-else-return.cjs +182 -0
  121. package/rules/no-empty-character-class.cjs +47 -0
  122. package/rules/no-empty-function.cjs +141 -0
  123. package/rules/no-empty-pattern.cjs +50 -0
  124. package/rules/no-empty-static-block.cjs +50 -0
  125. package/rules/no-empty.cjs +78 -0
  126. package/rules/no-eq-null.cjs +34 -0
  127. package/rules/no-eval.cjs +165 -0
  128. package/rules/no-ex-assign.cjs +45 -0
  129. package/rules/no-extend-native.cjs +103 -0
  130. package/rules/no-extra-bind.cjs +127 -0
  131. package/rules/no-extra-boolean-cast.cjs +159 -0
  132. package/rules/no-extra-label.cjs +116 -0
  133. package/rules/no-extra-parens.cjs +665 -0
  134. package/rules/no-extra-semi.cjs +103 -0
  135. package/rules/no-fallthrough.cjs +136 -0
  136. package/rules/no-floating-decimal.cjs +66 -0
  137. package/rules/no-func-assign.cjs +63 -0
  138. package/rules/no-global-assign.cjs +62 -0
  139. package/rules/no-implicit-coercion.cjs +219 -0
  140. package/rules/no-implicit-globals.cjs +77 -0
  141. package/rules/no-implied-eval.cjs +87 -0
  142. package/rules/no-import-assign.cjs +123 -0
  143. package/rules/no-inline-comments.cjs +57 -0
  144. package/rules/no-inner-declarations.cjs +82 -0
  145. package/rules/no-invalid-regexp.cjs +130 -0
  146. package/rules/no-invalid-this.cjs +90 -0
  147. package/rules/no-irregular-whitespace.cjs +157 -0
  148. package/rules/no-iterator.cjs +34 -0
  149. package/rules/no-label-var.cjs +46 -0
  150. package/rules/no-labels.cjs +106 -0
  151. package/rules/no-lone-blocks.cjs +75 -0
  152. package/rules/no-lonely-if.cjs +42 -0
  153. package/rules/no-loop-func.cjs +143 -0
  154. package/rules/no-loss-of-precision.cjs +160 -0
  155. package/rules/no-magic-numbers.cjs +222 -0
  156. package/rules/no-misleading-character-class.cjs +500 -0
  157. package/rules/no-mixed-operators.cjs +197 -0
  158. package/rules/no-mixed-requires.cjs +117 -0
  159. package/rules/no-mixed-spaces-and-tabs.cjs +87 -0
  160. package/rules/no-multi-assign.cjs +38 -0
  161. package/rules/no-multi-spaces.cjs +95 -0
  162. package/rules/no-multi-str.cjs +44 -0
  163. package/rules/no-multiple-empty-lines.cjs +112 -0
  164. package/rules/no-native-reassign.cjs +72 -0
  165. package/rules/no-negated-condition.cjs +77 -0
  166. package/rules/no-negated-in-lhs.cjs +43 -0
  167. package/rules/no-nested-ternary.cjs +33 -0
  168. package/rules/no-new-func.cjs +50 -0
  169. package/rules/no-new-native-nonconstructor.cjs +42 -0
  170. package/rules/no-new-object.cjs +47 -0
  171. package/rules/no-new-require.cjs +50 -0
  172. package/rules/no-new-symbol.cjs +48 -0
  173. package/rules/no-new-wrappers.cjs +44 -0
  174. package/rules/no-new.cjs +33 -0
  175. package/rules/no-nonoctal-decimal-escape.cjs +80 -0
  176. package/rules/no-obj-calls.cjs +64 -0
  177. package/rules/no-object-constructor.cjs +69 -0
  178. package/rules/no-octal-escape.cjs +35 -0
  179. package/rules/no-octal.cjs +32 -0
  180. package/rules/no-param-reassign.cjs +135 -0
  181. package/rules/no-path-concat.cjs +52 -0
  182. package/rules/no-plusplus.cjs +64 -0
  183. package/rules/no-process-env.cjs +51 -0
  184. package/rules/no-process-exit.cjs +50 -0
  185. package/rules/no-promise-executor-return.cjs +131 -0
  186. package/rules/no-proto.cjs +34 -0
  187. package/rules/no-prototype-builtins.cjs +85 -0
  188. package/rules/no-redeclare.cjs +103 -0
  189. package/rules/no-regex-spaces.cjs +115 -0
  190. package/rules/no-restricted-exports.cjs +117 -0
  191. package/rules/no-restricted-globals.cjs +147 -0
  192. package/rules/no-restricted-imports.cjs +421 -0
  193. package/rules/no-restricted-modules.cjs +144 -0
  194. package/rules/no-restricted-properties.cjs +123 -0
  195. package/rules/no-restricted-syntax.cjs +49 -0
  196. package/rules/no-return-assign.cjs +45 -0
  197. package/rules/no-return-await.cjs +88 -0
  198. package/rules/no-script-url.cjs +49 -0
  199. package/rules/no-self-assign.cjs +88 -0
  200. package/rules/no-self-compare.cjs +53 -0
  201. package/rules/no-sequences.cjs +81 -0
  202. package/rules/no-setter-return.cjs +110 -0
  203. package/rules/no-shadow-restricted-names.cjs +60 -0
  204. package/rules/no-shadow.cjs +302 -0
  205. package/rules/no-spaced-func.cjs +69 -0
  206. package/rules/no-sparse-arrays.cjs +40 -0
  207. package/rules/no-sync.cjs +58 -0
  208. package/rules/no-tabs.cjs +73 -0
  209. package/rules/no-template-curly-in-string.cjs +33 -0
  210. package/rules/no-ternary.cjs +33 -0
  211. package/rules/no-this-before-super.cjs +177 -0
  212. package/rules/no-throw-literal.cjs +40 -0
  213. package/rules/no-trailing-spaces.cjs +123 -0
  214. package/rules/no-unassigned-vars.cjs +54 -0
  215. package/rules/no-undef-init.cjs +46 -0
  216. package/rules/no-undef.cjs +51 -0
  217. package/rules/no-undefined.cjs +58 -0
  218. package/rules/no-underscore-dangle.cjs +211 -0
  219. package/rules/no-unexpected-multiline.cjs +76 -0
  220. package/rules/no-unmodified-loop-condition.cjs +849 -0
  221. package/rules/no-unneeded-ternary.cjs +112 -0
  222. package/rules/no-unreachable-loop.cjs +128 -0
  223. package/rules/no-unreachable.cjs +195 -0
  224. package/rules/no-unsafe-finally.cjs +67 -0
  225. package/rules/no-unsafe-negation.cjs +86 -0
  226. package/rules/no-unsafe-optional-chaining.cjs +164 -0
  227. package/rules/no-unused-expressions.cjs +163 -0
  228. package/rules/no-unused-labels.cjs +97 -0
  229. package/rules/no-unused-private-class-members.cjs +69 -0
  230. package/rules/no-unused-vars.cjs +639 -0
  231. package/rules/no-use-before-define.cjs +245 -0
  232. package/rules/no-useless-assignment.cjs +250 -0
  233. package/rules/no-useless-backreference.cjs +137 -0
  234. package/rules/no-useless-call.cjs +57 -0
  235. package/rules/no-useless-catch.cjs +38 -0
  236. package/rules/no-useless-computed-key.cjs +106 -0
  237. package/rules/no-useless-concat.cjs +78 -0
  238. package/rules/no-useless-constructor.cjs +152 -0
  239. package/rules/no-useless-escape.cjs +164 -0
  240. package/rules/no-useless-rename.cjs +94 -0
  241. package/rules/no-useless-return.cjs +229 -0
  242. package/rules/no-var.cjs +235 -0
  243. package/rules/no-void.cjs +39 -0
  244. package/rules/no-warning-comments.cjs +112 -0
  245. package/rules/no-whitespace-before-property.cjs +72 -0
  246. package/rules/no-with.cjs +32 -0
  247. package/rules/nonblock-statement-body-position.cjs +107 -0
  248. package/rules/object-curly-newline.cjs +194 -0
  249. package/rules/object-curly-spacing.cjs +225 -0
  250. package/rules/object-property-newline.cjs +81 -0
  251. package/rules/object-shorthand.cjs +284 -0
  252. package/rules/one-var-declaration-per-line.cjs +75 -0
  253. package/rules/one-var.cjs +378 -0
  254. package/rules/operator-assignment.cjs +146 -0
  255. package/rules/operator-linebreak.cjs +150 -0
  256. package/rules/padded-blocks.cjs +192 -0
  257. package/rules/padding-line-between-statements.cjs +377 -0
  258. package/rules/prefer-arrow-callback.cjs +185 -0
  259. package/rules/prefer-const.cjs +240 -0
  260. package/rules/prefer-destructuring.cjs +188 -0
  261. package/rules/prefer-exponentiation-operator.cjs +100 -0
  262. package/rules/prefer-named-capture-group.cjs +111 -0
  263. package/rules/prefer-numeric-literals.cjs +75 -0
  264. package/rules/prefer-object-has-own.cjs +54 -0
  265. package/rules/prefer-object-spread.cjs +170 -0
  266. package/rules/prefer-promise-reject-errors.cjs +62 -0
  267. package/rules/prefer-reflect.cjs +100 -0
  268. package/rules/prefer-regex-literals.cjs +256 -0
  269. package/rules/prefer-rest-params.cjs +80 -0
  270. package/rules/prefer-spread.cjs +57 -0
  271. package/rules/prefer-template.cjs +147 -0
  272. package/rules/preserve-caught-error.cjs +196 -0
  273. package/rules/quote-props.cjs +224 -0
  274. package/rules/quotes.cjs +187 -0
  275. package/rules/radix.cjs +124 -0
  276. package/rules/require-atomic-updates.cjs +197 -0
  277. package/rules/require-await.cjs +90 -0
  278. package/rules/require-unicode-regexp.cjs +101 -0
  279. package/rules/require-yield.cjs +56 -0
  280. package/rules/rest-spread-spacing.cjs +99 -0
  281. package/rules/semi-spacing.cjs +215 -0
  282. package/rules/semi-style.cjs +116 -0
  283. package/rules/semi.cjs +239 -0
  284. package/rules/sort-imports.cjs +140 -0
  285. package/rules/sort-keys.cjs +165 -0
  286. package/rules/sort-vars.cjs +50 -0
  287. package/rules/space-before-blocks.cjs +132 -0
  288. package/rules/space-before-function-paren.cjs +126 -0
  289. package/rules/space-in-parens.cjs +175 -0
  290. package/rules/space-infix-ops.cjs +133 -0
  291. package/rules/space-unary-ops.cjs +237 -0
  292. package/rules/spaced-comment.cjs +233 -0
  293. package/rules/strict.cjs +206 -0
  294. package/rules/switch-colon-spacing.cjs +114 -0
  295. package/rules/symbol-description.cjs +49 -0
  296. package/rules/template-curly-spacing.cjs +112 -0
  297. package/rules/template-tag-spacing.cjs +82 -0
  298. package/rules/unicode-bom.cjs +52 -0
  299. package/rules/use-isnan.cjs +144 -0
  300. package/rules/valid-typeof.cjs +104 -0
  301. package/rules/vars-on-top.cjs +94 -0
  302. package/rules/wrap-iife.cjs +131 -0
  303. package/rules/wrap-regex.cjs +57 -0
  304. package/rules/yield-star-spacing.cjs +115 -0
  305. package/rules/yoda.cjs +185 -0
@@ -0,0 +1,849 @@
1
+ const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs");
2
+ //#region ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
3
+ var require_ms = /* @__PURE__ */ require_chunk.t(((exports, module) => {
4
+ /**
5
+ * Helpers.
6
+ */
7
+ var s = 1e3, m = s * 60, h = m * 60, d = h * 24, w = d * 7, y = d * 365.25;
8
+ /**
9
+ * Parse or format the given `val`.
10
+ *
11
+ * Options:
12
+ *
13
+ * - `long` verbose formatting [false]
14
+ *
15
+ * @param {String|Number} val
16
+ * @param {Object} [options]
17
+ * @throws {Error} throw an error if val is not a non-empty string or a number
18
+ * @return {String|Number}
19
+ * @api public
20
+ */
21
+ module.exports = function(val, options) {
22
+ options ||= {};
23
+ var type = typeof val;
24
+ if (type === "string" && val.length > 0) return parse(val);
25
+ if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
26
+ throw Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
27
+ };
28
+ /**
29
+ * Parse the given `str` and return milliseconds.
30
+ *
31
+ * @param {String} str
32
+ * @return {Number}
33
+ * @api private
34
+ */
35
+ function parse(str) {
36
+ if (str = String(str), !(str.length > 100)) {
37
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
38
+ if (match) {
39
+ var n = parseFloat(match[1]);
40
+ switch ((match[2] || "ms").toLowerCase()) {
41
+ case "years":
42
+ case "year":
43
+ case "yrs":
44
+ case "yr":
45
+ case "y": return n * y;
46
+ case "weeks":
47
+ case "week":
48
+ case "w": return n * w;
49
+ case "days":
50
+ case "day":
51
+ case "d": return n * d;
52
+ case "hours":
53
+ case "hour":
54
+ case "hrs":
55
+ case "hr":
56
+ case "h": return n * h;
57
+ case "minutes":
58
+ case "minute":
59
+ case "mins":
60
+ case "min":
61
+ case "m": return n * m;
62
+ case "seconds":
63
+ case "second":
64
+ case "secs":
65
+ case "sec":
66
+ case "s": return n * s;
67
+ case "milliseconds":
68
+ case "millisecond":
69
+ case "msecs":
70
+ case "msec":
71
+ case "ms": return n;
72
+ default: return;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ /**
78
+ * Short format for `ms`.
79
+ *
80
+ * @param {Number} ms
81
+ * @return {String}
82
+ * @api private
83
+ */
84
+ function fmtShort(ms) {
85
+ var msAbs = Math.abs(ms);
86
+ return msAbs >= d ? Math.round(ms / d) + "d" : msAbs >= h ? Math.round(ms / h) + "h" : msAbs >= m ? Math.round(ms / m) + "m" : msAbs >= s ? Math.round(ms / s) + "s" : ms + "ms";
87
+ }
88
+ /**
89
+ * Long format for `ms`.
90
+ *
91
+ * @param {Number} ms
92
+ * @return {String}
93
+ * @api private
94
+ */
95
+ function fmtLong(ms) {
96
+ var msAbs = Math.abs(ms);
97
+ return msAbs >= d ? plural(ms, msAbs, d, "day") : msAbs >= h ? plural(ms, msAbs, h, "hour") : msAbs >= m ? plural(ms, msAbs, m, "minute") : msAbs >= s ? plural(ms, msAbs, s, "second") : ms + " ms";
98
+ }
99
+ /**
100
+ * Pluralization helper.
101
+ */
102
+ function plural(ms, msAbs, n, name) {
103
+ var isPlural = msAbs >= n * 1.5;
104
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
105
+ }
106
+ })), require_common = /* @__PURE__ */ require_chunk.t(((exports, module) => {
107
+ /**
108
+ * This is the common logic for both the Node.js and web browser
109
+ * implementations of `debug()`.
110
+ */
111
+ function setup(env) {
112
+ /**
113
+ * Map of special "%n" handling functions, for the debug "format" argument.
114
+ *
115
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
116
+ */
117
+ createDebug.debug = createDebug, createDebug.default = createDebug, createDebug.coerce = coerce, createDebug.disable = disable, createDebug.enable = enable, createDebug.enabled = enabled, createDebug.humanize = require_ms(), createDebug.destroy = destroy, Object.keys(env).forEach((key) => {
118
+ createDebug[key] = env[key];
119
+ }), createDebug.names = [], createDebug.skips = [], createDebug.formatters = {};
120
+ /**
121
+ * Selects a color for a debug namespace
122
+ * @param {String} namespace The namespace string for the debug instance to be colored
123
+ * @return {Number|String} An ANSI color code for the given namespace
124
+ * @api private
125
+ */
126
+ function selectColor(namespace) {
127
+ let hash = 0;
128
+ for (let i = 0; i < namespace.length; i++) hash = (hash << 5) - hash + namespace.charCodeAt(i), hash |= 0;
129
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
130
+ }
131
+ createDebug.selectColor = selectColor;
132
+ /**
133
+ * Create a debugger with the given `namespace`.
134
+ *
135
+ * @param {String} namespace
136
+ * @return {Function}
137
+ * @api public
138
+ */
139
+ function createDebug(namespace) {
140
+ let prevTime, enableOverride = null, namespacesCache, enabledCache;
141
+ function debug(...args) {
142
+ if (!debug.enabled) return;
143
+ let self = debug, curr = Number(/* @__PURE__ */ new Date());
144
+ self.diff = curr - (prevTime || curr), self.prev = prevTime, self.curr = curr, prevTime = curr, args[0] = createDebug.coerce(args[0]), typeof args[0] != "string" && args.unshift("%O");
145
+ let index = 0;
146
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
147
+ if (match === "%%") return "%";
148
+ index++;
149
+ let formatter = createDebug.formatters[format];
150
+ if (typeof formatter == "function") {
151
+ let val = args[index];
152
+ match = formatter.call(self, val), args.splice(index, 1), index--;
153
+ }
154
+ return match;
155
+ }), createDebug.formatArgs.call(self, args), (self.log || createDebug.log).apply(self, args);
156
+ }
157
+ return debug.namespace = namespace, debug.useColors = createDebug.useColors(), debug.color = createDebug.selectColor(namespace), debug.extend = extend, debug.destroy = createDebug.destroy, Object.defineProperty(debug, "enabled", {
158
+ enumerable: !0,
159
+ configurable: !1,
160
+ get: () => enableOverride === null ? (namespacesCache !== createDebug.namespaces && (namespacesCache = createDebug.namespaces, enabledCache = createDebug.enabled(namespace)), enabledCache) : enableOverride,
161
+ set: (v) => {
162
+ enableOverride = v;
163
+ }
164
+ }), typeof createDebug.init == "function" && createDebug.init(debug), debug;
165
+ }
166
+ function extend(namespace, delimiter) {
167
+ let newDebug = createDebug(this.namespace + (delimiter === void 0 ? ":" : delimiter) + namespace);
168
+ return newDebug.log = this.log, newDebug;
169
+ }
170
+ /**
171
+ * Enables a debug mode by namespaces. This can include modes
172
+ * separated by a colon and wildcards.
173
+ *
174
+ * @param {String} namespaces
175
+ * @api public
176
+ */
177
+ function enable(namespaces) {
178
+ createDebug.save(namespaces), createDebug.namespaces = namespaces, createDebug.names = [], createDebug.skips = [];
179
+ let split = (typeof namespaces == "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
180
+ for (let ns of split) ns[0] === "-" ? createDebug.skips.push(ns.slice(1)) : createDebug.names.push(ns);
181
+ }
182
+ /**
183
+ * Checks if the given string matches a namespace template, honoring
184
+ * asterisks as wildcards.
185
+ *
186
+ * @param {String} search
187
+ * @param {String} template
188
+ * @return {Boolean}
189
+ */
190
+ function matchesTemplate(search, template) {
191
+ let searchIndex = 0, templateIndex = 0, starIndex = -1, matchIndex = 0;
192
+ for (; searchIndex < search.length;) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) template[templateIndex] === "*" ? (starIndex = templateIndex, matchIndex = searchIndex, templateIndex++) : (searchIndex++, templateIndex++);
193
+ else if (starIndex !== -1) templateIndex = starIndex + 1, matchIndex++, searchIndex = matchIndex;
194
+ else return !1;
195
+ for (; templateIndex < template.length && template[templateIndex] === "*";) templateIndex++;
196
+ return templateIndex === template.length;
197
+ }
198
+ /**
199
+ * Disable debug output.
200
+ *
201
+ * @return {String} namespaces
202
+ * @api public
203
+ */
204
+ function disable() {
205
+ let namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
206
+ return createDebug.enable(""), namespaces;
207
+ }
208
+ /**
209
+ * Returns true if the given mode name is enabled, false otherwise.
210
+ *
211
+ * @param {String} name
212
+ * @return {Boolean}
213
+ * @api public
214
+ */
215
+ function enabled(name) {
216
+ for (let skip of createDebug.skips) if (matchesTemplate(name, skip)) return !1;
217
+ for (let ns of createDebug.names) if (matchesTemplate(name, ns)) return !0;
218
+ return !1;
219
+ }
220
+ /**
221
+ * Coerce `val`.
222
+ *
223
+ * @param {Mixed} val
224
+ * @return {Mixed}
225
+ * @api private
226
+ */
227
+ function coerce(val) {
228
+ return val instanceof Error ? val.stack || val.message : val;
229
+ }
230
+ /**
231
+ * XXX DO NOT USE. This is a temporary stub function.
232
+ * XXX It WILL be removed in the next major release.
233
+ */
234
+ function destroy() {
235
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
236
+ }
237
+ return createDebug.enable(createDebug.load()), createDebug;
238
+ }
239
+ module.exports = setup;
240
+ })), require_browser = /* @__PURE__ */ require_chunk.t(((exports, module) => {
241
+ /**
242
+ * Colors.
243
+ */
244
+ exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.storage = localstorage(), exports.destroy = (() => {
245
+ let warned = !1;
246
+ return () => {
247
+ warned || (warned = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
248
+ };
249
+ })(), exports.colors = /* @__PURE__ */ "#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33".split(".");
250
+ /**
251
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
252
+ * and the Firebug extension (any Firefox version) are known
253
+ * to support "%c" CSS customizations.
254
+ *
255
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
256
+ */
257
+ function useColors() {
258
+ if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0;
259
+ if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
260
+ let m;
261
+ return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
262
+ }
263
+ /**
264
+ * Colorize log arguments if enabled.
265
+ *
266
+ * @api public
267
+ */
268
+ function formatArgs(args) {
269
+ if (args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff), !this.useColors) return;
270
+ let c = "color: " + this.color;
271
+ args.splice(1, 0, c, "color: inherit");
272
+ let index = 0, lastC = 0;
273
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
274
+ match !== "%%" && (index++, match === "%c" && (lastC = index));
275
+ }), args.splice(lastC, 0, c);
276
+ }
277
+ /**
278
+ * Invokes `console.debug()` when available.
279
+ * No-op when `console.debug` is not a "function".
280
+ * If `console.debug` is not available, falls back
281
+ * to `console.log`.
282
+ *
283
+ * @api public
284
+ */
285
+ exports.log = console.debug || console.log || (() => {});
286
+ /**
287
+ * Save `namespaces`.
288
+ *
289
+ * @param {String} namespaces
290
+ * @api private
291
+ */
292
+ function save(namespaces) {
293
+ try {
294
+ namespaces ? exports.storage.setItem("debug", namespaces) : exports.storage.removeItem("debug");
295
+ } catch {}
296
+ }
297
+ /**
298
+ * Load `namespaces`.
299
+ *
300
+ * @return {String} returns the previously persisted debug modes
301
+ * @api private
302
+ */
303
+ function load() {
304
+ let r;
305
+ try {
306
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
307
+ } catch {}
308
+ return !r && typeof process < "u" && "env" in process && (r = process.env.DEBUG), r;
309
+ }
310
+ /**
311
+ * Localstorage attempts to return the localstorage.
312
+ *
313
+ * This is necessary because safari throws
314
+ * when a user disables cookies/localstorage
315
+ * and you attempt to access it.
316
+ *
317
+ * @return {LocalStorage}
318
+ * @api private
319
+ */
320
+ function localstorage() {
321
+ try {
322
+ return localStorage;
323
+ } catch {}
324
+ }
325
+ module.exports = require_common()(exports);
326
+ let { formatters } = module.exports;
327
+ /**
328
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
329
+ */
330
+ formatters.j = function(v) {
331
+ try {
332
+ return JSON.stringify(v);
333
+ } catch (error) {
334
+ return "[UnexpectedJSONParseError]: " + error.message;
335
+ }
336
+ };
337
+ })), require_node = /* @__PURE__ */ require_chunk.t(((exports, module) => {
338
+ /**
339
+ * Module dependencies.
340
+ */
341
+ let tty = require("tty"), util = require("util");
342
+ /**
343
+ * Colors.
344
+ */
345
+ exports.init = init, exports.log = log, exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."), exports.colors = [
346
+ 6,
347
+ 2,
348
+ 3,
349
+ 4,
350
+ 5,
351
+ 1
352
+ ];
353
+ try {
354
+ let supportsColor = require("supports-color");
355
+ supportsColor && (supportsColor.stderr || supportsColor).level >= 2 && (exports.colors = [
356
+ 20,
357
+ 21,
358
+ 26,
359
+ 27,
360
+ 32,
361
+ 33,
362
+ 38,
363
+ 39,
364
+ 40,
365
+ 41,
366
+ 42,
367
+ 43,
368
+ 44,
369
+ 45,
370
+ 56,
371
+ 57,
372
+ 62,
373
+ 63,
374
+ 68,
375
+ 69,
376
+ 74,
377
+ 75,
378
+ 76,
379
+ 77,
380
+ 78,
381
+ 79,
382
+ 80,
383
+ 81,
384
+ 92,
385
+ 93,
386
+ 98,
387
+ 99,
388
+ 112,
389
+ 113,
390
+ 128,
391
+ 129,
392
+ 134,
393
+ 135,
394
+ 148,
395
+ 149,
396
+ 160,
397
+ 161,
398
+ 162,
399
+ 163,
400
+ 164,
401
+ 165,
402
+ 166,
403
+ 167,
404
+ 168,
405
+ 169,
406
+ 170,
407
+ 171,
408
+ 172,
409
+ 173,
410
+ 178,
411
+ 179,
412
+ 184,
413
+ 185,
414
+ 196,
415
+ 197,
416
+ 198,
417
+ 199,
418
+ 200,
419
+ 201,
420
+ 202,
421
+ 203,
422
+ 204,
423
+ 205,
424
+ 206,
425
+ 207,
426
+ 208,
427
+ 209,
428
+ 214,
429
+ 215,
430
+ 220,
431
+ 221
432
+ ]);
433
+ } catch {}
434
+ /**
435
+ * Build up the default `inspectOpts` object from the environment variables.
436
+ *
437
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
438
+ */
439
+ exports.inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => {
440
+ let prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase()), val = process.env[key];
441
+ return val = /^(yes|on|true|enabled)$/i.test(val) ? !0 : /^(no|off|false|disabled)$/i.test(val) ? !1 : val === "null" ? null : Number(val), obj[prop] = val, obj;
442
+ }, {});
443
+ /**
444
+ * Is stdout a TTY? Colored output is enabled when `true`.
445
+ */
446
+ function useColors() {
447
+ return "colors" in exports.inspectOpts ? !!exports.inspectOpts.colors : tty.isatty(process.stderr.fd);
448
+ }
449
+ /**
450
+ * Adds ANSI color escape codes if enabled.
451
+ *
452
+ * @api public
453
+ */
454
+ function formatArgs(args) {
455
+ let { namespace: name, useColors } = this;
456
+ if (useColors) {
457
+ let c = this.color, colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c), prefix = ` ${colorCode};1m${name} \u001B[0m`;
458
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix), args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
459
+ } else args[0] = getDate() + name + " " + args[0];
460
+ }
461
+ function getDate() {
462
+ return exports.inspectOpts.hideDate ? "" : (/* @__PURE__ */ new Date()).toISOString() + " ";
463
+ }
464
+ /**
465
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
466
+ */
467
+ function log(...args) {
468
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
469
+ }
470
+ /**
471
+ * Save `namespaces`.
472
+ *
473
+ * @param {String} namespaces
474
+ * @api private
475
+ */
476
+ function save(namespaces) {
477
+ namespaces ? process.env.DEBUG = namespaces : delete process.env.DEBUG;
478
+ }
479
+ /**
480
+ * Load `namespaces`.
481
+ *
482
+ * @return {String} returns the previously persisted debug modes
483
+ * @api private
484
+ */
485
+ function load() {
486
+ return process.env.DEBUG;
487
+ }
488
+ /**
489
+ * Init logic for `debug` instances.
490
+ *
491
+ * Create a new `inspectOpts` object in case `useColors` is set
492
+ * differently for a particular `debug` instance.
493
+ */
494
+ function init(debug) {
495
+ debug.inspectOpts = {};
496
+ let keys = Object.keys(exports.inspectOpts);
497
+ for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
498
+ }
499
+ module.exports = require_common()(exports);
500
+ let { formatters } = module.exports;
501
+ /**
502
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
503
+ */
504
+ formatters.o = function(v) {
505
+ return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
506
+ }, formatters.O = function(v) {
507
+ return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts);
508
+ };
509
+ })), require_src = /* @__PURE__ */ require_chunk.t(((exports, module) => {
510
+ /**
511
+ * Detect Electron renderer / nwjs process, which is node, but we should
512
+ * treat as a browser.
513
+ */
514
+ typeof process > "u" || process.type === "renderer" || process.browser === !0 || process.__nwjs ? module.exports = require_browser() : module.exports = require_node();
515
+ })), require_traverser = /* @__PURE__ */ require_chunk.t(((exports, module) => {
516
+ let vk = require_ast_utils$1.a(), debug = require_src()("eslint:traverser");
517
+ /**
518
+ * Do nothing.
519
+ * @returns {void}
520
+ */
521
+ function noop() {}
522
+ /**
523
+ * Check whether the given value is an ASTNode or not.
524
+ * @param {any} x The value to check.
525
+ * @returns {boolean} `true` if the value is an ASTNode.
526
+ */
527
+ function isNode(x) {
528
+ return typeof x == "object" && !!x && typeof x.type == "string";
529
+ }
530
+ /**
531
+ * Get the visitor keys of a given node.
532
+ * @param {Object} visitorKeys The map of visitor keys.
533
+ * @param {ASTNode} node The node to get their visitor keys.
534
+ * @returns {string[]} The visitor keys of the node.
535
+ */
536
+ function getVisitorKeys(visitorKeys, node) {
537
+ let keys = visitorKeys[node.type];
538
+ return keys || (keys = vk.getKeys(node), debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys)), keys;
539
+ }
540
+ module.exports = class Traverser {
541
+ constructor() {
542
+ this._current = null, this._parents = [], this._skipped = !1, this._broken = !1, this._visitorKeys = null, this._enter = null, this._leave = null;
543
+ }
544
+ /**
545
+ * Gives current node.
546
+ * @returns {ASTNode} The current node.
547
+ */
548
+ current() {
549
+ return this._current;
550
+ }
551
+ /**
552
+ * Gives a copy of the ancestor nodes.
553
+ * @returns {ASTNode[]} The ancestor nodes.
554
+ */
555
+ parents() {
556
+ return this._parents.slice(0);
557
+ }
558
+ /**
559
+ * Break the current traversal.
560
+ * @returns {void}
561
+ */
562
+ break() {
563
+ this._broken = !0;
564
+ }
565
+ /**
566
+ * Skip child nodes for the current traversal.
567
+ * @returns {void}
568
+ */
569
+ skip() {
570
+ this._skipped = !0;
571
+ }
572
+ /**
573
+ * Traverse the given AST tree.
574
+ * @param {ASTNode} node The root node to traverse.
575
+ * @param {Object} options The option object.
576
+ * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`.
577
+ * @param {Function} [options.enter=noop] The callback function which is called on entering each node.
578
+ * @param {Function} [options.leave=noop] The callback function which is called on leaving each node.
579
+ * @returns {void}
580
+ */
581
+ traverse(node, options) {
582
+ this._current = null, this._parents = [], this._skipped = !1, this._broken = !1, this._visitorKeys = options.visitorKeys || vk.KEYS, this._enter = options.enter || noop, this._leave = options.leave || noop, this._traverse(node, null);
583
+ }
584
+ /**
585
+ * Traverse the given AST tree recursively.
586
+ * @param {ASTNode} node The current node.
587
+ * @param {ASTNode|null} parent The parent node.
588
+ * @returns {void}
589
+ * @private
590
+ */
591
+ _traverse(node, parent) {
592
+ if (isNode(node)) {
593
+ if (this._current = node, this._skipped = !1, this._enter(node, parent), !this._skipped && !this._broken) {
594
+ let keys = getVisitorKeys(this._visitorKeys, node);
595
+ if (keys.length >= 1) {
596
+ this._parents.push(node);
597
+ for (let i = 0; i < keys.length && !this._broken; ++i) {
598
+ let child = node[keys[i]];
599
+ if (Array.isArray(child)) for (let j = 0; j < child.length && !this._broken; ++j) this._traverse(child[j], node);
600
+ else this._traverse(child, node);
601
+ }
602
+ this._parents.pop();
603
+ }
604
+ }
605
+ this._broken || this._leave(node, parent), this._current = parent;
606
+ }
607
+ }
608
+ /**
609
+ * Calculates the keys to use for traversal.
610
+ * @param {ASTNode} node The node to read keys from.
611
+ * @returns {string[]} An array of keys to visit on the node.
612
+ * @private
613
+ */
614
+ static getKeys(node) {
615
+ return vk.getKeys(node);
616
+ }
617
+ /**
618
+ * Traverse the given AST tree.
619
+ * @param {ASTNode} node The root node to traverse.
620
+ * @param {Object} options The option object.
621
+ * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`.
622
+ * @param {Function} [options.enter=noop] The callback function which is called on entering each node.
623
+ * @param {Function} [options.leave=noop] The callback function which is called on leaving each node.
624
+ * @returns {void}
625
+ */
626
+ static traverse(node, options) {
627
+ new Traverser().traverse(node, options);
628
+ }
629
+ /**
630
+ * The default visitor keys.
631
+ * @type {Object}
632
+ */
633
+ static get DEFAULT_VISITOR_KEYS() {
634
+ return vk.KEYS;
635
+ }
636
+ };
637
+ })), require_no_unmodified_loop_condition = /* @__PURE__ */ require_chunk.t(((exports, module) => {
638
+ let Traverser = require_traverser(), astUtils = require_ast_utils$1.t(), SENTINEL_PATTERN = /(?:(?:Call|Class|Function|Member|New|Yield)Expression|Statement|Declaration)$/u, LOOP_PATTERN = /^(?:DoWhile|For|While)Statement$/u, GROUP_PATTERN = /^(?:BinaryExpression|ConditionalExpression)$/u, SKIP_PATTERN = /^(?:ArrowFunction|Class|Function)Expression$/u, DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u;
639
+ /**
640
+ * @typedef {Object} LoopConditionInfo
641
+ * @property {eslint-scope.Reference} reference - The reference.
642
+ * @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes
643
+ * that the reference is belonging to.
644
+ * @property {Function} isInLoop - The predicate which checks a given reference
645
+ * is in this loop.
646
+ * @property {boolean} modified - The flag that the reference is modified in
647
+ * this loop.
648
+ */
649
+ /**
650
+ * Checks whether or not a given reference is a write reference.
651
+ * @param {eslint-scope.Reference} reference A reference to check.
652
+ * @returns {boolean} `true` if the reference is a write reference.
653
+ */
654
+ function isWriteReference(reference) {
655
+ if (reference.init) {
656
+ let def = reference.resolved && reference.resolved.defs[0];
657
+ if (!def || def.type !== "Variable" || def.parent.kind !== "var") return !1;
658
+ }
659
+ return reference.isWrite();
660
+ }
661
+ /**
662
+ * Checks whether or not a given loop condition info does not have the modified
663
+ * flag.
664
+ * @param {LoopConditionInfo} condition A loop condition info to check.
665
+ * @returns {boolean} `true` if the loop condition info is "unmodified".
666
+ */
667
+ function isUnmodified(condition) {
668
+ return !condition.modified;
669
+ }
670
+ /**
671
+ * Checks whether or not a given loop condition info does not have the modified
672
+ * flag and does not have the group this condition belongs to.
673
+ * @param {LoopConditionInfo} condition A loop condition info to check.
674
+ * @returns {boolean} `true` if the loop condition info is "unmodified".
675
+ */
676
+ function isUnmodifiedAndNotBelongToGroup(condition) {
677
+ return !(condition.modified || condition.group);
678
+ }
679
+ /**
680
+ * Checks whether or not a given reference is inside of a given node.
681
+ * @param {ASTNode} node A node to check.
682
+ * @param {eslint-scope.Reference} reference A reference to check.
683
+ * @returns {boolean} `true` if the reference is inside of the node.
684
+ */
685
+ function isInRange(node, reference) {
686
+ let or = node.range, ir = reference.identifier.range;
687
+ return or[0] <= ir[0] && ir[1] <= or[1];
688
+ }
689
+ /**
690
+ * Checks whether or not a given reference is inside of a loop node's condition.
691
+ * @param {ASTNode} node A node to check.
692
+ * @param {eslint-scope.Reference} reference A reference to check.
693
+ * @returns {boolean} `true` if the reference is inside of the loop node's
694
+ * condition.
695
+ */
696
+ let isInLoop = {
697
+ WhileStatement: isInRange,
698
+ DoWhileStatement: isInRange,
699
+ ForStatement(node, reference) {
700
+ return isInRange(node, reference) && !(node.init && isInRange(node.init, reference));
701
+ }
702
+ };
703
+ /**
704
+ * Gets the function which encloses a given reference.
705
+ * This supports only FunctionDeclaration.
706
+ * @param {eslint-scope.Reference} reference A reference to get.
707
+ * @returns {ASTNode|null} The function node or null.
708
+ */
709
+ function getEncloseFunctionDeclaration(reference) {
710
+ let node = reference.identifier;
711
+ for (; node;) {
712
+ if (node.type === "FunctionDeclaration") return node.id ? node : null;
713
+ node = node.parent;
714
+ }
715
+ return null;
716
+ }
717
+ /**
718
+ * Updates the "modified" flags of given loop conditions with given modifiers.
719
+ * @param {LoopConditionInfo[]} conditions The loop conditions to be updated.
720
+ * @param {eslint-scope.Reference[]} modifiers The references to update.
721
+ * @returns {void}
722
+ */
723
+ function updateModifiedFlag(conditions, modifiers) {
724
+ for (let i = 0; i < conditions.length; ++i) {
725
+ let condition = conditions[i];
726
+ for (let j = 0; !condition.modified && j < modifiers.length; ++j) {
727
+ let modifier = modifiers[j], funcNode, funcVar;
728
+ condition.modified = condition.isInLoop(modifier) || !!((funcNode = getEncloseFunctionDeclaration(modifier)) && (funcVar = astUtils.getVariableByName(modifier.from.upper, funcNode.id.name)) && funcVar.references.some(condition.isInLoop));
729
+ }
730
+ }
731
+ }
732
+ /** @type {import('../types').Rule.RuleModule} */
733
+ module.exports = {
734
+ meta: {
735
+ type: "problem",
736
+ docs: {
737
+ description: "Disallow unmodified loop conditions",
738
+ recommended: !1,
739
+ url: "https://eslint.org/docs/latest/rules/no-unmodified-loop-condition"
740
+ },
741
+ schema: [],
742
+ messages: { loopConditionNotModified: "'{{name}}' is not modified in this loop." }
743
+ },
744
+ create(context) {
745
+ let sourceCode = context.sourceCode, groupMap = null;
746
+ /**
747
+ * Reports a given condition info.
748
+ * @param {LoopConditionInfo} condition A loop condition info to report.
749
+ * @returns {void}
750
+ */
751
+ function report(condition) {
752
+ let node = condition.reference.identifier;
753
+ context.report({
754
+ node,
755
+ messageId: "loopConditionNotModified",
756
+ data: node
757
+ });
758
+ }
759
+ /**
760
+ * Registers given conditions to the group the condition belongs to.
761
+ * @param {LoopConditionInfo[]} conditions A loop condition info to
762
+ * register.
763
+ * @returns {void}
764
+ */
765
+ function registerConditionsToGroup(conditions) {
766
+ for (let i = 0; i < conditions.length; ++i) {
767
+ let condition = conditions[i];
768
+ if (condition.group) {
769
+ let group = groupMap.get(condition.group);
770
+ group || (group = [], groupMap.set(condition.group, group)), group.push(condition);
771
+ }
772
+ }
773
+ }
774
+ /**
775
+ * Reports references which are inside of unmodified groups.
776
+ * @param {LoopConditionInfo[]} conditions A loop condition info to report.
777
+ * @returns {void}
778
+ */
779
+ function checkConditionsInGroup(conditions) {
780
+ conditions.every(isUnmodified) && conditions.forEach(report);
781
+ }
782
+ /**
783
+ * Checks whether or not a given group node has any dynamic elements.
784
+ * @param {ASTNode} root A node to check.
785
+ * This node is one of BinaryExpression or ConditionalExpression.
786
+ * @returns {boolean} `true` if the node is dynamic.
787
+ */
788
+ function hasDynamicExpressions(root) {
789
+ let retv = !1;
790
+ return Traverser.traverse(root, {
791
+ visitorKeys: sourceCode.visitorKeys,
792
+ enter(node) {
793
+ DYNAMIC_PATTERN.test(node.type) ? (retv = !0, this.break()) : SKIP_PATTERN.test(node.type) && this.skip();
794
+ }
795
+ }), retv;
796
+ }
797
+ /**
798
+ * Creates the loop condition information from a given reference.
799
+ * @param {eslint-scope.Reference} reference A reference to create.
800
+ * @returns {LoopConditionInfo|null} Created loop condition info, or null.
801
+ */
802
+ function toLoopCondition(reference) {
803
+ if (reference.init) return null;
804
+ let group = null, child = reference.identifier, node = child.parent;
805
+ for (; node;) {
806
+ if (SENTINEL_PATTERN.test(node.type)) {
807
+ if (LOOP_PATTERN.test(node.type) && node.test === child) return {
808
+ reference,
809
+ group,
810
+ isInLoop: isInLoop[node.type].bind(null, node),
811
+ modified: !1
812
+ };
813
+ break;
814
+ }
815
+ if (GROUP_PATTERN.test(node.type)) {
816
+ if (hasDynamicExpressions(node)) break;
817
+ group = node;
818
+ }
819
+ child = node, node = node.parent;
820
+ }
821
+ return null;
822
+ }
823
+ /**
824
+ * Finds unmodified references which are inside of a loop condition.
825
+ * Then reports the references which are outside of groups.
826
+ * @param {eslint-scope.Variable} variable A variable to report.
827
+ * @returns {void}
828
+ */
829
+ function checkReferences(variable) {
830
+ let conditions = variable.references.map(toLoopCondition).filter(Boolean);
831
+ if (conditions.length === 0) return;
832
+ registerConditionsToGroup(conditions);
833
+ let modifiers = variable.references.filter(isWriteReference);
834
+ modifiers.length > 0 && updateModifiedFlag(conditions, modifiers), conditions.filter(isUnmodifiedAndNotBelongToGroup).forEach(report);
835
+ }
836
+ return { "Program:exit"(node) {
837
+ let queue = [sourceCode.getScope(node)];
838
+ groupMap = /* @__PURE__ */ new Map();
839
+ let scope;
840
+ for (; scope = queue.pop();) queue.push(...scope.childScopes), scope.variables.forEach(checkReferences);
841
+ groupMap.forEach(checkConditionsInGroup), groupMap = null;
842
+ } };
843
+ }
844
+ };
845
+ }));
846
+ //#endregion
847
+ //#region src-js/generated/plugin-eslint/rules/no-unmodified-loop-condition.cjs
848
+ module.exports = require_no_unmodified_loop_condition().create;
849
+ //#endregion