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,185 @@
1
+ const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs");
2
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/prefer-arrow-callback.js
3
+ /**
4
+ * @fileoverview A rule to suggest using arrow functions as callbacks.
5
+ * @author Toru Nagashima
6
+ */
7
+ var require_prefer_arrow_callback = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t();
9
+ /**
10
+ * Checks whether or not a given variable is a function name.
11
+ * @param {eslint-scope.Variable} variable A variable to check.
12
+ * @returns {boolean} `true` if the variable is a function name.
13
+ */
14
+ function isFunctionName(variable) {
15
+ return variable && variable.defs[0].type === "FunctionName";
16
+ }
17
+ /**
18
+ * Checks whether or not a given MetaProperty node equals to a given value.
19
+ * @param {ASTNode} node A MetaProperty node to check.
20
+ * @param {string} metaName The name of `MetaProperty.meta`.
21
+ * @param {string} propertyName The name of `MetaProperty.property`.
22
+ * @returns {boolean} `true` if the node is the specific value.
23
+ */
24
+ function checkMetaProperty(node, metaName, propertyName) {
25
+ return node.meta.name === metaName && node.property.name === propertyName;
26
+ }
27
+ /**
28
+ * Gets the variable object of `arguments` which is defined implicitly.
29
+ * @param {eslint-scope.Scope} scope A scope to get.
30
+ * @returns {eslint-scope.Variable} The found variable object.
31
+ */
32
+ function getVariableOfArguments(scope) {
33
+ let variables = scope.variables;
34
+ for (let i = 0; i < variables.length; ++i) {
35
+ let variable = variables[i];
36
+ if (variable.name === "arguments") return variable.identifiers.length === 0 ? variable : null;
37
+ }
38
+ /* c8 ignore next */
39
+ return null;
40
+ }
41
+ /**
42
+ * Checks whether or not a given node is a callback.
43
+ * @param {ASTNode} node A node to check.
44
+ * @throws {Error} (Unreachable.)
45
+ * @returns {Object}
46
+ * {boolean} retv.isCallback - `true` if the node is a callback.
47
+ * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`.
48
+ */
49
+ function getCallbackInfo(node) {
50
+ let retv = {
51
+ isCallback: !1,
52
+ isLexicalThis: !1
53
+ }, currentNode = node, parent = node.parent, bound = !1;
54
+ for (; currentNode;) {
55
+ switch (parent.type) {
56
+ case "LogicalExpression":
57
+ case "ChainExpression":
58
+ case "ConditionalExpression": break;
59
+ case "MemberExpression":
60
+ if (parent.object === currentNode && !parent.property.computed && parent.property.type === "Identifier" && parent.property.name === "bind") {
61
+ let maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent;
62
+ if (astUtils.isCallee(maybeCallee)) bound || (bound = !0, retv.isLexicalThis = maybeCallee.parent.arguments.length === 1 && maybeCallee.parent.arguments[0].type === "ThisExpression"), parent = maybeCallee.parent;
63
+ else return retv;
64
+ } else return retv;
65
+ break;
66
+ case "CallExpression":
67
+ case "NewExpression": return parent.callee !== currentNode && (retv.isCallback = !0), retv;
68
+ default: return retv;
69
+ }
70
+ currentNode = parent, parent = parent.parent;
71
+ }
72
+ /* c8 ignore next */
73
+ throw Error("unreachable");
74
+ }
75
+ /**
76
+ * Checks whether a simple list of parameters contains any duplicates. This does not handle complex
77
+ * parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate
78
+ * parameter names anyway. Instead, it always returns `false` for complex parameter lists.
79
+ * @param {ASTNode[]} paramsList The list of parameters for a function
80
+ * @returns {boolean} `true` if the list of parameters contains any duplicates
81
+ */
82
+ function hasDuplicateParams(paramsList) {
83
+ return paramsList.every((param) => param.type === "Identifier") && paramsList.length !== new Set(paramsList.map((param) => param.name)).size;
84
+ }
85
+ /** @type {import('../types').Rule.RuleModule} */
86
+ module.exports = {
87
+ meta: {
88
+ type: "suggestion",
89
+ dialects: ["javascript", "typescript"],
90
+ language: "javascript",
91
+ defaultOptions: [{
92
+ allowNamedFunctions: !1,
93
+ allowUnboundThis: !0
94
+ }],
95
+ docs: {
96
+ description: "Require using arrow functions for callbacks",
97
+ recommended: !1,
98
+ frozen: !0,
99
+ url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback"
100
+ },
101
+ schema: [{
102
+ type: "object",
103
+ properties: {
104
+ allowNamedFunctions: { type: "boolean" },
105
+ allowUnboundThis: { type: "boolean" }
106
+ },
107
+ additionalProperties: !1
108
+ }],
109
+ fixable: "code",
110
+ messages: { preferArrowCallback: "Unexpected function expression." }
111
+ },
112
+ create(context) {
113
+ let [{ allowNamedFunctions, allowUnboundThis }] = context.options, sourceCode = context.sourceCode, stack = [];
114
+ /**
115
+ * Pushes new function scope with all `false` flags.
116
+ * @returns {void}
117
+ */
118
+ function enterScope() {
119
+ stack.push({
120
+ this: !1,
121
+ super: !1,
122
+ meta: !1
123
+ });
124
+ }
125
+ /**
126
+ * Pops a function scope from the stack.
127
+ * @returns {{this: boolean, super: boolean, meta: boolean}} The information of the last scope.
128
+ */
129
+ function exitScope() {
130
+ return stack.pop();
131
+ }
132
+ return {
133
+ Program() {
134
+ stack = [];
135
+ },
136
+ ThisExpression() {
137
+ let info = stack.at(-1);
138
+ info && (info.this = !0);
139
+ },
140
+ Super() {
141
+ let info = stack.at(-1);
142
+ info && (info.super = !0);
143
+ },
144
+ MetaProperty(node) {
145
+ let info = stack.at(-1);
146
+ info && checkMetaProperty(node, "new", "target") && (info.meta = !0);
147
+ },
148
+ FunctionDeclaration: enterScope,
149
+ "FunctionDeclaration:exit": exitScope,
150
+ FunctionExpression: enterScope,
151
+ "FunctionExpression:exit"(node) {
152
+ let scopeInfo = exitScope();
153
+ if (allowNamedFunctions && node.id && node.id.name || node.generator) return;
154
+ let nameVar = sourceCode.getDeclaredVariables(node)[0];
155
+ if (isFunctionName(nameVar) && nameVar.references.length > 0) return;
156
+ let variable = getVariableOfArguments(sourceCode.getScope(node));
157
+ if (variable && variable.references.length > 0) return;
158
+ let callbackInfo = getCallbackInfo(node);
159
+ callbackInfo.isCallback && (!allowUnboundThis || !scopeInfo.this || callbackInfo.isLexicalThis) && !scopeInfo.super && !scopeInfo.meta && context.report({
160
+ node,
161
+ messageId: "preferArrowCallback",
162
+ *fix(fixer) {
163
+ if (!callbackInfo.isLexicalThis && scopeInfo.this || hasDuplicateParams(node.params) || node.params.length && node.params[0].name === "this") return;
164
+ if (callbackInfo.isLexicalThis) {
165
+ let memberNode = node.parent;
166
+ if (memberNode.type !== "MemberExpression") return;
167
+ let callNode = memberNode.parent, firstTokenToRemove = sourceCode.getTokenAfter(memberNode.object, astUtils.isNotClosingParenToken), lastTokenToRemove = sourceCode.getLastToken(callNode);
168
+ if (astUtils.isParenthesised(sourceCode, memberNode) || sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) return;
169
+ yield fixer.removeRange([firstTokenToRemove.range[0], lastTokenToRemove.range[1]]);
170
+ }
171
+ let functionToken = sourceCode.getFirstToken(node, node.async ? 1 : 0), leftParenToken = sourceCode.getTokenAfter(functionToken, astUtils.isOpeningParenToken), tokenBeforeBody = sourceCode.getTokenBefore(node.body);
172
+ sourceCode.commentsExistBetween(functionToken, leftParenToken) ? (yield fixer.remove(functionToken), node.id && (yield fixer.remove(node.id))) : yield fixer.removeRange([functionToken.range[0], leftParenToken.range[0]]), yield fixer.insertTextAfter(tokenBeforeBody, " =>");
173
+ let replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node;
174
+ replacedNode.type === "ChainExpression" && (replacedNode = replacedNode.parent), replacedNode.parent.type !== "CallExpression" && replacedNode.parent.type !== "ConditionalExpression" && !astUtils.isParenthesised(sourceCode, replacedNode) && !astUtils.isParenthesised(sourceCode, node) && (yield fixer.insertTextBefore(replacedNode, "("), yield fixer.insertTextAfter(replacedNode, ")"));
175
+ }
176
+ });
177
+ }
178
+ };
179
+ }
180
+ };
181
+ }));
182
+ //#endregion
183
+ //#region src-js/generated/plugin-eslint/rules/prefer-arrow-callback.cjs
184
+ module.exports = require_prefer_arrow_callback().create;
185
+ //#endregion
@@ -0,0 +1,240 @@
1
+ const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs"), require_fix_tracker$1 = require("../common/fix-tracker.cjs");
2
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/prefer-const.js
3
+ /**
4
+ * @fileoverview A rule to suggest using of const declaration for variables that are never reassigned after declared.
5
+ * @author Toru Nagashima
6
+ */
7
+ var require_prefer_const = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let FixTracker = require_fix_tracker$1.t(), astUtils = require_ast_utils$1.t(), PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u, DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u, DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u;
9
+ /**
10
+ * Checks whether a given node is located at `ForStatement.init` or not.
11
+ * @param {ASTNode} node A node to check.
12
+ * @returns {boolean} `true` if the node is located at `ForStatement.init`.
13
+ */
14
+ function isInitOfForStatement(node) {
15
+ return node.parent.type === "ForStatement" && node.parent.init === node;
16
+ }
17
+ /**
18
+ * Checks whether a given Identifier node becomes a VariableDeclaration or not.
19
+ * @param {ASTNode} identifier An Identifier node to check.
20
+ * @returns {boolean} `true` if the node can become a VariableDeclaration.
21
+ */
22
+ function canBecomeVariableDeclaration(identifier) {
23
+ let node = identifier.parent;
24
+ for (; PATTERN_TYPE.test(node.type);) node = node.parent;
25
+ return node.type === "VariableDeclarator" || node.type === "AssignmentExpression" && node.parent.type === "ExpressionStatement" && DECLARATION_HOST_TYPE.test(node.parent.parent.type);
26
+ }
27
+ /**
28
+ * Checks if an property or element is from outer scope or function parameters
29
+ * in destructing pattern.
30
+ * @param {string} name A variable name to be checked.
31
+ * @param {eslint-scope.Scope} initScope A scope to start find.
32
+ * @returns {boolean} Indicates if the variable is from outer scope or function parameters.
33
+ */
34
+ function isOuterVariableInDestructing(name, initScope) {
35
+ if (initScope.through.some((ref) => ref.resolved && ref.resolved.name === name)) return !0;
36
+ let variable = astUtils.getVariableByName(initScope, name);
37
+ return variable === null ? !1 : variable.defs.some((def) => def.type === "Parameter");
38
+ }
39
+ /**
40
+ * Gets the VariableDeclarator/AssignmentExpression node that a given reference
41
+ * belongs to.
42
+ * This is used to detect a mix of reassigned and never reassigned in a
43
+ * destructuring.
44
+ * @param {eslint-scope.Reference} reference A reference to get.
45
+ * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
46
+ * null.
47
+ */
48
+ function getDestructuringHost(reference) {
49
+ if (!reference.isWrite()) return null;
50
+ let node = reference.identifier.parent;
51
+ for (; PATTERN_TYPE.test(node.type);) node = node.parent;
52
+ return DESTRUCTURING_HOST_TYPE.test(node.type) ? node : null;
53
+ }
54
+ /**
55
+ * Determines if a destructuring assignment node contains
56
+ * any MemberExpression nodes. This is used to determine if a
57
+ * variable that is only written once using destructuring can be
58
+ * safely converted into a const declaration.
59
+ * @param {ASTNode} node The ObjectPattern or ArrayPattern node to check.
60
+ * @returns {boolean} True if the destructuring pattern contains
61
+ * a MemberExpression, false if not.
62
+ */
63
+ function hasMemberExpressionAssignment(node) {
64
+ switch (node.type) {
65
+ case "ObjectPattern": return node.properties.some((prop) => prop ? hasMemberExpressionAssignment(prop.argument || prop.value) : !1);
66
+ case "ArrayPattern": return node.elements.some((element) => element ? hasMemberExpressionAssignment(element) : !1);
67
+ case "AssignmentPattern": return hasMemberExpressionAssignment(node.left);
68
+ case "MemberExpression": return !0;
69
+ }
70
+ return !1;
71
+ }
72
+ /**
73
+ * Gets an identifier node of a given variable.
74
+ *
75
+ * If the initialization exists or one or more reading references exist before
76
+ * the first assignment, the identifier node is the node of the declaration.
77
+ * Otherwise, the identifier node is the node of the first assignment.
78
+ *
79
+ * If the variable should not change to const, this function returns null.
80
+ * - If the variable is reassigned.
81
+ * - If the variable is never initialized nor assigned.
82
+ * - If the variable is initialized in a different scope from the declaration.
83
+ * - If the unique assignment of the variable cannot change to a declaration.
84
+ * e.g. `if (a) b = 1` / `return (b = 1)`
85
+ * - If the variable is declared in the global scope and `eslintUsed` is `true`.
86
+ * `/*exported foo` directive comment makes such variables. This rule does not
87
+ * warn such variables because this rule cannot distinguish whether the
88
+ * exported variables are reassigned or not.
89
+ * @param {eslint-scope.Variable} variable A variable to get.
90
+ * @param {boolean} ignoreReadBeforeAssign
91
+ * The value of `ignoreReadBeforeAssign` option.
92
+ * @returns {ASTNode|null}
93
+ * An Identifier node if the variable should change to const.
94
+ * Otherwise, null.
95
+ */
96
+ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
97
+ if (variable.eslintUsed && variable.scope.type === "global") return null;
98
+ let writer = null, isReadBeforeInit = !1, references = variable.references;
99
+ for (let i = 0; i < references.length; ++i) {
100
+ let reference = references[i];
101
+ if (reference.isWrite()) {
102
+ if (writer !== null && writer.identifier !== reference.identifier) return null;
103
+ let destructuringHost = getDestructuringHost(reference);
104
+ if (destructuringHost !== null && destructuringHost.left !== void 0) {
105
+ let leftNode = destructuringHost.left, hasOuterVariables = !1, hasNonIdentifiers = !1;
106
+ if (leftNode.type === "ObjectPattern" ? (hasOuterVariables = leftNode.properties.filter((prop) => prop.value).map((prop) => prop.value.name).some((name) => isOuterVariableInDestructing(name, variable.scope)), hasNonIdentifiers = hasMemberExpressionAssignment(leftNode)) : leftNode.type === "ArrayPattern" && (hasOuterVariables = leftNode.elements.map((element) => element && element.name).some((name) => isOuterVariableInDestructing(name, variable.scope)), hasNonIdentifiers = hasMemberExpressionAssignment(leftNode)), hasOuterVariables || hasNonIdentifiers) return null;
107
+ }
108
+ writer = reference;
109
+ } else if (reference.isRead() && writer === null) {
110
+ if (ignoreReadBeforeAssign) return null;
111
+ isReadBeforeInit = !0;
112
+ }
113
+ }
114
+ return writer !== null && writer.from === variable.scope && canBecomeVariableDeclaration(writer.identifier) ? isReadBeforeInit ? variable.defs[0].name : writer.identifier : null;
115
+ }
116
+ /**
117
+ * Groups by the VariableDeclarator/AssignmentExpression node that each
118
+ * reference of given variables belongs to.
119
+ * This is used to detect a mix of reassigned and never reassigned in a
120
+ * destructuring.
121
+ * @param {eslint-scope.Variable[]} variables Variables to group by destructuring.
122
+ * @param {boolean} ignoreReadBeforeAssign
123
+ * The value of `ignoreReadBeforeAssign` option.
124
+ * @returns {Map<ASTNode, ASTNode[]>} Grouped identifier nodes.
125
+ */
126
+ function groupByDestructuring(variables, ignoreReadBeforeAssign) {
127
+ let identifierMap = /* @__PURE__ */ new Map();
128
+ for (let i = 0; i < variables.length; ++i) {
129
+ let variable = variables[i], references = variable.references, identifier = getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign), prevId = null;
130
+ for (let j = 0; j < references.length; ++j) {
131
+ let reference = references[j], id = reference.identifier;
132
+ if (id === prevId) continue;
133
+ prevId = id;
134
+ let group = getDestructuringHost(reference);
135
+ group && (identifierMap.has(group) ? identifierMap.get(group).push(identifier) : identifierMap.set(group, [identifier]));
136
+ }
137
+ }
138
+ return identifierMap;
139
+ }
140
+ /**
141
+ * Finds the nearest parent of node with a given type.
142
+ * @param {ASTNode} node The node to search from.
143
+ * @param {string} type The type field of the parent node.
144
+ * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise.
145
+ * @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists.
146
+ */
147
+ function findUp(node, type, shouldStop) {
148
+ return !node || shouldStop(node) ? null : node.type === type ? node : findUp(node.parent, type, shouldStop);
149
+ }
150
+ /** @type {import('../types').Rule.RuleModule} */
151
+ module.exports = {
152
+ meta: {
153
+ type: "suggestion",
154
+ defaultOptions: [{
155
+ destructuring: "any",
156
+ ignoreReadBeforeAssign: !1
157
+ }],
158
+ docs: {
159
+ description: "Require `const` declarations for variables that are never reassigned after declared",
160
+ recommended: !1,
161
+ url: "https://eslint.org/docs/latest/rules/prefer-const"
162
+ },
163
+ fixable: "code",
164
+ schema: [{
165
+ type: "object",
166
+ properties: {
167
+ destructuring: { enum: ["any", "all"] },
168
+ ignoreReadBeforeAssign: { type: "boolean" }
169
+ },
170
+ additionalProperties: !1
171
+ }],
172
+ messages: { useConst: "'{{name}}' is never reassigned. Use 'const' instead." }
173
+ },
174
+ create(context) {
175
+ let [{ destructuring, ignoreReadBeforeAssign }] = context.options, shouldMatchAnyDestructuredVariable = destructuring !== "all", sourceCode = context.sourceCode, variables = [], reportCount = 0, checkedId = null, checkedName = "";
176
+ /**
177
+ * Reports given identifier nodes if all of the nodes should be declared
178
+ * as const.
179
+ *
180
+ * The argument 'nodes' is an array of Identifier nodes.
181
+ * This node is the result of 'getIdentifierIfShouldBeConst()', so it's
182
+ * nullable. In simple declaration or assignment cases, the length of
183
+ * the array is 1. In destructuring cases, the length of the array can
184
+ * be 2 or more.
185
+ * @param {(eslint-scope.Reference|null)[]} nodes
186
+ * References which are grouped by destructuring to report.
187
+ * @returns {void}
188
+ */
189
+ function checkGroup(nodes) {
190
+ let nodesToReport = nodes.filter(Boolean);
191
+ if (nodes.length && (shouldMatchAnyDestructuredVariable || nodesToReport.length === nodes.length)) {
192
+ let varDeclParent = findUp(nodes[0], "VariableDeclaration", (parentNode) => parentNode.type.endsWith("Statement")), isVarDecParentNull = varDeclParent === null;
193
+ if (!isVarDecParentNull && varDeclParent.declarations.length > 0) {
194
+ let firstDeclaration = varDeclParent.declarations[0];
195
+ if (firstDeclaration.init) {
196
+ let firstDecParent = firstDeclaration.init.parent;
197
+ firstDecParent.type === "VariableDeclarator" && (firstDecParent.id.name !== checkedName && (checkedName = firstDecParent.id.name, reportCount = 0), firstDecParent.id.type === "ObjectPattern" && firstDecParent.init.name !== checkedName && (checkedName = firstDecParent.init.name, reportCount = 0), firstDecParent.id !== checkedId && (checkedId = firstDecParent.id, reportCount = 0));
198
+ }
199
+ }
200
+ let shouldFix = varDeclParent && (varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || varDeclParent.declarations.every((declaration) => declaration.init)) && nodesToReport.length === nodes.length;
201
+ if (!isVarDecParentNull && varDeclParent.declarations && varDeclParent.declarations.length !== 1 && varDeclParent && varDeclParent.declarations && varDeclParent.declarations.length >= 1) {
202
+ reportCount += nodesToReport.length;
203
+ let totalDeclarationsCount = 0;
204
+ varDeclParent.declarations.forEach((declaration) => {
205
+ declaration.id.type === "ObjectPattern" ? totalDeclarationsCount += declaration.id.properties.length : declaration.id.type === "ArrayPattern" ? totalDeclarationsCount += declaration.id.elements.length : totalDeclarationsCount += 1;
206
+ }), shouldFix &&= reportCount === totalDeclarationsCount;
207
+ }
208
+ nodesToReport.forEach((node) => {
209
+ context.report({
210
+ node,
211
+ messageId: "useConst",
212
+ data: node,
213
+ fix: shouldFix ? (fixer) => {
214
+ let letKeywordToken = sourceCode.getFirstToken(varDeclParent, (t) => t.value === varDeclParent.kind);
215
+ /**
216
+ * Extend the replacement range to the whole declaration,
217
+ * in order to prevent other fixes in the same pass
218
+ * https://github.com/eslint/eslint/issues/13899
219
+ */
220
+ return new FixTracker(fixer, sourceCode).retainRange(varDeclParent.range).replaceTextRange(letKeywordToken.range, "const");
221
+ } : null
222
+ });
223
+ });
224
+ }
225
+ }
226
+ return {
227
+ "Program:exit"() {
228
+ groupByDestructuring(variables, ignoreReadBeforeAssign).forEach(checkGroup);
229
+ },
230
+ VariableDeclaration(node) {
231
+ node.kind === "let" && !isInitOfForStatement(node) && variables.push(...sourceCode.getDeclaredVariables(node));
232
+ }
233
+ };
234
+ }
235
+ };
236
+ }));
237
+ //#endregion
238
+ //#region src-js/generated/plugin-eslint/rules/prefer-const.cjs
239
+ module.exports = require_prefer_const().create;
240
+ //#endregion
@@ -0,0 +1,188 @@
1
+ const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs");
2
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/prefer-destructuring.js
3
+ /**
4
+ * @fileoverview Prefer destructuring from arrays and objects
5
+ * @author Alex LaFroscia
6
+ */
7
+ var require_prefer_destructuring = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t(), PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({ type: "AssignmentExpression" });
9
+ /** @type {import('../types').Rule.RuleModule} */
10
+ module.exports = {
11
+ meta: {
12
+ type: "suggestion",
13
+ docs: {
14
+ description: "Require destructuring from arrays and/or objects",
15
+ recommended: !1,
16
+ frozen: !0,
17
+ url: "https://eslint.org/docs/latest/rules/prefer-destructuring"
18
+ },
19
+ fixable: "code",
20
+ schema: [{ oneOf: [{
21
+ type: "object",
22
+ properties: {
23
+ VariableDeclarator: {
24
+ type: "object",
25
+ properties: {
26
+ array: { type: "boolean" },
27
+ object: { type: "boolean" }
28
+ },
29
+ additionalProperties: !1
30
+ },
31
+ AssignmentExpression: {
32
+ type: "object",
33
+ properties: {
34
+ array: { type: "boolean" },
35
+ object: { type: "boolean" }
36
+ },
37
+ additionalProperties: !1
38
+ }
39
+ },
40
+ additionalProperties: !1
41
+ }, {
42
+ type: "object",
43
+ properties: {
44
+ array: { type: "boolean" },
45
+ object: { type: "boolean" }
46
+ },
47
+ additionalProperties: !1
48
+ }] }, {
49
+ type: "object",
50
+ properties: { enforceForRenamedProperties: { type: "boolean" } },
51
+ additionalProperties: !1
52
+ }],
53
+ messages: { preferDestructuring: "Use {{type}} destructuring." }
54
+ },
55
+ create(context) {
56
+ let enabledTypes = context.options[0], enforceForRenamedProperties = context.options[1] && context.options[1].enforceForRenamedProperties, normalizedOptions = {
57
+ VariableDeclarator: {
58
+ array: !0,
59
+ object: !0
60
+ },
61
+ AssignmentExpression: {
62
+ array: !0,
63
+ object: !0
64
+ }
65
+ };
66
+ enabledTypes && (normalizedOptions = enabledTypes.array !== void 0 || enabledTypes.object !== void 0 ? {
67
+ VariableDeclarator: enabledTypes,
68
+ AssignmentExpression: enabledTypes
69
+ } : enabledTypes);
70
+ /**
71
+ * Checks if destructuring type should be checked.
72
+ * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator"
73
+ * @param {string} destructuringType "array" or "object"
74
+ * @returns {boolean} `true` if the destructuring type should be checked for the given node
75
+ */
76
+ function shouldCheck(nodeType, destructuringType) {
77
+ return normalizedOptions && normalizedOptions[nodeType] && normalizedOptions[nodeType][destructuringType];
78
+ }
79
+ /**
80
+ * Determines if the given node is accessing an array index
81
+ *
82
+ * This is used to differentiate array index access from object property
83
+ * access.
84
+ * @param {ASTNode} node the node to evaluate
85
+ * @returns {boolean} whether or not the node is an integer
86
+ */
87
+ function isArrayIndexAccess(node) {
88
+ return Number.isInteger(node.property.value);
89
+ }
90
+ /**
91
+ * Report that the given node should use destructuring
92
+ * @param {ASTNode} reportNode the node to report
93
+ * @param {string} type the type of destructuring that should have been done
94
+ * @param {Function|null} fix the fix function or null to pass to context.report
95
+ * @returns {void}
96
+ */
97
+ function report(reportNode, type, fix) {
98
+ context.report({
99
+ node: reportNode,
100
+ messageId: "preferDestructuring",
101
+ data: { type },
102
+ fix
103
+ });
104
+ }
105
+ /**
106
+ * Determines if a node should be fixed into object destructuring
107
+ *
108
+ * The fixer only fixes the simplest case of object destructuring,
109
+ * like: `let x = a.x`;
110
+ *
111
+ * Assignment expression is not fixed.
112
+ * Array destructuring is not fixed.
113
+ * Renamed property is not fixed.
114
+ * @param {ASTNode} node the node to evaluate
115
+ * @returns {boolean} whether or not the node should be fixed
116
+ */
117
+ function shouldFix(node) {
118
+ return node.type === "VariableDeclarator" && node.id.type === "Identifier" && node.init.type === "MemberExpression" && !node.init.computed && node.init.property.type === "Identifier" && node.id.name === node.init.property.name;
119
+ }
120
+ /**
121
+ * Fix a node into object destructuring.
122
+ * This function only handles the simplest case of object destructuring,
123
+ * see {@link shouldFix}.
124
+ * @param {SourceCodeFixer} fixer the fixer object
125
+ * @param {ASTNode} node the node to be fixed.
126
+ * @returns {Object} a fix for the node
127
+ */
128
+ function fixIntoObjectDestructuring(fixer, node) {
129
+ let rightNode = node.init, sourceCode = context.sourceCode;
130
+ if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) return null;
131
+ let objectText = sourceCode.getText(rightNode.object);
132
+ return astUtils.getPrecedence(rightNode.object) < PRECEDENCE_OF_ASSIGNMENT_EXPR && (objectText = `(${objectText})`), fixer.replaceText(node, `{${rightNode.property.name}} = ${objectText}`);
133
+ }
134
+ /**
135
+ * Check that the `prefer-destructuring` rules are followed based on the
136
+ * given left- and right-hand side of the assignment.
137
+ *
138
+ * Pulled out into a separate method so that VariableDeclarators and
139
+ * AssignmentExpressions can share the same verification logic.
140
+ * @param {ASTNode} leftNode the left-hand side of the assignment
141
+ * @param {ASTNode} rightNode the right-hand side of the assignment
142
+ * @param {ASTNode} reportNode the node to report the error on
143
+ * @returns {void}
144
+ */
145
+ function performCheck(leftNode, rightNode, reportNode) {
146
+ if (rightNode.type !== "MemberExpression" || rightNode.object.type === "Super" || rightNode.property.type === "PrivateIdentifier") return;
147
+ if (isArrayIndexAccess(rightNode)) {
148
+ shouldCheck(reportNode.type, "array") && report(reportNode, "array", null);
149
+ return;
150
+ }
151
+ let fix = shouldFix(reportNode) ? (fixer) => fixIntoObjectDestructuring(fixer, reportNode) : null;
152
+ if (shouldCheck(reportNode.type, "object") && enforceForRenamedProperties) {
153
+ report(reportNode, "object", fix);
154
+ return;
155
+ }
156
+ if (shouldCheck(reportNode.type, "object")) {
157
+ let property = rightNode.property;
158
+ (property.type === "Literal" && leftNode.name === property.value || property.type === "Identifier" && leftNode.name === property.name && !rightNode.computed) && report(reportNode, "object", fix);
159
+ }
160
+ }
161
+ /**
162
+ * Check if a given variable declarator is coming from an property access
163
+ * that should be using destructuring instead
164
+ * @param {ASTNode} node the variable declarator to check
165
+ * @returns {void}
166
+ */
167
+ function checkVariableDeclarator(node) {
168
+ node.init && (node.parent.kind === "using" || node.parent.kind === "await using" || node.init.type === "MemberExpression" && performCheck(node.id, node.init, node));
169
+ }
170
+ /**
171
+ * Run the `prefer-destructuring` check on an AssignmentExpression
172
+ * @param {ASTNode} node the AssignmentExpression node
173
+ * @returns {void}
174
+ */
175
+ function checkAssignmentExpression(node) {
176
+ node.operator === "=" && performCheck(node.left, node.right, node);
177
+ }
178
+ return {
179
+ VariableDeclarator: checkVariableDeclarator,
180
+ AssignmentExpression: checkAssignmentExpression
181
+ };
182
+ }
183
+ };
184
+ }));
185
+ //#endregion
186
+ //#region src-js/generated/plugin-eslint/rules/prefer-destructuring.cjs
187
+ module.exports = require_prefer_destructuring().create;
188
+ //#endregion