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
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "oxlint-plugin-eslint",
3
+ "version": "1.52.0",
4
+ "description": "ESLint's built-in rules as an Oxlint plugin",
5
+ "keywords": [
6
+ "eslint",
7
+ "linter",
8
+ "oxlint",
9
+ "plugin"
10
+ ],
11
+ "homepage": "https://oxc.rs/docs/guide/usage/linter/js-plugins",
12
+ "bugs": "https://github.com/oxc-project/oxc/issues",
13
+ "license": "MIT",
14
+ "author": "Boshen and oxc contributors",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/oxc-project/oxc.git",
18
+ "directory": "npm/oxlint-plugin-eslint"
19
+ },
20
+ "funding": {
21
+ "url": "https://github.com/sponsors/Boshen"
22
+ },
23
+ "files": [
24
+ "index.js",
25
+ "rules",
26
+ "common",
27
+ "README.md"
28
+ ],
29
+ "type": "module",
30
+ "main": "index.js",
31
+ "engines": {
32
+ "node": "^20.19.0 || >=22.12.0"
33
+ }
34
+ }
@@ -0,0 +1,233 @@
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/accessor-pairs.js
3
+ /**
4
+ * @fileoverview Rule to enforce getter and setter pairs in objects and classes.
5
+ * @author Gyandeep Singh
6
+ */
7
+ var require_accessor_pairs = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t();
9
+ /**
10
+ * Property name if it can be computed statically, otherwise the list of the tokens of the key node.
11
+ * @typedef {string|Token[]} Key
12
+ */
13
+ /**
14
+ * Accessor nodes with the same key.
15
+ * @typedef {Object} AccessorData
16
+ * @property {Key} key Accessor's key
17
+ * @property {ASTNode[]} getters List of getter nodes.
18
+ * @property {ASTNode[]} setters List of setter nodes.
19
+ */
20
+ /**
21
+ * Checks whether or not the given lists represent the equal tokens in the same order.
22
+ * Tokens are compared by their properties, not by instance.
23
+ * @param {Token[]} left First list of tokens.
24
+ * @param {Token[]} right Second list of tokens.
25
+ * @returns {boolean} `true` if the lists have same tokens.
26
+ */
27
+ function areEqualTokenLists(left, right) {
28
+ if (left.length !== right.length) return !1;
29
+ for (let i = 0; i < left.length; i++) {
30
+ let leftToken = left[i], rightToken = right[i];
31
+ if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) return !1;
32
+ }
33
+ return !0;
34
+ }
35
+ /**
36
+ * Checks whether or not the given keys are equal.
37
+ * @param {Key} left First key.
38
+ * @param {Key} right Second key.
39
+ * @returns {boolean} `true` if the keys are equal.
40
+ */
41
+ function areEqualKeys(left, right) {
42
+ return typeof left == "string" && typeof right == "string" ? left === right : Array.isArray(left) && Array.isArray(right) ? areEqualTokenLists(left, right) : !1;
43
+ }
44
+ /**
45
+ * Checks whether or not a given node is of an accessor kind ('get' or 'set').
46
+ * @param {ASTNode} node A node to check.
47
+ * @returns {boolean} `true` if the node is of an accessor kind.
48
+ */
49
+ function isAccessorKind(node) {
50
+ return node.kind === "get" || node.kind === "set";
51
+ }
52
+ /**
53
+ * Checks whether or not a given node is an argument of a specified method call.
54
+ * @param {ASTNode} node A node to check.
55
+ * @param {number} index An expected index of the node in arguments.
56
+ * @param {string} object An expected name of the object of the method.
57
+ * @param {string} property An expected name of the method.
58
+ * @returns {boolean} `true` if the node is an argument of the specified method call.
59
+ */
60
+ function isArgumentOfMethodCall(node, index, object, property) {
61
+ let parent = node.parent;
62
+ return parent.type === "CallExpression" && astUtils.isSpecificMemberAccess(parent.callee, object, property) && parent.arguments[index] === node;
63
+ }
64
+ /**
65
+ * Checks whether or not a given node is a property descriptor.
66
+ * @param {ASTNode} node A node to check.
67
+ * @returns {boolean} `true` if the node is a property descriptor.
68
+ */
69
+ function isPropertyDescriptor(node) {
70
+ if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") || isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty")) return !0;
71
+ let grandparent = node.parent.parent;
72
+ return grandparent.type === "ObjectExpression" && (isArgumentOfMethodCall(grandparent, 1, "Object", "create") || isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties"));
73
+ }
74
+ /** @type {import('../types').Rule.RuleModule} */
75
+ module.exports = {
76
+ meta: {
77
+ type: "suggestion",
78
+ defaultOptions: [{
79
+ enforceForTSTypes: !1,
80
+ enforceForClassMembers: !0,
81
+ getWithoutSet: !1,
82
+ setWithoutGet: !0
83
+ }],
84
+ docs: {
85
+ description: "Enforce getter and setter pairs in objects and classes",
86
+ recommended: !1,
87
+ url: "https://eslint.org/docs/latest/rules/accessor-pairs"
88
+ },
89
+ schema: [{
90
+ type: "object",
91
+ properties: {
92
+ getWithoutSet: { type: "boolean" },
93
+ setWithoutGet: { type: "boolean" },
94
+ enforceForClassMembers: { type: "boolean" },
95
+ enforceForTSTypes: { type: "boolean" }
96
+ },
97
+ additionalProperties: !1
98
+ }],
99
+ messages: {
100
+ missingGetterInPropertyDescriptor: "Getter is not present in property descriptor.",
101
+ missingSetterInPropertyDescriptor: "Setter is not present in property descriptor.",
102
+ missingGetterInObjectLiteral: "Getter is not present for {{ name }}.",
103
+ missingSetterInObjectLiteral: "Setter is not present for {{ name }}.",
104
+ missingGetterInClass: "Getter is not present for class {{ name }}.",
105
+ missingSetterInClass: "Setter is not present for class {{ name }}.",
106
+ missingGetterInType: "Getter is not present for type {{ name }}.",
107
+ missingSetterInType: "Setter is not present for type {{ name }}."
108
+ }
109
+ },
110
+ create(context) {
111
+ let [{ getWithoutSet: checkGetWithoutSet, setWithoutGet: checkSetWithoutGet, enforceForClassMembers, enforceForTSTypes }] = context.options, sourceCode = context.sourceCode;
112
+ /**
113
+ * Reports the given node.
114
+ * @param {ASTNode} node The node to report.
115
+ * @param {string} messageKind "missingGetter" or "missingSetter".
116
+ * @returns {void}
117
+ * @private
118
+ */
119
+ function report(node, messageKind) {
120
+ node.type === "Property" ? context.report({
121
+ node,
122
+ messageId: `${messageKind}InObjectLiteral`,
123
+ loc: astUtils.getFunctionHeadLoc(node.value, sourceCode),
124
+ data: { name: astUtils.getFunctionNameWithKind(node.value) }
125
+ }) : node.type === "MethodDefinition" ? context.report({
126
+ node,
127
+ messageId: `${messageKind}InClass`,
128
+ loc: astUtils.getFunctionHeadLoc(node.value, sourceCode),
129
+ data: { name: astUtils.getFunctionNameWithKind(node.value) }
130
+ }) : node.type === "TSMethodSignature" ? context.report({
131
+ node,
132
+ messageId: `${messageKind}InType`,
133
+ loc: astUtils.getFunctionHeadLoc(node, sourceCode),
134
+ data: { name: astUtils.getFunctionNameWithKind(node) }
135
+ }) : context.report({
136
+ node,
137
+ messageId: `${messageKind}InPropertyDescriptor`
138
+ });
139
+ }
140
+ /**
141
+ * Reports each of the nodes in the given list using the same messageId.
142
+ * @param {ASTNode[]} nodes Nodes to report.
143
+ * @param {string} messageKind "missingGetter" or "missingSetter".
144
+ * @returns {void}
145
+ * @private
146
+ */
147
+ function reportList(nodes, messageKind) {
148
+ for (let node of nodes) report(node, messageKind);
149
+ }
150
+ /**
151
+ * Checks accessor pairs in the given list of nodes.
152
+ * @param {ASTNode[]} nodes The list to check.
153
+ * @returns {void}
154
+ * @private
155
+ */
156
+ function checkList(nodes) {
157
+ let accessors = [], found = !1;
158
+ for (let i = 0; i < nodes.length; i++) {
159
+ let node = nodes[i];
160
+ if (isAccessorKind(node)) {
161
+ let name = astUtils.getStaticPropertyName(node), key = name === null ? sourceCode.getTokens(node.key) : name;
162
+ for (let j = 0; j < accessors.length; j++) {
163
+ let accessor = accessors[j];
164
+ if (areEqualKeys(accessor.key, key)) {
165
+ accessor.getters.push(...node.kind === "get" ? [node] : []), accessor.setters.push(...node.kind === "set" ? [node] : []), found = !0;
166
+ break;
167
+ }
168
+ }
169
+ found || accessors.push({
170
+ key,
171
+ getters: node.kind === "get" ? [node] : [],
172
+ setters: node.kind === "set" ? [node] : []
173
+ }), found = !1;
174
+ }
175
+ }
176
+ for (let { getters, setters } of accessors) checkSetWithoutGet && setters.length && !getters.length && reportList(setters, "missingGetter"), checkGetWithoutSet && getters.length && !setters.length && reportList(getters, "missingSetter");
177
+ }
178
+ /**
179
+ * Checks accessor pairs in an object literal.
180
+ * @param {ASTNode} node `ObjectExpression` node to check.
181
+ * @returns {void}
182
+ * @private
183
+ */
184
+ function checkObjectLiteral(node) {
185
+ checkList(node.properties.filter((p) => p.type === "Property"));
186
+ }
187
+ /**
188
+ * Checks accessor pairs in a property descriptor.
189
+ * @param {ASTNode} node Property descriptor `ObjectExpression` node to check.
190
+ * @returns {void}
191
+ * @private
192
+ */
193
+ function checkPropertyDescriptor(node) {
194
+ let namesToCheck = new Set(node.properties.filter((p) => p.type === "Property" && p.kind === "init" && !p.computed).map(({ key }) => key.name)), hasGetter = namesToCheck.has("get"), hasSetter = namesToCheck.has("set");
195
+ checkSetWithoutGet && hasSetter && !hasGetter && report(node, "missingGetter"), checkGetWithoutSet && hasGetter && !hasSetter && report(node, "missingSetter");
196
+ }
197
+ /**
198
+ * Checks the given object expression as an object literal and as a possible property descriptor.
199
+ * @param {ASTNode} node `ObjectExpression` node to check.
200
+ * @returns {void}
201
+ * @private
202
+ */
203
+ function checkObjectExpression(node) {
204
+ checkObjectLiteral(node), isPropertyDescriptor(node) && checkPropertyDescriptor(node);
205
+ }
206
+ /**
207
+ * Checks the given class body.
208
+ * @param {ASTNode} node `ClassBody` node to check.
209
+ * @returns {void}
210
+ * @private
211
+ */
212
+ function checkClassBody(node) {
213
+ let methodDefinitions = node.body.filter((m) => m.type === "MethodDefinition");
214
+ checkList(methodDefinitions.filter((m) => m.static)), checkList(methodDefinitions.filter((m) => !m.static));
215
+ }
216
+ /**
217
+ * Checks the given type.
218
+ * @param {ASTNode} node `TSTypeLiteral` or `TSInterfaceBody` node to check.
219
+ * @returns {void}
220
+ * @private
221
+ */
222
+ function checkType(node) {
223
+ checkList((node.type === "TSTypeLiteral" ? node.members : node.body).filter((m) => m.type === "TSMethodSignature"));
224
+ }
225
+ let listeners = {};
226
+ return (checkSetWithoutGet || checkGetWithoutSet) && (listeners.ObjectExpression = checkObjectExpression, enforceForClassMembers && (listeners.ClassBody = checkClassBody), enforceForTSTypes && (listeners["TSTypeLiteral, TSInterfaceBody"] = checkType)), listeners;
227
+ }
228
+ };
229
+ }));
230
+ //#endregion
231
+ //#region src-js/generated/plugin-eslint/rules/accessor-pairs.cjs
232
+ module.exports = require_accessor_pairs().create;
233
+ //#endregion
@@ -0,0 +1,172 @@
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/array-bracket-newline.js
3
+ /**
4
+ * @fileoverview Rule to enforce linebreaks after open and before close array brackets
5
+ * @author Jan Peer Stöcklmair <https://github.com/JPeer264>
6
+ * @deprecated in ESLint v8.53.0
7
+ */
8
+ var require_array_bracket_newline = /* @__PURE__ */ require_chunk.t(((exports, module) => {
9
+ let astUtils = require_ast_utils$1.t();
10
+ /** @type {import('../types').Rule.RuleModule} */
11
+ module.exports = {
12
+ meta: {
13
+ deprecated: {
14
+ message: "Formatting rules are being moved out of ESLint core.",
15
+ url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
16
+ deprecatedSince: "8.53.0",
17
+ availableUntil: "11.0.0",
18
+ replacedBy: [{
19
+ message: "ESLint Stylistic now maintains deprecated stylistic core rules.",
20
+ url: "https://eslint.style/guide/migration",
21
+ plugin: {
22
+ name: "@stylistic/eslint-plugin",
23
+ url: "https://eslint.style"
24
+ },
25
+ rule: {
26
+ name: "array-bracket-newline",
27
+ url: "https://eslint.style/rules/array-bracket-newline"
28
+ }
29
+ }]
30
+ },
31
+ type: "layout",
32
+ docs: {
33
+ description: "Enforce linebreaks after opening and before closing array brackets",
34
+ recommended: !1,
35
+ url: "https://eslint.org/docs/latest/rules/array-bracket-newline"
36
+ },
37
+ fixable: "whitespace",
38
+ schema: [{ oneOf: [{ enum: [
39
+ "always",
40
+ "never",
41
+ "consistent"
42
+ ] }, {
43
+ type: "object",
44
+ properties: {
45
+ multiline: { type: "boolean" },
46
+ minItems: {
47
+ type: ["integer", "null"],
48
+ minimum: 0
49
+ }
50
+ },
51
+ additionalProperties: !1
52
+ }] }],
53
+ messages: {
54
+ unexpectedOpeningLinebreak: "There should be no linebreak after '['.",
55
+ unexpectedClosingLinebreak: "There should be no linebreak before ']'.",
56
+ missingOpeningLinebreak: "A linebreak is required after '['.",
57
+ missingClosingLinebreak: "A linebreak is required before ']'."
58
+ }
59
+ },
60
+ create(context) {
61
+ let sourceCode = context.sourceCode;
62
+ /**
63
+ * Normalizes a given option value.
64
+ * @param {string|Object|undefined} option An option value to parse.
65
+ * @returns {{multiline: boolean, minItems: number}} Normalized option object.
66
+ */
67
+ function normalizeOptionValue(option) {
68
+ let consistent = !1, multiline = !1, minItems;
69
+ return option ? option === "consistent" ? (consistent = !0, minItems = Infinity) : option === "always" || option.minItems === 0 ? minItems = 0 : option === "never" ? minItems = Infinity : (multiline = !!option.multiline, minItems = option.minItems || Infinity) : (consistent = !1, multiline = !0, minItems = Infinity), {
70
+ consistent,
71
+ multiline,
72
+ minItems
73
+ };
74
+ }
75
+ /**
76
+ * Normalizes a given option value.
77
+ * @param {string|Object|undefined} options An option value to parse.
78
+ * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object.
79
+ */
80
+ function normalizeOptions(options) {
81
+ let value = normalizeOptionValue(options);
82
+ return {
83
+ ArrayExpression: value,
84
+ ArrayPattern: value
85
+ };
86
+ }
87
+ /**
88
+ * Reports that there shouldn't be a linebreak after the first token
89
+ * @param {ASTNode} node The node to report in the event of an error.
90
+ * @param {Token} token The token to use for the report.
91
+ * @returns {void}
92
+ */
93
+ function reportNoBeginningLinebreak(node, token) {
94
+ context.report({
95
+ node,
96
+ loc: token.loc,
97
+ messageId: "unexpectedOpeningLinebreak",
98
+ fix(fixer) {
99
+ let nextToken = sourceCode.getTokenAfter(token, { includeComments: !0 });
100
+ return astUtils.isCommentToken(nextToken) ? null : fixer.removeRange([token.range[1], nextToken.range[0]]);
101
+ }
102
+ });
103
+ }
104
+ /**
105
+ * Reports that there shouldn't be a linebreak before the last token
106
+ * @param {ASTNode} node The node to report in the event of an error.
107
+ * @param {Token} token The token to use for the report.
108
+ * @returns {void}
109
+ */
110
+ function reportNoEndingLinebreak(node, token) {
111
+ context.report({
112
+ node,
113
+ loc: token.loc,
114
+ messageId: "unexpectedClosingLinebreak",
115
+ fix(fixer) {
116
+ let previousToken = sourceCode.getTokenBefore(token, { includeComments: !0 });
117
+ return astUtils.isCommentToken(previousToken) ? null : fixer.removeRange([previousToken.range[1], token.range[0]]);
118
+ }
119
+ });
120
+ }
121
+ /**
122
+ * Reports that there should be a linebreak after the first token
123
+ * @param {ASTNode} node The node to report in the event of an error.
124
+ * @param {Token} token The token to use for the report.
125
+ * @returns {void}
126
+ */
127
+ function reportRequiredBeginningLinebreak(node, token) {
128
+ context.report({
129
+ node,
130
+ loc: token.loc,
131
+ messageId: "missingOpeningLinebreak",
132
+ fix(fixer) {
133
+ return fixer.insertTextAfter(token, "\n");
134
+ }
135
+ });
136
+ }
137
+ /**
138
+ * Reports that there should be a linebreak before the last token
139
+ * @param {ASTNode} node The node to report in the event of an error.
140
+ * @param {Token} token The token to use for the report.
141
+ * @returns {void}
142
+ */
143
+ function reportRequiredEndingLinebreak(node, token) {
144
+ context.report({
145
+ node,
146
+ loc: token.loc,
147
+ messageId: "missingClosingLinebreak",
148
+ fix(fixer) {
149
+ return fixer.insertTextBefore(token, "\n");
150
+ }
151
+ });
152
+ }
153
+ /**
154
+ * Reports a given node if it violated this rule.
155
+ * @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node.
156
+ * @returns {void}
157
+ */
158
+ function check(node) {
159
+ let elements = node.elements, options = normalizeOptions(context.options[0])[node.type], openBracket = sourceCode.getFirstToken(node), closeBracket = sourceCode.getLastToken(node), firstIncComment = sourceCode.getTokenAfter(openBracket, { includeComments: !0 }), lastIncComment = sourceCode.getTokenBefore(closeBracket, { includeComments: !0 }), first = sourceCode.getTokenAfter(openBracket), last = sourceCode.getTokenBefore(closeBracket);
160
+ elements.length >= options.minItems || options.multiline && elements.length > 0 && firstIncComment.loc.start.line !== lastIncComment.loc.end.line || elements.length === 0 && firstIncComment.type === "Block" && firstIncComment.loc.start.line !== lastIncComment.loc.end.line && firstIncComment === lastIncComment || options.consistent && openBracket.loc.end.line !== first.loc.start.line ? (astUtils.isTokenOnSameLine(openBracket, first) && reportRequiredBeginningLinebreak(node, openBracket), astUtils.isTokenOnSameLine(last, closeBracket) && reportRequiredEndingLinebreak(node, closeBracket)) : (astUtils.isTokenOnSameLine(openBracket, first) || reportNoBeginningLinebreak(node, openBracket), astUtils.isTokenOnSameLine(last, closeBracket) || reportNoEndingLinebreak(node, closeBracket));
161
+ }
162
+ return {
163
+ ArrayPattern: check,
164
+ ArrayExpression: check
165
+ };
166
+ }
167
+ };
168
+ }));
169
+ //#endregion
170
+ //#region src-js/generated/plugin-eslint/rules/array-bracket-newline.cjs
171
+ module.exports = require_array_bracket_newline().create;
172
+ //#endregion
@@ -0,0 +1,184 @@
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/array-bracket-spacing.js
3
+ /**
4
+ * @fileoverview Disallows or enforces spaces inside of array brackets.
5
+ * @author Jamund Ferguson
6
+ * @deprecated in ESLint v8.53.0
7
+ */
8
+ var require_array_bracket_spacing = /* @__PURE__ */ require_chunk.t(((exports, module) => {
9
+ let astUtils = require_ast_utils$1.t();
10
+ /** @type {import('../types').Rule.RuleModule} */
11
+ module.exports = {
12
+ meta: {
13
+ deprecated: {
14
+ message: "Formatting rules are being moved out of ESLint core.",
15
+ url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
16
+ deprecatedSince: "8.53.0",
17
+ availableUntil: "11.0.0",
18
+ replacedBy: [{
19
+ message: "ESLint Stylistic now maintains deprecated stylistic core rules.",
20
+ url: "https://eslint.style/guide/migration",
21
+ plugin: {
22
+ name: "@stylistic/eslint-plugin",
23
+ url: "https://eslint.style"
24
+ },
25
+ rule: {
26
+ name: "array-bracket-spacing",
27
+ url: "https://eslint.style/rules/array-bracket-spacing"
28
+ }
29
+ }]
30
+ },
31
+ type: "layout",
32
+ docs: {
33
+ description: "Enforce consistent spacing inside array brackets",
34
+ recommended: !1,
35
+ url: "https://eslint.org/docs/latest/rules/array-bracket-spacing"
36
+ },
37
+ fixable: "whitespace",
38
+ schema: [{ enum: ["always", "never"] }, {
39
+ type: "object",
40
+ properties: {
41
+ singleValue: { type: "boolean" },
42
+ objectsInArrays: { type: "boolean" },
43
+ arraysInArrays: { type: "boolean" }
44
+ },
45
+ additionalProperties: !1
46
+ }],
47
+ messages: {
48
+ unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.",
49
+ unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.",
50
+ missingSpaceAfter: "A space is required after '{{tokenValue}}'.",
51
+ missingSpaceBefore: "A space is required before '{{tokenValue}}'."
52
+ }
53
+ },
54
+ create(context) {
55
+ let spaced = context.options[0] === "always", sourceCode = context.sourceCode;
56
+ /**
57
+ * Determines whether an option is set, relative to the spacing option.
58
+ * If spaced is "always", then check whether option is set to false.
59
+ * If spaced is "never", then check whether option is set to true.
60
+ * @param {Object} option The option to exclude.
61
+ * @returns {boolean} Whether or not the property is excluded.
62
+ */
63
+ function isOptionSet(option) {
64
+ return context.options[1] ? context.options[1][option] === !spaced : !1;
65
+ }
66
+ let options = {
67
+ spaced,
68
+ singleElementException: isOptionSet("singleValue"),
69
+ objectsInArraysException: isOptionSet("objectsInArrays"),
70
+ arraysInArraysException: isOptionSet("arraysInArrays")
71
+ };
72
+ /**
73
+ * Reports that there shouldn't be a space after the first token
74
+ * @param {ASTNode} node The node to report in the event of an error.
75
+ * @param {Token} token The token to use for the report.
76
+ * @returns {void}
77
+ */
78
+ function reportNoBeginningSpace(node, token) {
79
+ let nextToken = sourceCode.getTokenAfter(token);
80
+ context.report({
81
+ node,
82
+ loc: {
83
+ start: token.loc.end,
84
+ end: nextToken.loc.start
85
+ },
86
+ messageId: "unexpectedSpaceAfter",
87
+ data: { tokenValue: token.value },
88
+ fix(fixer) {
89
+ return fixer.removeRange([token.range[1], nextToken.range[0]]);
90
+ }
91
+ });
92
+ }
93
+ /**
94
+ * Reports that there shouldn't be a space before the last token
95
+ * @param {ASTNode} node The node to report in the event of an error.
96
+ * @param {Token} token The token to use for the report.
97
+ * @returns {void}
98
+ */
99
+ function reportNoEndingSpace(node, token) {
100
+ let previousToken = sourceCode.getTokenBefore(token);
101
+ context.report({
102
+ node,
103
+ loc: {
104
+ start: previousToken.loc.end,
105
+ end: token.loc.start
106
+ },
107
+ messageId: "unexpectedSpaceBefore",
108
+ data: { tokenValue: token.value },
109
+ fix(fixer) {
110
+ return fixer.removeRange([previousToken.range[1], token.range[0]]);
111
+ }
112
+ });
113
+ }
114
+ /**
115
+ * Reports that there should be a space after the first token
116
+ * @param {ASTNode} node The node to report in the event of an error.
117
+ * @param {Token} token The token to use for the report.
118
+ * @returns {void}
119
+ */
120
+ function reportRequiredBeginningSpace(node, token) {
121
+ context.report({
122
+ node,
123
+ loc: token.loc,
124
+ messageId: "missingSpaceAfter",
125
+ data: { tokenValue: token.value },
126
+ fix(fixer) {
127
+ return fixer.insertTextAfter(token, " ");
128
+ }
129
+ });
130
+ }
131
+ /**
132
+ * Reports that there should be a space before the last token
133
+ * @param {ASTNode} node The node to report in the event of an error.
134
+ * @param {Token} token The token to use for the report.
135
+ * @returns {void}
136
+ */
137
+ function reportRequiredEndingSpace(node, token) {
138
+ context.report({
139
+ node,
140
+ loc: token.loc,
141
+ messageId: "missingSpaceBefore",
142
+ data: { tokenValue: token.value },
143
+ fix(fixer) {
144
+ return fixer.insertTextBefore(token, " ");
145
+ }
146
+ });
147
+ }
148
+ /**
149
+ * Determines if a node is an object type
150
+ * @param {ASTNode} node The node to check.
151
+ * @returns {boolean} Whether or not the node is an object type.
152
+ */
153
+ function isObjectType(node) {
154
+ return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern");
155
+ }
156
+ /**
157
+ * Determines if a node is an array type
158
+ * @param {ASTNode} node The node to check.
159
+ * @returns {boolean} Whether or not the node is an array type.
160
+ */
161
+ function isArrayType(node) {
162
+ return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern");
163
+ }
164
+ /**
165
+ * Validates the spacing around array brackets
166
+ * @param {ASTNode} node The node we're checking for spacing
167
+ * @returns {void}
168
+ */
169
+ function validateArraySpacing(node) {
170
+ if (options.spaced && node.elements.length === 0) return;
171
+ let first = sourceCode.getFirstToken(node), second = sourceCode.getFirstToken(node, 1), last = node.typeAnnotation ? sourceCode.getTokenBefore(node.typeAnnotation) : sourceCode.getLastToken(node), penultimate = sourceCode.getTokenBefore(last), firstElement = node.elements[0], lastElement = node.elements.at(-1), openingBracketMustBeSpaced = options.objectsInArraysException && isObjectType(firstElement) || options.arraysInArraysException && isArrayType(firstElement) || options.singleElementException && node.elements.length === 1 ? !options.spaced : options.spaced, closingBracketMustBeSpaced = options.objectsInArraysException && isObjectType(lastElement) || options.arraysInArraysException && isArrayType(lastElement) || options.singleElementException && node.elements.length === 1 ? !options.spaced : options.spaced;
172
+ astUtils.isTokenOnSameLine(first, second) && (openingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(first, second) && reportRequiredBeginningSpace(node, first), !openingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(first, second) && reportNoBeginningSpace(node, first)), first !== penultimate && astUtils.isTokenOnSameLine(penultimate, last) && (closingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(penultimate, last) && reportRequiredEndingSpace(node, last), !closingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(penultimate, last) && reportNoEndingSpace(node, last));
173
+ }
174
+ return {
175
+ ArrayPattern: validateArraySpacing,
176
+ ArrayExpression: validateArraySpacing
177
+ };
178
+ }
179
+ };
180
+ }));
181
+ //#endregion
182
+ //#region src-js/generated/plugin-eslint/rules/array-bracket-spacing.cjs
183
+ module.exports = require_array_bracket_spacing().create;
184
+ //#endregion