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,117 @@
1
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/callback-return.js
2
+ /**
3
+ * @fileoverview Enforce return after a callback.
4
+ * @author Jamund Ferguson
5
+ * @deprecated in ESLint v7.0.0
6
+ */
7
+ var require_callback_return = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
8
+ /** @type {import('../types').Rule.RuleModule} */
9
+ module.exports = {
10
+ meta: {
11
+ deprecated: {
12
+ message: "Node.js rules were moved out of ESLint core.",
13
+ url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
14
+ deprecatedSince: "7.0.0",
15
+ availableUntil: "11.0.0",
16
+ replacedBy: [{
17
+ message: "eslint-plugin-n now maintains deprecated Node.js-related rules.",
18
+ plugin: {
19
+ name: "eslint-plugin-n",
20
+ url: "https://github.com/eslint-community/eslint-plugin-n"
21
+ },
22
+ rule: {
23
+ name: "callback-return",
24
+ url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/callback-return.md"
25
+ }
26
+ }]
27
+ },
28
+ type: "suggestion",
29
+ docs: {
30
+ description: "Require `return` statements after callbacks",
31
+ recommended: !1,
32
+ url: "https://eslint.org/docs/latest/rules/callback-return"
33
+ },
34
+ schema: [{
35
+ type: "array",
36
+ items: { type: "string" }
37
+ }],
38
+ messages: { missingReturn: "Expected return with your callback function." }
39
+ },
40
+ create(context) {
41
+ let callbacks = context.options[0] || [
42
+ "callback",
43
+ "cb",
44
+ "next"
45
+ ], sourceCode = context.sourceCode;
46
+ /**
47
+ * Find the closest parent matching a list of types.
48
+ * @param {ASTNode} node The node whose parents we are searching
49
+ * @param {Array} types The node types to match
50
+ * @returns {ASTNode} The matched node or undefined.
51
+ */
52
+ function findClosestParentOfType(node, types) {
53
+ return node.parent ? types.includes(node.parent.type) ? node.parent : findClosestParentOfType(node.parent, types) : null;
54
+ }
55
+ /**
56
+ * Check to see if a node contains only identifiers
57
+ * @param {ASTNode} node The node to check
58
+ * @returns {boolean} Whether or not the node contains only identifiers
59
+ */
60
+ function containsOnlyIdentifiers(node) {
61
+ if (node.type === "Identifier") return !0;
62
+ if (node.type === "MemberExpression") {
63
+ if (node.object.type === "Identifier") return !0;
64
+ if (node.object.type === "MemberExpression") return containsOnlyIdentifiers(node.object);
65
+ }
66
+ return !1;
67
+ }
68
+ /**
69
+ * Check to see if a CallExpression is in our callback list.
70
+ * @param {ASTNode} node The node to check against our callback names list.
71
+ * @returns {boolean} Whether or not this function matches our callback name.
72
+ */
73
+ function isCallback(node) {
74
+ return containsOnlyIdentifiers(node.callee) && callbacks.includes(sourceCode.getText(node.callee));
75
+ }
76
+ /**
77
+ * Determines whether or not the callback is part of a callback expression.
78
+ * @param {ASTNode} node The callback node
79
+ * @param {ASTNode} parentNode The expression node
80
+ * @returns {boolean} Whether or not this is part of a callback expression
81
+ */
82
+ function isCallbackExpression(node, parentNode) {
83
+ return !parentNode || parentNode.type !== "ExpressionStatement" ? !1 : parentNode.expression === node || (parentNode.expression.type === "BinaryExpression" || parentNode.expression.type === "LogicalExpression") && parentNode.expression.right === node;
84
+ }
85
+ return { CallExpression(node) {
86
+ if (!isCallback(node)) return;
87
+ let closestBlock = findClosestParentOfType(node, [
88
+ "BlockStatement",
89
+ "ReturnStatement",
90
+ "ArrowFunctionExpression"
91
+ ]) || {};
92
+ if (closestBlock.type !== "ReturnStatement" && closestBlock.type !== "ArrowFunctionExpression") {
93
+ if (closestBlock.type === "BlockStatement") {
94
+ let lastItem = closestBlock.body.at(-1);
95
+ if (isCallbackExpression(node, lastItem)) {
96
+ let parentType = closestBlock.parent.type;
97
+ if (parentType === "FunctionExpression" || parentType === "FunctionDeclaration" || parentType === "ArrowFunctionExpression") return;
98
+ }
99
+ if (lastItem.type === "ReturnStatement" && isCallbackExpression(node, closestBlock.body.at(-2))) return;
100
+ }
101
+ findClosestParentOfType(node, [
102
+ "FunctionDeclaration",
103
+ "FunctionExpression",
104
+ "ArrowFunctionExpression"
105
+ ]) && context.report({
106
+ node,
107
+ messageId: "missingReturn"
108
+ });
109
+ }
110
+ } };
111
+ }
112
+ };
113
+ }));
114
+ //#endregion
115
+ //#region src-js/generated/plugin-eslint/rules/callback-return.cjs
116
+ module.exports = require_callback_return().create;
117
+ //#endregion
@@ -0,0 +1,194 @@
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/camelcase.js
3
+ /**
4
+ * @fileoverview Rule to flag non-camelcased identifiers
5
+ * @author Nicholas C. Zakas
6
+ */
7
+ var require_camelcase = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t();
9
+ /** @type {import('../types').Rule.RuleModule} */
10
+ module.exports = {
11
+ meta: {
12
+ type: "suggestion",
13
+ defaultOptions: [{
14
+ allow: [],
15
+ ignoreDestructuring: !1,
16
+ ignoreGlobals: !1,
17
+ ignoreImports: !1,
18
+ properties: "always"
19
+ }],
20
+ docs: {
21
+ description: "Enforce camelcase naming convention",
22
+ recommended: !1,
23
+ frozen: !0,
24
+ url: "https://eslint.org/docs/latest/rules/camelcase"
25
+ },
26
+ schema: [{
27
+ type: "object",
28
+ properties: {
29
+ ignoreDestructuring: { type: "boolean" },
30
+ ignoreImports: { type: "boolean" },
31
+ ignoreGlobals: { type: "boolean" },
32
+ properties: { enum: ["always", "never"] },
33
+ allow: {
34
+ type: "array",
35
+ items: { type: "string" },
36
+ minItems: 0,
37
+ uniqueItems: !0
38
+ }
39
+ },
40
+ additionalProperties: !1
41
+ }],
42
+ messages: {
43
+ notCamelCase: "Identifier '{{name}}' is not in camel case.",
44
+ notCamelCasePrivate: "#{{name}} is not in camel case."
45
+ }
46
+ },
47
+ create(context) {
48
+ let [{ allow, ignoreDestructuring, ignoreGlobals, ignoreImports, properties }] = context.options, sourceCode = context.sourceCode, reported = /* @__PURE__ */ new Set();
49
+ /**
50
+ * Checks if a string contains an underscore and isn't all upper-case
51
+ * @param {string} name The string to check.
52
+ * @returns {boolean} if the string is underscored
53
+ * @private
54
+ */
55
+ function isUnderscored(name) {
56
+ let nameBody = name.replace(/^_+|_+$/gu, "");
57
+ return nameBody.includes("_") && nameBody !== nameBody.toUpperCase();
58
+ }
59
+ /**
60
+ * Checks if a string match the ignore list
61
+ * @param {string} name The string to check.
62
+ * @returns {boolean} if the string is ignored
63
+ * @private
64
+ */
65
+ function isAllowed(name) {
66
+ return allow.some((entry) => name === entry || name.match(new RegExp(entry, "u")));
67
+ }
68
+ /**
69
+ * Checks if a given name is good or not.
70
+ * @param {string} name The name to check.
71
+ * @returns {boolean} `true` if the name is good.
72
+ * @private
73
+ */
74
+ function isGoodName(name) {
75
+ return !isUnderscored(name) || isAllowed(name);
76
+ }
77
+ /**
78
+ * Checks if a given identifier reference or member expression is an assignment
79
+ * target.
80
+ * @param {ASTNode} node The node to check.
81
+ * @returns {boolean} `true` if the node is an assignment target.
82
+ */
83
+ function isAssignmentTarget(node) {
84
+ let parent = node.parent;
85
+ switch (parent.type) {
86
+ case "AssignmentExpression":
87
+ case "AssignmentPattern": return parent.left === node;
88
+ case "Property": return parent.parent.type === "ObjectPattern" && parent.value === node;
89
+ case "ArrayPattern":
90
+ case "RestElement": return !0;
91
+ default: return !1;
92
+ }
93
+ }
94
+ /**
95
+ * Checks if a given binding identifier uses the original name as-is.
96
+ * - If it's in object destructuring or object expression, the original name is its property name.
97
+ * - If it's in import declaration, the original name is its exported name.
98
+ * @param {ASTNode} node The `Identifier` node to check.
99
+ * @returns {boolean} `true` if the identifier uses the original name as-is.
100
+ */
101
+ function equalsToOriginalName(node) {
102
+ let localName = node.name, valueNode = node.parent.type === "AssignmentPattern" ? node.parent : node, parent = valueNode.parent;
103
+ switch (parent.type) {
104
+ case "Property": return (parent.parent.type === "ObjectPattern" || parent.parent.type === "ObjectExpression") && parent.value === valueNode && !parent.computed && parent.key.type === "Identifier" && parent.key.name === localName;
105
+ case "ImportSpecifier": return parent.local === node && astUtils.getModuleExportName(parent.imported) === localName;
106
+ default: return !1;
107
+ }
108
+ }
109
+ /**
110
+ * Reports an AST node as a rule violation.
111
+ * @param {ASTNode} node The node to report.
112
+ * @returns {void}
113
+ * @private
114
+ */
115
+ function report(node) {
116
+ reported.has(node.range[0]) || (reported.add(node.range[0]), context.report({
117
+ node,
118
+ messageId: node.type === "PrivateIdentifier" ? "notCamelCasePrivate" : "notCamelCase",
119
+ data: { name: node.name }
120
+ }));
121
+ }
122
+ /**
123
+ * Reports an identifier reference or a binding identifier.
124
+ * @param {ASTNode} node The `Identifier` node to report.
125
+ * @returns {void}
126
+ */
127
+ function reportReferenceId(node) {
128
+ node.parent.type === "CallExpression" || node.parent.type === "NewExpression" || node.parent.type === "AssignmentPattern" && node.parent.right === node || ignoreDestructuring && equalsToOriginalName(node) || astUtils.isImportAttributeKey(node) || report(node);
129
+ }
130
+ return {
131
+ Program(node) {
132
+ let scope = sourceCode.getScope(node);
133
+ if (!ignoreGlobals) {
134
+ for (let variable of scope.variables) if (!(variable.identifiers.length > 0 || isGoodName(variable.name))) for (let reference of variable.references) reportReferenceId(reference.identifier);
135
+ }
136
+ for (let reference of scope.through) {
137
+ let id = reference.identifier;
138
+ isGoodName(id.name) || astUtils.isImportAttributeKey(id) || reportReferenceId(id);
139
+ }
140
+ },
141
+ [[
142
+ "VariableDeclaration",
143
+ "FunctionDeclaration",
144
+ "FunctionExpression",
145
+ "ArrowFunctionExpression",
146
+ "ClassDeclaration",
147
+ "ClassExpression",
148
+ "CatchClause"
149
+ ]](node) {
150
+ for (let variable of sourceCode.getDeclaredVariables(node)) {
151
+ if (isGoodName(variable.name)) continue;
152
+ let id = variable.identifiers[0];
153
+ ignoreDestructuring && equalsToOriginalName(id) || report(id);
154
+ for (let reference of variable.references) reference.init || reportReferenceId(reference.identifier);
155
+ }
156
+ },
157
+ [[
158
+ "ObjectExpression > Property[computed!=true] > Identifier.key",
159
+ "MethodDefinition[computed!=true] > Identifier.key",
160
+ "PropertyDefinition[computed!=true] > Identifier.key",
161
+ "MethodDefinition > PrivateIdentifier.key",
162
+ "PropertyDefinition > PrivateIdentifier.key"
163
+ ]](node) {
164
+ properties === "never" || astUtils.isImportAttributeKey(node) || isGoodName(node.name) || report(node);
165
+ },
166
+ "MemberExpression[computed!=true] > Identifier.property"(node) {
167
+ properties === "never" || !isAssignmentTarget(node.parent) || isGoodName(node.name) || report(node);
168
+ },
169
+ ImportDeclaration(node) {
170
+ for (let variable of sourceCode.getDeclaredVariables(node)) {
171
+ if (isGoodName(variable.name)) continue;
172
+ let id = variable.identifiers[0];
173
+ ignoreImports && equalsToOriginalName(id) || report(id);
174
+ for (let reference of variable.references) reportReferenceId(reference.identifier);
175
+ }
176
+ },
177
+ [["ExportAllDeclaration > Identifier.exported", "ExportSpecifier > Identifier.exported"]](node) {
178
+ isGoodName(node.name) || report(node);
179
+ },
180
+ [[
181
+ "LabeledStatement > Identifier.label",
182
+ "BreakStatement > Identifier.label",
183
+ "ContinueStatement > Identifier.label"
184
+ ]](node) {
185
+ isGoodName(node.name) || report(node);
186
+ }
187
+ };
188
+ }
189
+ };
190
+ }));
191
+ //#endregion
192
+ //#region src-js/generated/plugin-eslint/rules/camelcase.cjs
193
+ module.exports = require_camelcase().create;
194
+ //#endregion
@@ -0,0 +1,168 @@
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/capitalized-comments.js
3
+ /**
4
+ * @fileoverview enforce or disallow capitalization of the first letter of a comment
5
+ * @author Kevin Partington
6
+ */
7
+ var require_capitalized_comments = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let DEFAULT_IGNORE_PATTERN = require_ast_utils$1.t().COMMENTS_IGNORE_PATTERN, WHITESPACE = /\s/gu, MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/u, LETTER_PATTERN = /\p{L}/u, SCHEMA_BODY = {
9
+ type: "object",
10
+ properties: {
11
+ ignorePattern: { type: "string" },
12
+ ignoreInlineComments: { type: "boolean" },
13
+ ignoreConsecutiveComments: { type: "boolean" }
14
+ },
15
+ additionalProperties: !1
16
+ }, DEFAULTS = {
17
+ ignorePattern: "",
18
+ ignoreInlineComments: !1,
19
+ ignoreConsecutiveComments: !1
20
+ };
21
+ /**
22
+ * Get normalized options for either block or line comments from the given
23
+ * user-provided options.
24
+ * - If the user-provided options is just a string, returns a normalized
25
+ * set of options using default values for all other options.
26
+ * - If the user-provided options is an object, then a normalized option
27
+ * set is returned. Options specified in overrides will take priority
28
+ * over options specified in the main options object, which will in
29
+ * turn take priority over the rule's defaults.
30
+ * @param {Object|string} rawOptions The user-provided options.
31
+ * @param {string} which Either "line" or "block".
32
+ * @returns {Object} The normalized options.
33
+ */
34
+ function getNormalizedOptions(rawOptions, which) {
35
+ return Object.assign({}, DEFAULTS, rawOptions[which] || rawOptions);
36
+ }
37
+ /**
38
+ * Get normalized options for block and line comments.
39
+ * @param {Object|string} rawOptions The user-provided options.
40
+ * @returns {Object} An object with "Line" and "Block" keys and corresponding
41
+ * normalized options objects.
42
+ */
43
+ function getAllNormalizedOptions(rawOptions = {}) {
44
+ return {
45
+ Line: getNormalizedOptions(rawOptions, "line"),
46
+ Block: getNormalizedOptions(rawOptions, "block")
47
+ };
48
+ }
49
+ /**
50
+ * Creates a regular expression for each ignorePattern defined in the rule
51
+ * options.
52
+ *
53
+ * This is done in order to avoid invoking the RegExp constructor repeatedly.
54
+ * @param {Object} normalizedOptions The normalized rule options.
55
+ * @returns {void}
56
+ */
57
+ function createRegExpForIgnorePatterns(normalizedOptions) {
58
+ Object.keys(normalizedOptions).forEach((key) => {
59
+ let ignorePatternStr = normalizedOptions[key].ignorePattern;
60
+ if (ignorePatternStr) {
61
+ let regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u");
62
+ normalizedOptions[key].ignorePatternRegExp = regExp;
63
+ }
64
+ });
65
+ }
66
+ /** @type {import('../types').Rule.RuleModule} */
67
+ module.exports = {
68
+ meta: {
69
+ type: "suggestion",
70
+ docs: {
71
+ description: "Enforce or disallow capitalization of the first letter of a comment",
72
+ recommended: !1,
73
+ frozen: !0,
74
+ url: "https://eslint.org/docs/latest/rules/capitalized-comments"
75
+ },
76
+ fixable: "code",
77
+ schema: [{ enum: ["always", "never"] }, { oneOf: [SCHEMA_BODY, {
78
+ type: "object",
79
+ properties: {
80
+ line: SCHEMA_BODY,
81
+ block: SCHEMA_BODY
82
+ },
83
+ additionalProperties: !1
84
+ }] }],
85
+ messages: {
86
+ unexpectedLowercaseComment: "Comments should not begin with a lowercase character.",
87
+ unexpectedUppercaseComment: "Comments should not begin with an uppercase character."
88
+ }
89
+ },
90
+ create(context) {
91
+ let capitalize = context.options[0] || "always", normalizedOptions = getAllNormalizedOptions(context.options[1]), sourceCode = context.sourceCode;
92
+ createRegExpForIgnorePatterns(normalizedOptions);
93
+ /**
94
+ * Checks whether a comment is an inline comment.
95
+ *
96
+ * For the purpose of this rule, a comment is inline if:
97
+ * 1. The comment is preceded by a token on the same line; and
98
+ * 2. The command is followed by a token on the same line.
99
+ *
100
+ * Note that the comment itself need not be single-line!
101
+ *
102
+ * Also, it follows from this definition that only block comments can
103
+ * be considered as possibly inline. This is because line comments
104
+ * would consume any following tokens on the same line as the comment.
105
+ * @param {ASTNode} comment The comment node to check.
106
+ * @returns {boolean} True if the comment is an inline comment, false
107
+ * otherwise.
108
+ */
109
+ function isInlineComment(comment) {
110
+ let previousToken = sourceCode.getTokenBefore(comment, { includeComments: !0 }), nextToken = sourceCode.getTokenAfter(comment, { includeComments: !0 });
111
+ return !!(previousToken && nextToken && comment.loc.start.line === previousToken.loc.end.line && comment.loc.end.line === nextToken.loc.start.line);
112
+ }
113
+ /**
114
+ * Determine if a comment follows another comment.
115
+ * @param {ASTNode} comment The comment to check.
116
+ * @returns {boolean} True if the comment follows a valid comment.
117
+ */
118
+ function isConsecutiveComment(comment) {
119
+ let previousTokenOrComment = sourceCode.getTokenBefore(comment, { includeComments: !0 });
120
+ return !!(previousTokenOrComment && ["Block", "Line"].includes(previousTokenOrComment.type));
121
+ }
122
+ /**
123
+ * Check a comment to determine if it is valid for this rule.
124
+ * @param {ASTNode} comment The comment node to process.
125
+ * @param {Object} options The options for checking this comment.
126
+ * @returns {boolean} True if the comment is valid, false otherwise.
127
+ */
128
+ function isCommentValid(comment, options) {
129
+ if (DEFAULT_IGNORE_PATTERN.test(comment.value)) return !0;
130
+ let commentWithoutAsterisks = comment.value.replace(/\*/gu, "");
131
+ if (options.ignorePatternRegExp && options.ignorePatternRegExp.test(commentWithoutAsterisks) || options.ignoreInlineComments && isInlineComment(comment) || options.ignoreConsecutiveComments && isConsecutiveComment(comment) || MAYBE_URL.test(commentWithoutAsterisks)) return !0;
132
+ let commentWordCharsOnly = commentWithoutAsterisks.replace(WHITESPACE, "");
133
+ if (commentWordCharsOnly.length === 0) return !0;
134
+ let [firstWordChar] = commentWordCharsOnly;
135
+ if (!LETTER_PATTERN.test(firstWordChar)) return !0;
136
+ let isUppercase = firstWordChar !== firstWordChar.toLocaleLowerCase(), isLowercase = firstWordChar !== firstWordChar.toLocaleUpperCase();
137
+ return !(capitalize === "always" && isLowercase || capitalize === "never" && isUppercase);
138
+ }
139
+ /**
140
+ * Process a comment to determine if it needs to be reported.
141
+ * @param {ASTNode} comment The comment node to process.
142
+ * @returns {void}
143
+ */
144
+ function processComment(comment) {
145
+ let options = normalizedOptions[comment.type];
146
+ if (!isCommentValid(comment, options)) {
147
+ let messageId = capitalize === "always" ? "unexpectedLowercaseComment" : "unexpectedUppercaseComment";
148
+ context.report({
149
+ node: null,
150
+ loc: comment.loc,
151
+ messageId,
152
+ fix(fixer) {
153
+ let match = comment.value.match(LETTER_PATTERN), char = match[0], charIndex = comment.range[0] + match.index + 2;
154
+ return fixer.replaceTextRange([charIndex, charIndex + char.length], capitalize === "always" ? char.toLocaleUpperCase() : char.toLocaleLowerCase());
155
+ }
156
+ });
157
+ }
158
+ }
159
+ return { Program() {
160
+ sourceCode.getAllComments().filter((token) => token.type !== "Shebang").forEach(processComment);
161
+ } };
162
+ }
163
+ };
164
+ }));
165
+ //#endregion
166
+ //#region src-js/generated/plugin-eslint/rules/capitalized-comments.cjs
167
+ module.exports = require_capitalized_comments().create;
168
+ //#endregion
@@ -0,0 +1,155 @@
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/class-methods-use-this.js
3
+ /**
4
+ * @fileoverview Rule to enforce that all class methods use 'this'.
5
+ * @author Patrick Williams
6
+ */
7
+ var require_class_methods_use_this = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t();
9
+ /** @type {import('../types').Rule.RuleModule} */
10
+ module.exports = {
11
+ meta: {
12
+ dialects: ["javascript", "typescript"],
13
+ language: "javascript",
14
+ type: "suggestion",
15
+ defaultOptions: [{
16
+ enforceForClassFields: !0,
17
+ exceptMethods: [],
18
+ ignoreOverrideMethods: !1
19
+ }],
20
+ docs: {
21
+ description: "Enforce that class methods utilize `this`",
22
+ recommended: !1,
23
+ url: "https://eslint.org/docs/latest/rules/class-methods-use-this"
24
+ },
25
+ schema: [{
26
+ type: "object",
27
+ properties: {
28
+ exceptMethods: {
29
+ type: "array",
30
+ items: { type: "string" }
31
+ },
32
+ enforceForClassFields: { type: "boolean" },
33
+ ignoreOverrideMethods: { type: "boolean" },
34
+ ignoreClassesWithImplements: { enum: ["all", "public-fields"] }
35
+ },
36
+ additionalProperties: !1
37
+ }],
38
+ messages: { missingThis: "Expected 'this' to be used by class {{name}}." }
39
+ },
40
+ create(context) {
41
+ let [options] = context.options, { enforceForClassFields, ignoreOverrideMethods, ignoreClassesWithImplements } = options, exceptMethods = new Set(options.exceptMethods), stack = [];
42
+ /**
43
+ * Push `this` used flag initialized with `false` onto the stack.
44
+ * @returns {void}
45
+ */
46
+ function pushContext() {
47
+ stack.push(!1);
48
+ }
49
+ /**
50
+ * Pop `this` used flag from the stack.
51
+ * @returns {boolean | undefined} `this` used flag
52
+ */
53
+ function popContext() {
54
+ return stack.pop();
55
+ }
56
+ /**
57
+ * Initializes the current context to false and pushes it onto the stack.
58
+ * These booleans represent whether 'this' has been used in the context.
59
+ * @returns {void}
60
+ * @private
61
+ */
62
+ function enterFunction() {
63
+ pushContext();
64
+ }
65
+ /**
66
+ * Check if the node is an instance method
67
+ * @param {ASTNode} node node to check
68
+ * @returns {boolean} True if its an instance method
69
+ * @private
70
+ */
71
+ function isInstanceMethod(node) {
72
+ switch (node.type) {
73
+ case "MethodDefinition": return !node.static && node.kind !== "constructor";
74
+ case "AccessorProperty":
75
+ case "PropertyDefinition": return !node.static && enforceForClassFields;
76
+ default: return !1;
77
+ }
78
+ }
79
+ /**
80
+ * Check if the node's parent class implements any interfaces
81
+ * @param {ASTNode} node node to check
82
+ * @returns {boolean} True if parent class implements interfaces
83
+ * @private
84
+ */
85
+ function hasImplements(node) {
86
+ let classNode = node.parent.parent;
87
+ return classNode?.type === "ClassDeclaration" && classNode.implements?.length > 0;
88
+ }
89
+ /**
90
+ * Check if the node is an instance method not excluded by config
91
+ * @param {ASTNode} node node to check
92
+ * @returns {boolean} True if it is an instance method, and not excluded by config
93
+ * @private
94
+ */
95
+ function isIncludedInstanceMethod(node) {
96
+ if (isInstanceMethod(node)) {
97
+ if (node.computed) return !0;
98
+ if (ignoreOverrideMethods && node.override || ignoreClassesWithImplements && hasImplements(node) && (ignoreClassesWithImplements === "all" || ignoreClassesWithImplements === "public-fields" && node.key.type !== "PrivateIdentifier" && (!node.accessibility || node.accessibility === "public"))) return !1;
99
+ let hashIfNeeded = node.key.type === "PrivateIdentifier" ? "#" : "", name = node.key.type === "Literal" ? astUtils.getStaticStringValue(node.key) : node.key.name || "";
100
+ return !exceptMethods.has(hashIfNeeded + name);
101
+ }
102
+ return !1;
103
+ }
104
+ /**
105
+ * Checks if we are leaving a function that is a method, and reports if 'this' has not been used.
106
+ * Static methods and the constructor are exempt.
107
+ * Then pops the context off the stack.
108
+ * @param {ASTNode} node A function node that was entered.
109
+ * @returns {void}
110
+ * @private
111
+ */
112
+ function exitFunction(node) {
113
+ let methodUsesThis = popContext();
114
+ isIncludedInstanceMethod(node.parent) && !methodUsesThis && context.report({
115
+ node,
116
+ loc: astUtils.getFunctionHeadLoc(node, context.sourceCode),
117
+ messageId: "missingThis",
118
+ data: { name: astUtils.getFunctionNameWithKind(node) }
119
+ });
120
+ }
121
+ /**
122
+ * Mark the current context as having used 'this'.
123
+ * @returns {void}
124
+ * @private
125
+ */
126
+ function markThisUsed() {
127
+ stack.length && (stack[stack.length - 1] = !0);
128
+ }
129
+ return {
130
+ FunctionDeclaration: enterFunction,
131
+ "FunctionDeclaration:exit": exitFunction,
132
+ FunctionExpression: enterFunction,
133
+ "FunctionExpression:exit": exitFunction,
134
+ "AccessorProperty > *.key:exit": pushContext,
135
+ "AccessorProperty:exit": popContext,
136
+ "PropertyDefinition > *.key:exit": pushContext,
137
+ "PropertyDefinition:exit": popContext,
138
+ StaticBlock: pushContext,
139
+ "StaticBlock:exit": popContext,
140
+ ThisExpression: markThisUsed,
141
+ Super: markThisUsed,
142
+ ...enforceForClassFields && {
143
+ "AccessorProperty > ArrowFunctionExpression.value": enterFunction,
144
+ "AccessorProperty > ArrowFunctionExpression.value:exit": exitFunction,
145
+ "PropertyDefinition > ArrowFunctionExpression.value": enterFunction,
146
+ "PropertyDefinition > ArrowFunctionExpression.value:exit": exitFunction
147
+ }
148
+ };
149
+ }
150
+ };
151
+ }));
152
+ //#endregion
153
+ //#region src-js/generated/plugin-eslint/rules/class-methods-use-this.cjs
154
+ module.exports = require_class_methods_use_this().create;
155
+ //#endregion