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,147 @@
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/max-statements-per-line.js
3
+ /**
4
+ * @fileoverview Specify the maximum number of statements allowed per line.
5
+ * @author Kenneth Williams
6
+ * @deprecated in ESLint v8.53.0
7
+ */
8
+ var require_max_statements_per_line = /* @__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: "max-statements-per-line",
27
+ url: "https://eslint.style/rules/max-statements-per-line"
28
+ }
29
+ }]
30
+ },
31
+ type: "layout",
32
+ docs: {
33
+ description: "Enforce a maximum number of statements allowed per line",
34
+ recommended: !1,
35
+ url: "https://eslint.org/docs/latest/rules/max-statements-per-line"
36
+ },
37
+ schema: [{
38
+ type: "object",
39
+ properties: { max: {
40
+ type: "integer",
41
+ minimum: 1,
42
+ default: 1
43
+ } },
44
+ additionalProperties: !1
45
+ }],
46
+ messages: { exceed: "This line has {{numberOfStatementsOnThisLine}} {{statements}}. Maximum allowed is {{maxStatementsPerLine}}." }
47
+ },
48
+ create(context) {
49
+ let sourceCode = context.sourceCode, options = context.options[0] || {}, maxStatementsPerLine = options.max === void 0 ? 1 : options.max, lastStatementLine = 0, numberOfStatementsOnThisLine = 0, firstExtraStatement, SINGLE_CHILD_ALLOWED = /^(?:(?:DoWhile|For|ForIn|ForOf|If|Labeled|While)Statement|Export(?:Default|Named)Declaration)$/u;
50
+ /**
51
+ * Reports with the first extra statement, and clears it.
52
+ * @returns {void}
53
+ */
54
+ function reportFirstExtraStatementAndClear() {
55
+ firstExtraStatement && context.report({
56
+ node: firstExtraStatement,
57
+ messageId: "exceed",
58
+ data: {
59
+ numberOfStatementsOnThisLine,
60
+ maxStatementsPerLine,
61
+ statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements"
62
+ }
63
+ }), firstExtraStatement = null;
64
+ }
65
+ /**
66
+ * Gets the actual last token of a given node.
67
+ * @param {ASTNode} node A node to get. This is a node except EmptyStatement.
68
+ * @returns {Token} The actual last token.
69
+ */
70
+ function getActualLastToken(node) {
71
+ return sourceCode.getLastToken(node, astUtils.isNotSemicolonToken);
72
+ }
73
+ /**
74
+ * Addresses a given node.
75
+ * It updates the state of this rule, then reports the node if the node violated this rule.
76
+ * @param {ASTNode} node A node to check.
77
+ * @returns {void}
78
+ */
79
+ function enterStatement(node) {
80
+ let line = node.loc.start.line;
81
+ SINGLE_CHILD_ALLOWED.test(node.parent.type) && node.parent.alternate !== node || (line === lastStatementLine ? numberOfStatementsOnThisLine += 1 : (reportFirstExtraStatementAndClear(), numberOfStatementsOnThisLine = 1, lastStatementLine = line), numberOfStatementsOnThisLine === maxStatementsPerLine + 1 && (firstExtraStatement ||= node));
82
+ }
83
+ /**
84
+ * Updates the state of this rule with the end line of leaving node to check with the next statement.
85
+ * @param {ASTNode} node A node to check.
86
+ * @returns {void}
87
+ */
88
+ function leaveStatement(node) {
89
+ let line = getActualLastToken(node).loc.end.line;
90
+ line !== lastStatementLine && (reportFirstExtraStatementAndClear(), numberOfStatementsOnThisLine = 1, lastStatementLine = line);
91
+ }
92
+ return {
93
+ BreakStatement: enterStatement,
94
+ ClassDeclaration: enterStatement,
95
+ ContinueStatement: enterStatement,
96
+ DebuggerStatement: enterStatement,
97
+ DoWhileStatement: enterStatement,
98
+ ExpressionStatement: enterStatement,
99
+ ForInStatement: enterStatement,
100
+ ForOfStatement: enterStatement,
101
+ ForStatement: enterStatement,
102
+ FunctionDeclaration: enterStatement,
103
+ IfStatement: enterStatement,
104
+ ImportDeclaration: enterStatement,
105
+ LabeledStatement: enterStatement,
106
+ ReturnStatement: enterStatement,
107
+ SwitchStatement: enterStatement,
108
+ ThrowStatement: enterStatement,
109
+ TryStatement: enterStatement,
110
+ VariableDeclaration: enterStatement,
111
+ WhileStatement: enterStatement,
112
+ WithStatement: enterStatement,
113
+ ExportNamedDeclaration: enterStatement,
114
+ ExportDefaultDeclaration: enterStatement,
115
+ ExportAllDeclaration: enterStatement,
116
+ "BreakStatement:exit": leaveStatement,
117
+ "ClassDeclaration:exit": leaveStatement,
118
+ "ContinueStatement:exit": leaveStatement,
119
+ "DebuggerStatement:exit": leaveStatement,
120
+ "DoWhileStatement:exit": leaveStatement,
121
+ "ExpressionStatement:exit": leaveStatement,
122
+ "ForInStatement:exit": leaveStatement,
123
+ "ForOfStatement:exit": leaveStatement,
124
+ "ForStatement:exit": leaveStatement,
125
+ "FunctionDeclaration:exit": leaveStatement,
126
+ "IfStatement:exit": leaveStatement,
127
+ "ImportDeclaration:exit": leaveStatement,
128
+ "LabeledStatement:exit": leaveStatement,
129
+ "ReturnStatement:exit": leaveStatement,
130
+ "SwitchStatement:exit": leaveStatement,
131
+ "ThrowStatement:exit": leaveStatement,
132
+ "TryStatement:exit": leaveStatement,
133
+ "VariableDeclaration:exit": leaveStatement,
134
+ "WhileStatement:exit": leaveStatement,
135
+ "WithStatement:exit": leaveStatement,
136
+ "ExportNamedDeclaration:exit": leaveStatement,
137
+ "ExportDefaultDeclaration:exit": leaveStatement,
138
+ "ExportAllDeclaration:exit": leaveStatement,
139
+ "Program:exit": reportFirstExtraStatementAndClear
140
+ };
141
+ }
142
+ };
143
+ }));
144
+ //#endregion
145
+ //#region src-js/generated/plugin-eslint/rules/max-statements-per-line.cjs
146
+ module.exports = require_max_statements_per_line().create;
147
+ //#endregion
@@ -0,0 +1,119 @@
1
+ const require_chunk = require("../common/chunk.cjs"), require_ast_utils$1 = require("../common/ast-utils.cjs"), require_string_utils$1 = require("../common/string-utils.cjs");
2
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/max-statements.js
3
+ /**
4
+ * @fileoverview A rule to set the maximum number of statements in a function.
5
+ * @author Ian Christian Myers
6
+ */
7
+ var require_max_statements = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t(), { upperCaseFirst } = require_string_utils$1.t();
9
+ /** @type {import('../types').Rule.RuleModule} */
10
+ module.exports = {
11
+ meta: {
12
+ type: "suggestion",
13
+ docs: {
14
+ description: "Enforce a maximum number of statements allowed in function blocks",
15
+ recommended: !1,
16
+ url: "https://eslint.org/docs/latest/rules/max-statements"
17
+ },
18
+ schema: [{ oneOf: [{
19
+ type: "integer",
20
+ minimum: 0
21
+ }, {
22
+ type: "object",
23
+ properties: {
24
+ maximum: {
25
+ type: "integer",
26
+ minimum: 0
27
+ },
28
+ max: {
29
+ type: "integer",
30
+ minimum: 0
31
+ }
32
+ },
33
+ additionalProperties: !1
34
+ }] }, {
35
+ type: "object",
36
+ properties: { ignoreTopLevelFunctions: { type: "boolean" } },
37
+ additionalProperties: !1
38
+ }],
39
+ messages: { exceed: "{{name}} has too many statements ({{count}}). Maximum allowed is {{max}}." }
40
+ },
41
+ create(context) {
42
+ let functionStack = [], option = context.options[0], ignoreTopLevelFunctions = context.options[1] && context.options[1].ignoreTopLevelFunctions || !1, topLevelFunctions = [], maxStatements = 10;
43
+ typeof option == "object" && (Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max")) ? maxStatements = option.maximum || option.max : typeof option == "number" && (maxStatements = option);
44
+ /**
45
+ * Reports a node if it has too many statements
46
+ * @param {ASTNode} node node to evaluate
47
+ * @param {number} count Number of statements in node
48
+ * @param {number} max Maximum number of statements allowed
49
+ * @returns {void}
50
+ * @private
51
+ */
52
+ function reportIfTooManyStatements(node, count, max) {
53
+ if (count > max) {
54
+ let name = upperCaseFirst(astUtils.getFunctionNameWithKind(node));
55
+ context.report({
56
+ node,
57
+ messageId: "exceed",
58
+ data: {
59
+ name,
60
+ count,
61
+ max
62
+ }
63
+ });
64
+ }
65
+ }
66
+ /**
67
+ * When parsing a new function, store it in our function stack
68
+ * @returns {void}
69
+ * @private
70
+ */
71
+ function startFunction() {
72
+ functionStack.push(0);
73
+ }
74
+ /**
75
+ * Evaluate the node at the end of function
76
+ * @param {ASTNode} node node to evaluate
77
+ * @returns {void}
78
+ * @private
79
+ */
80
+ function endFunction(node) {
81
+ let count = functionStack.pop();
82
+ node.type !== "StaticBlock" && (ignoreTopLevelFunctions && functionStack.length === 0 ? topLevelFunctions.push({
83
+ node,
84
+ count
85
+ }) : reportIfTooManyStatements(node, count, maxStatements));
86
+ }
87
+ /**
88
+ * Increment the count of the functions
89
+ * @param {ASTNode} node node to evaluate
90
+ * @returns {void}
91
+ * @private
92
+ */
93
+ function countStatements(node) {
94
+ functionStack[functionStack.length - 1] += node.body.length;
95
+ }
96
+ return {
97
+ FunctionDeclaration: startFunction,
98
+ FunctionExpression: startFunction,
99
+ ArrowFunctionExpression: startFunction,
100
+ StaticBlock: startFunction,
101
+ BlockStatement: countStatements,
102
+ "FunctionDeclaration:exit": endFunction,
103
+ "FunctionExpression:exit": endFunction,
104
+ "ArrowFunctionExpression:exit": endFunction,
105
+ "StaticBlock:exit": endFunction,
106
+ "Program:exit"() {
107
+ topLevelFunctions.length !== 1 && topLevelFunctions.forEach((element) => {
108
+ let count = element.count, node = element.node;
109
+ reportIfTooManyStatements(node, count, maxStatements);
110
+ });
111
+ }
112
+ };
113
+ }
114
+ };
115
+ }));
116
+ //#endregion
117
+ //#region src-js/generated/plugin-eslint/rules/max-statements.cjs
118
+ module.exports = require_max_statements().create;
119
+ //#endregion
@@ -0,0 +1,319 @@
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/multiline-comment-style.js
3
+ /**
4
+ * @fileoverview enforce a particular style for multiline comments
5
+ * @author Teddy Katz
6
+ * @deprecated in ESLint v9.3.0
7
+ */
8
+ var require_multiline_comment_style = /* @__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: "9.3.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: "multiline-comment-style",
27
+ url: "https://eslint.style/rules/multiline-comment-style"
28
+ }
29
+ }]
30
+ },
31
+ type: "suggestion",
32
+ docs: {
33
+ description: "Enforce a particular style for multiline comments",
34
+ recommended: !1,
35
+ url: "https://eslint.org/docs/latest/rules/multiline-comment-style"
36
+ },
37
+ fixable: "whitespace",
38
+ schema: { anyOf: [{
39
+ type: "array",
40
+ items: [{ enum: ["starred-block", "bare-block"] }],
41
+ additionalItems: !1
42
+ }, {
43
+ type: "array",
44
+ items: [{ enum: ["separate-lines"] }, {
45
+ type: "object",
46
+ properties: { checkJSDoc: { type: "boolean" } },
47
+ additionalProperties: !1
48
+ }],
49
+ additionalItems: !1
50
+ }] },
51
+ messages: {
52
+ expectedBlock: "Expected a block comment instead of consecutive line comments.",
53
+ expectedBareBlock: "Expected a block comment without padding stars.",
54
+ startNewline: "Expected a linebreak after '/*'.",
55
+ endNewline: "Expected a linebreak before '*/'.",
56
+ missingStar: "Expected a '*' at the start of this line.",
57
+ alignment: "Expected this line to be aligned with the start of the comment.",
58
+ expectedLines: "Expected multiple line comments instead of a block comment."
59
+ }
60
+ },
61
+ create(context) {
62
+ let sourceCode = context.sourceCode, option = context.options[0] || "starred-block", checkJSDoc = !!(context.options[1] || {}).checkJSDoc;
63
+ /**
64
+ * Checks if a comment line is starred.
65
+ * @param {string} line A string representing a comment line.
66
+ * @returns {boolean} Whether or not the comment line is starred.
67
+ */
68
+ function isStarredCommentLine(line) {
69
+ return /^\s*\*/u.test(line);
70
+ }
71
+ /**
72
+ * Checks if a comment group is in starred-block form.
73
+ * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
74
+ * @returns {boolean} Whether or not the comment group is in starred block form.
75
+ */
76
+ function isStarredBlockComment([firstComment]) {
77
+ if (firstComment.type !== "Block") return !1;
78
+ let lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
79
+ return lines.length > 0 && lines.every((line, i) => (i === 0 || i === lines.length - 1 ? /^\s*$/u : /^\s*\*/u).test(line));
80
+ }
81
+ /**
82
+ * Checks if a comment group is in JSDoc form.
83
+ * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
84
+ * @returns {boolean} Whether or not the comment group is in JSDoc form.
85
+ */
86
+ function isJSDocComment([firstComment]) {
87
+ if (firstComment.type !== "Block") return !1;
88
+ let lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
89
+ return /^\*\s*$/u.test(lines[0]) && lines.slice(1, -1).every((line) => /^\s* /u.test(line)) && /^\s*$/u.test(lines.at(-1));
90
+ }
91
+ /**
92
+ * Processes a comment group that is currently in separate-line form, calculating the offset for each line.
93
+ * @param {Token[]} commentGroup A group of comments containing multiple line comments.
94
+ * @returns {string[]} An array of the processed lines.
95
+ */
96
+ function processSeparateLineComments(commentGroup) {
97
+ let allLinesHaveLeadingSpace = commentGroup.map(({ value }) => value).filter((line) => line.trim().length).every((line) => line.startsWith(" "));
98
+ return commentGroup.map(({ value }) => allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value);
99
+ }
100
+ /**
101
+ * Processes a comment group that is currently in starred-block form, calculating the offset for each line.
102
+ * @param {Token} comment A single block comment token in starred-block form.
103
+ * @returns {string[]} An array of the processed lines.
104
+ */
105
+ function processStarredBlockComment(comment) {
106
+ let lines = comment.value.split(astUtils.LINEBREAK_MATCHER).filter((line, i, linesArr) => !(i === 0 || i === linesArr.length - 1)).map((line) => line.replace(/^\s*$/u, "")), allLinesHaveLeadingSpace = lines.map((line) => line.replace(/\s*\*/u, "")).filter((line) => line.trim().length).every((line) => line.startsWith(" "));
107
+ return lines.map((line) => line.replace(allLinesHaveLeadingSpace ? /\s*\* ?/u : /\s*\*/u, ""));
108
+ }
109
+ /**
110
+ * Processes a comment group that is currently in bare-block form, calculating the offset for each line.
111
+ * @param {Token} comment A single block comment token in bare-block form.
112
+ * @returns {string[]} An array of the processed lines.
113
+ */
114
+ function processBareBlockComment(comment) {
115
+ let lines = comment.value.split(astUtils.LINEBREAK_MATCHER).map((line) => line.replace(/^\s*$/u, "")), leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `, offset = "";
116
+ for (let [i, line] of lines.entries()) {
117
+ if (!line.trim().length || i === 0) continue;
118
+ let [, lineOffset] = line.match(/^(\s*\*?\s*)/u);
119
+ if (lineOffset.length < leadingWhitespace.length) {
120
+ let newOffset = leadingWhitespace.slice(lineOffset.length - leadingWhitespace.length);
121
+ newOffset.length > offset.length && (offset = newOffset);
122
+ }
123
+ }
124
+ return lines.map((line) => {
125
+ let [, lineOffset, lineContents] = line.match(/^(\s*\*?\s*)(.*)/u);
126
+ return lineOffset.length > leadingWhitespace.length ? `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}` : lineOffset.length < leadingWhitespace.length ? `${lineOffset.slice(leadingWhitespace.length)}${lineContents}` : lineContents;
127
+ });
128
+ }
129
+ /**
130
+ * Gets a list of comment lines in a group, formatting leading whitespace as necessary.
131
+ * @param {Token[]} commentGroup A group of comments containing either multiple line comments or a single block comment.
132
+ * @returns {string[]} A list of comment lines.
133
+ */
134
+ function getCommentLines(commentGroup) {
135
+ let [firstComment] = commentGroup;
136
+ return firstComment.type === "Line" ? processSeparateLineComments(commentGroup) : isStarredBlockComment(commentGroup) ? processStarredBlockComment(firstComment) : processBareBlockComment(firstComment);
137
+ }
138
+ /**
139
+ * Gets the initial offset (whitespace) from the beginning of a line to a given comment token.
140
+ * @param {Token} comment The token to check.
141
+ * @returns {string} The offset from the beginning of a line to the token.
142
+ */
143
+ function getInitialOffset(comment) {
144
+ return sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0]);
145
+ }
146
+ /**
147
+ * Converts a comment into starred-block form
148
+ * @param {Token} firstComment The first comment of the group being converted
149
+ * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
150
+ * @returns {string} A representation of the comment value in starred-block form, excluding start and end markers
151
+ */
152
+ function convertToStarredBlock(firstComment, commentLinesList) {
153
+ let initialOffset = getInitialOffset(firstComment);
154
+ return `/*\n${commentLinesList.map((line) => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`;
155
+ }
156
+ /**
157
+ * Converts a comment into separate-line form
158
+ * @param {Token} firstComment The first comment of the group being converted
159
+ * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
160
+ * @returns {string} A representation of the comment value in separate-line form
161
+ */
162
+ function convertToSeparateLines(firstComment, commentLinesList) {
163
+ return commentLinesList.map((line) => `// ${line}`).join(`\n${getInitialOffset(firstComment)}`);
164
+ }
165
+ /**
166
+ * Converts a comment into bare-block form
167
+ * @param {Token} firstComment The first comment of the group being converted
168
+ * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
169
+ * @returns {string} A representation of the comment value in bare-block form
170
+ */
171
+ function convertToBlock(firstComment, commentLinesList) {
172
+ return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`;
173
+ }
174
+ /**
175
+ * Each method checks a group of comments to see if it's valid according to the given option.
176
+ * @param {Token[]} commentGroup A list of comments that appear together. This will either contain a single
177
+ * block comment or multiple line comments.
178
+ * @returns {void}
179
+ */
180
+ let commentGroupCheckers = {
181
+ "starred-block"(commentGroup) {
182
+ let [firstComment] = commentGroup, commentLines = getCommentLines(commentGroup);
183
+ if (!commentLines.some((value) => value.includes("*/"))) if (commentGroup.length > 1) context.report({
184
+ loc: {
185
+ start: firstComment.loc.start,
186
+ end: commentGroup.at(-1).loc.end
187
+ },
188
+ messageId: "expectedBlock",
189
+ fix(fixer) {
190
+ let range = [firstComment.range[0], commentGroup.at(-1).range[1]];
191
+ return commentLines.some((value) => value.startsWith("/")) ? null : fixer.replaceTextRange(range, convertToStarredBlock(firstComment, commentLines));
192
+ }
193
+ });
194
+ else {
195
+ let lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER), expectedLinePrefix = `${getInitialOffset(firstComment)} *`;
196
+ if (!/^\*?\s*$/u.test(lines[0])) {
197
+ let start = firstComment.value.startsWith("*") ? firstComment.range[0] + 1 : firstComment.range[0];
198
+ context.report({
199
+ loc: {
200
+ start: firstComment.loc.start,
201
+ end: {
202
+ line: firstComment.loc.start.line,
203
+ column: firstComment.loc.start.column + 2
204
+ }
205
+ },
206
+ messageId: "startNewline",
207
+ fix: (fixer) => fixer.insertTextAfterRange([start, start + 2], `\n${expectedLinePrefix}`)
208
+ });
209
+ }
210
+ /^\s*$/u.test(lines.at(-1)) || context.report({
211
+ loc: {
212
+ start: {
213
+ line: firstComment.loc.end.line,
214
+ column: firstComment.loc.end.column - 2
215
+ },
216
+ end: firstComment.loc.end
217
+ },
218
+ messageId: "endNewline",
219
+ fix: (fixer) => fixer.replaceTextRange([firstComment.range[1] - 2, firstComment.range[1]], `\n${expectedLinePrefix}/`)
220
+ });
221
+ for (let lineNumber = firstComment.loc.start.line + 1; lineNumber <= firstComment.loc.end.line; lineNumber++) {
222
+ let lineText = sourceCode.lines[lineNumber - 1], errorType = isStarredCommentLine(lineText) ? "alignment" : "missingStar";
223
+ lineText.startsWith(expectedLinePrefix) || context.report({
224
+ loc: {
225
+ start: {
226
+ line: lineNumber,
227
+ column: 0
228
+ },
229
+ end: {
230
+ line: lineNumber,
231
+ column: lineText.length
232
+ }
233
+ },
234
+ messageId: errorType,
235
+ fix(fixer) {
236
+ let lineStartIndex = sourceCode.getIndexFromLoc({
237
+ line: lineNumber,
238
+ column: 0
239
+ });
240
+ if (errorType === "alignment") {
241
+ let [, commentTextPrefix = ""] = lineText.match(/^(\s*\*)/u) || [], commentTextStartIndex = lineStartIndex + commentTextPrefix.length;
242
+ return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], expectedLinePrefix);
243
+ }
244
+ let [, commentTextPrefix = ""] = lineText.match(/^(\s*)/u) || [], commentTextStartIndex = lineStartIndex + commentTextPrefix.length, offset;
245
+ for (let [idx, line] of lines.entries()) {
246
+ if (!/\S+/u.test(line)) continue;
247
+ let [, prefix = "", initialOffset = ""] = sourceCode.lines[firstComment.loc.start.line - 1 + idx].match(/^(\s*(?:\/?\*)?(\s*))/u) || [];
248
+ offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`, /^\s*\//u.test(lineText) && offset.length === 0 && (offset += " ");
249
+ break;
250
+ }
251
+ return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`);
252
+ }
253
+ });
254
+ }
255
+ }
256
+ },
257
+ "separate-lines"(commentGroup) {
258
+ let [firstComment] = commentGroup, isJSDoc = isJSDocComment(commentGroup);
259
+ if (firstComment.type !== "Block" || !checkJSDoc && isJSDoc) return;
260
+ let commentLines = getCommentLines(commentGroup);
261
+ isJSDoc && (commentLines = commentLines.slice(1, commentLines.length - 1));
262
+ let tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: !0 });
263
+ tokenAfter && firstComment.loc.end.line === tokenAfter.loc.start.line || context.report({
264
+ loc: {
265
+ start: firstComment.loc.start,
266
+ end: {
267
+ line: firstComment.loc.start.line,
268
+ column: firstComment.loc.start.column + 2
269
+ }
270
+ },
271
+ messageId: "expectedLines",
272
+ fix(fixer) {
273
+ return fixer.replaceText(firstComment, convertToSeparateLines(firstComment, commentLines));
274
+ }
275
+ });
276
+ },
277
+ "bare-block"(commentGroup) {
278
+ if (isJSDocComment(commentGroup)) return;
279
+ let [firstComment] = commentGroup, commentLines = getCommentLines(commentGroup);
280
+ firstComment.type === "Line" && commentLines.length > 1 && !commentLines.some((value) => value.includes("*/")) && context.report({
281
+ loc: {
282
+ start: firstComment.loc.start,
283
+ end: commentGroup.at(-1).loc.end
284
+ },
285
+ messageId: "expectedBlock",
286
+ fix(fixer) {
287
+ return fixer.replaceTextRange([firstComment.range[0], commentGroup.at(-1).range[1]], convertToBlock(firstComment, commentLines));
288
+ }
289
+ }), isStarredBlockComment(commentGroup) && context.report({
290
+ loc: {
291
+ start: firstComment.loc.start,
292
+ end: {
293
+ line: firstComment.loc.start.line,
294
+ column: firstComment.loc.start.column + 2
295
+ }
296
+ },
297
+ messageId: "expectedBareBlock",
298
+ fix(fixer) {
299
+ return fixer.replaceText(firstComment, convertToBlock(firstComment, commentLines));
300
+ }
301
+ });
302
+ }
303
+ };
304
+ return { Program() {
305
+ return sourceCode.getAllComments().filter((comment) => comment.type !== "Shebang").filter((comment) => !astUtils.COMMENTS_IGNORE_PATTERN.test(comment.value)).filter((comment) => {
306
+ let tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: !0 });
307
+ return !tokenBefore || tokenBefore.loc.end.line < comment.loc.start.line;
308
+ }).reduce((commentGroups, comment, index, commentList) => {
309
+ let tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: !0 });
310
+ return comment.type === "Line" && index && commentList[index - 1].type === "Line" && tokenBefore && tokenBefore.loc.end.line === comment.loc.start.line - 1 && tokenBefore === commentList[index - 1] ? commentGroups.at(-1).push(comment) : commentGroups.push([comment]), commentGroups;
311
+ }, []).filter((commentGroup) => !(commentGroup.length === 1 && commentGroup[0].loc.start.line === commentGroup[0].loc.end.line)).forEach(commentGroupCheckers[option]);
312
+ } };
313
+ }
314
+ };
315
+ }));
316
+ //#endregion
317
+ //#region src-js/generated/plugin-eslint/rules/multiline-comment-style.cjs
318
+ module.exports = require_multiline_comment_style().create;
319
+ //#endregion