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,112 @@
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/template-curly-spacing.js
3
+ /**
4
+ * @fileoverview Rule to enforce spacing around embedded expressions of template strings
5
+ * @author Toru Nagashima
6
+ * @deprecated in ESLint v8.53.0
7
+ */
8
+ var require_template_curly_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: "template-curly-spacing",
27
+ url: "https://eslint.style/rules/template-curly-spacing"
28
+ }
29
+ }]
30
+ },
31
+ type: "layout",
32
+ docs: {
33
+ description: "Require or disallow spacing around embedded expressions of template strings",
34
+ recommended: !1,
35
+ url: "https://eslint.org/docs/latest/rules/template-curly-spacing"
36
+ },
37
+ fixable: "whitespace",
38
+ schema: [{ enum: ["always", "never"] }],
39
+ messages: {
40
+ expectedBefore: "Expected space(s) before '}'.",
41
+ expectedAfter: "Expected space(s) after '${'.",
42
+ unexpectedBefore: "Unexpected space(s) before '}'.",
43
+ unexpectedAfter: "Unexpected space(s) after '${'."
44
+ }
45
+ },
46
+ create(context) {
47
+ let sourceCode = context.sourceCode, always = context.options[0] === "always";
48
+ /**
49
+ * Checks spacing before `}` of a given token.
50
+ * @param {Token} token A token to check. This is a Template token.
51
+ * @returns {void}
52
+ */
53
+ function checkSpacingBefore(token) {
54
+ if (!token.value.startsWith("}")) return;
55
+ let prevToken = sourceCode.getTokenBefore(token, { includeComments: !0 }), hasSpace = sourceCode.isSpaceBetween(prevToken, token);
56
+ astUtils.isTokenOnSameLine(prevToken, token) && (always && !hasSpace && context.report({
57
+ loc: {
58
+ start: token.loc.start,
59
+ end: {
60
+ line: token.loc.start.line,
61
+ column: token.loc.start.column + 1
62
+ }
63
+ },
64
+ messageId: "expectedBefore",
65
+ fix: (fixer) => fixer.insertTextBefore(token, " ")
66
+ }), !always && hasSpace && context.report({
67
+ loc: {
68
+ start: prevToken.loc.end,
69
+ end: token.loc.start
70
+ },
71
+ messageId: "unexpectedBefore",
72
+ fix: (fixer) => fixer.removeRange([prevToken.range[1], token.range[0]])
73
+ }));
74
+ }
75
+ /**
76
+ * Checks spacing after `${` of a given token.
77
+ * @param {Token} token A token to check. This is a Template token.
78
+ * @returns {void}
79
+ */
80
+ function checkSpacingAfter(token) {
81
+ if (!token.value.endsWith("${")) return;
82
+ let nextToken = sourceCode.getTokenAfter(token, { includeComments: !0 }), hasSpace = sourceCode.isSpaceBetween(token, nextToken);
83
+ astUtils.isTokenOnSameLine(token, nextToken) && (always && !hasSpace && context.report({
84
+ loc: {
85
+ start: {
86
+ line: token.loc.end.line,
87
+ column: token.loc.end.column - 2
88
+ },
89
+ end: token.loc.end
90
+ },
91
+ messageId: "expectedAfter",
92
+ fix: (fixer) => fixer.insertTextAfter(token, " ")
93
+ }), !always && hasSpace && context.report({
94
+ loc: {
95
+ start: token.loc.end,
96
+ end: nextToken.loc.start
97
+ },
98
+ messageId: "unexpectedAfter",
99
+ fix: (fixer) => fixer.removeRange([token.range[1], nextToken.range[0]])
100
+ }));
101
+ }
102
+ return { TemplateElement(node) {
103
+ let token = sourceCode.getFirstToken(node);
104
+ checkSpacingBefore(token), checkSpacingAfter(token);
105
+ } };
106
+ }
107
+ };
108
+ }));
109
+ //#endregion
110
+ //#region src-js/generated/plugin-eslint/rules/template-curly-spacing.cjs
111
+ module.exports = require_template_curly_spacing().create;
112
+ //#endregion
@@ -0,0 +1,82 @@
1
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/template-tag-spacing.js
2
+ /**
3
+ * @fileoverview Rule to check spacing between template tags and their literals
4
+ * @author Jonathan Wilsson
5
+ * @deprecated in ESLint v8.53.0
6
+ */
7
+ var require_template_tag_spacing = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
8
+ /** @type {import('../types').Rule.RuleModule} */
9
+ module.exports = {
10
+ meta: {
11
+ deprecated: {
12
+ message: "Formatting rules are being moved out of ESLint core.",
13
+ url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
14
+ deprecatedSince: "8.53.0",
15
+ availableUntil: "11.0.0",
16
+ replacedBy: [{
17
+ message: "ESLint Stylistic now maintains deprecated stylistic core rules.",
18
+ url: "https://eslint.style/guide/migration",
19
+ plugin: {
20
+ name: "@stylistic/eslint-plugin",
21
+ url: "https://eslint.style"
22
+ },
23
+ rule: {
24
+ name: "template-tag-spacing",
25
+ url: "https://eslint.style/rules/template-tag-spacing"
26
+ }
27
+ }]
28
+ },
29
+ type: "layout",
30
+ docs: {
31
+ description: "Require or disallow spacing between template tags and their literals",
32
+ recommended: !1,
33
+ url: "https://eslint.org/docs/latest/rules/template-tag-spacing"
34
+ },
35
+ fixable: "whitespace",
36
+ schema: [{ enum: ["always", "never"] }],
37
+ messages: {
38
+ unexpected: "Unexpected space between template tag and template literal.",
39
+ missing: "Missing space between template tag and template literal."
40
+ }
41
+ },
42
+ create(context) {
43
+ let never = context.options[0] !== "always", sourceCode = context.sourceCode;
44
+ /**
45
+ * Check if a space is present between a template tag and its literal
46
+ * @param {ASTNode} node node to evaluate
47
+ * @returns {void}
48
+ * @private
49
+ */
50
+ function checkSpacing(node) {
51
+ let tagToken = sourceCode.getTokenBefore(node.quasi), literalToken = sourceCode.getFirstToken(node.quasi), hasWhitespace = sourceCode.isSpaceBetweenTokens(tagToken, literalToken);
52
+ never && hasWhitespace ? context.report({
53
+ node,
54
+ loc: {
55
+ start: tagToken.loc.end,
56
+ end: literalToken.loc.start
57
+ },
58
+ messageId: "unexpected",
59
+ fix(fixer) {
60
+ let comments = sourceCode.getCommentsBefore(node.quasi);
61
+ return comments.some((comment) => comment.type === "Line") ? null : fixer.replaceTextRange([tagToken.range[1], literalToken.range[0]], comments.reduce((text, comment) => text + sourceCode.getText(comment), ""));
62
+ }
63
+ }) : !never && !hasWhitespace && context.report({
64
+ node,
65
+ loc: {
66
+ start: node.loc.start,
67
+ end: literalToken.loc.start
68
+ },
69
+ messageId: "missing",
70
+ fix(fixer) {
71
+ return fixer.insertTextAfter(tagToken, " ");
72
+ }
73
+ });
74
+ }
75
+ return { TaggedTemplateExpression: checkSpacing };
76
+ }
77
+ };
78
+ }));
79
+ //#endregion
80
+ //#region src-js/generated/plugin-eslint/rules/template-tag-spacing.cjs
81
+ module.exports = require_template_tag_spacing().create;
82
+ //#endregion
@@ -0,0 +1,52 @@
1
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/unicode-bom.js
2
+ /**
3
+ * @fileoverview Require or disallow Unicode BOM
4
+ * @author Andrew Johnston <https://github.com/ehjay>
5
+ */
6
+ var require_unicode_bom = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
7
+ /** @type {import('../types').Rule.RuleModule} */
8
+ module.exports = {
9
+ meta: {
10
+ type: "layout",
11
+ defaultOptions: ["never"],
12
+ docs: {
13
+ description: "Require or disallow Unicode byte order mark (BOM)",
14
+ recommended: !1,
15
+ url: "https://eslint.org/docs/latest/rules/unicode-bom"
16
+ },
17
+ fixable: "whitespace",
18
+ schema: [{ enum: ["always", "never"] }],
19
+ messages: {
20
+ expected: "Expected Unicode BOM (Byte Order Mark).",
21
+ unexpected: "Unexpected Unicode BOM (Byte Order Mark)."
22
+ }
23
+ },
24
+ create(context) {
25
+ return { Program: function checkUnicodeBOM(node) {
26
+ let sourceCode = context.sourceCode, location = {
27
+ column: 0,
28
+ line: 1
29
+ }, [requireBOM] = context.options;
30
+ !sourceCode.hasBOM && requireBOM === "always" ? context.report({
31
+ node,
32
+ loc: location,
33
+ messageId: "expected",
34
+ fix(fixer) {
35
+ return fixer.insertTextBeforeRange([0, 1], "");
36
+ }
37
+ }) : sourceCode.hasBOM && requireBOM === "never" && context.report({
38
+ node,
39
+ loc: location,
40
+ messageId: "unexpected",
41
+ fix(fixer) {
42
+ return fixer.removeRange([-1, 0]);
43
+ }
44
+ });
45
+ } };
46
+ }
47
+ };
48
+ }));
49
+ //#endregion
50
+ //#region src-js/generated/plugin-eslint/rules/unicode-bom.cjs
51
+ module.exports = require_unicode_bom().create;
52
+ //#endregion
@@ -0,0 +1,144 @@
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/use-isnan.js
3
+ /**
4
+ * @fileoverview Rule to flag comparisons to the value NaN
5
+ * @author James Allardice
6
+ */
7
+ var require_use_isnan = /* @__PURE__ */ require_chunk.t(((exports, module) => {
8
+ let astUtils = require_ast_utils$1.t();
9
+ /**
10
+ * Determines if the given node is a NaN `Identifier` node.
11
+ * @param {ASTNode|null} node The node to check.
12
+ * @returns {boolean} `true` if the node is 'NaN' identifier.
13
+ */
14
+ function isNaNIdentifier(node) {
15
+ if (!node) return !1;
16
+ let nodeToCheck = node.type === "SequenceExpression" ? node.expressions.at(-1) : node;
17
+ return astUtils.isSpecificId(nodeToCheck, "NaN") || astUtils.isSpecificMemberAccess(nodeToCheck, "Number", "NaN");
18
+ }
19
+ /** @type {import('../types').Rule.RuleModule} */
20
+ module.exports = {
21
+ meta: {
22
+ hasSuggestions: !0,
23
+ type: "problem",
24
+ docs: {
25
+ description: "Require calls to `isNaN()` when checking for `NaN`",
26
+ recommended: !0,
27
+ url: "https://eslint.org/docs/latest/rules/use-isnan"
28
+ },
29
+ schema: [{
30
+ type: "object",
31
+ properties: {
32
+ enforceForSwitchCase: { type: "boolean" },
33
+ enforceForIndexOf: { type: "boolean" }
34
+ },
35
+ additionalProperties: !1
36
+ }],
37
+ defaultOptions: [{
38
+ enforceForIndexOf: !1,
39
+ enforceForSwitchCase: !0
40
+ }],
41
+ messages: {
42
+ comparisonWithNaN: "Use the isNaN function to compare with NaN.",
43
+ switchNaN: "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.",
44
+ caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch.",
45
+ indexOfNaN: "Array prototype method '{{ methodName }}' cannot find NaN.",
46
+ replaceWithIsNaN: "Replace with Number.isNaN.",
47
+ replaceWithCastingAndIsNaN: "Replace with Number.isNaN and cast to a Number.",
48
+ replaceWithFindIndex: "Replace with Array.prototype.{{ methodName }}."
49
+ }
50
+ },
51
+ create(context) {
52
+ let [{ enforceForIndexOf, enforceForSwitchCase }] = context.options, sourceCode = context.sourceCode, fixableOperators = new Set([
53
+ "==",
54
+ "===",
55
+ "!=",
56
+ "!=="
57
+ ]), castableOperators = new Set(["==", "!="]);
58
+ /**
59
+ * Get a fixer for a binary expression that compares to NaN.
60
+ * @param {ASTNode} node The node to fix.
61
+ * @param {function(string): string} wrapValue A function that wraps the compared value with a fix.
62
+ * @returns {function(Fixer): Fix} The fixer function.
63
+ */
64
+ function getBinaryExpressionFixer(node, wrapValue) {
65
+ return (fixer) => {
66
+ let comparedValue = isNaNIdentifier(node.left) ? node.right : node.left, shouldWrap = comparedValue.type === "SequenceExpression", negation = node.operator[0] === "!" ? "!" : "", comparedValueText = sourceCode.getText(comparedValue);
67
+ shouldWrap && (comparedValueText = `(${comparedValueText})`);
68
+ let fixedValue = wrapValue(comparedValueText);
69
+ return fixer.replaceText(node, `${negation}${fixedValue}`);
70
+ };
71
+ }
72
+ /**
73
+ * Checks the given `BinaryExpression` node for `foo === NaN` and other comparisons.
74
+ * @param {ASTNode} node The node to check.
75
+ * @returns {void}
76
+ */
77
+ function checkBinaryExpression(node) {
78
+ if (/^(?:[<>]|[!=]=)=?$/u.test(node.operator) && (isNaNIdentifier(node.left) || isNaNIdentifier(node.right))) {
79
+ let suggestedFixes = [], isSequenceExpression = (isNaNIdentifier(node.left) ? node.left : node.right).type === "SequenceExpression", isSuggestable = fixableOperators.has(node.operator) && !isSequenceExpression, isCastable = castableOperators.has(node.operator);
80
+ isSuggestable && (suggestedFixes.push({
81
+ messageId: "replaceWithIsNaN",
82
+ fix: getBinaryExpressionFixer(node, (value) => `Number.isNaN(${value})`)
83
+ }), isCastable && suggestedFixes.push({
84
+ messageId: "replaceWithCastingAndIsNaN",
85
+ fix: getBinaryExpressionFixer(node, (value) => `Number.isNaN(Number(${value}))`)
86
+ })), context.report({
87
+ node,
88
+ messageId: "comparisonWithNaN",
89
+ suggest: suggestedFixes
90
+ });
91
+ }
92
+ }
93
+ /**
94
+ * Checks the discriminant and all case clauses of the given `SwitchStatement` node for `switch(NaN)` and `case NaN:`
95
+ * @param {ASTNode} node The node to check.
96
+ * @returns {void}
97
+ */
98
+ function checkSwitchStatement(node) {
99
+ isNaNIdentifier(node.discriminant) && context.report({
100
+ node,
101
+ messageId: "switchNaN"
102
+ });
103
+ for (let switchCase of node.cases) isNaNIdentifier(switchCase.test) && context.report({
104
+ node: switchCase,
105
+ messageId: "caseNaN"
106
+ });
107
+ }
108
+ /**
109
+ * Checks the given `CallExpression` node for `.indexOf(NaN)` and `.lastIndexOf(NaN)`.
110
+ * @param {ASTNode} node The node to check.
111
+ * @returns {void}
112
+ */
113
+ function checkCallExpression(node) {
114
+ let callee = astUtils.skipChainExpression(node.callee);
115
+ if (callee.type === "MemberExpression") {
116
+ let methodName = astUtils.getStaticPropertyName(callee);
117
+ if ((methodName === "indexOf" || methodName === "lastIndexOf") && node.arguments.length <= 2 && isNaNIdentifier(node.arguments[0])) {
118
+ let isSuggestable = node.arguments[0].type !== "SequenceExpression" && !node.arguments[1], suggestedFixes = [];
119
+ if (isSuggestable) {
120
+ let shouldWrap = callee.computed, findIndexMethod = methodName === "indexOf" ? "findIndex" : "findLastIndex", propertyName = shouldWrap ? `"${findIndexMethod}"` : findIndexMethod;
121
+ suggestedFixes.push({
122
+ messageId: "replaceWithFindIndex",
123
+ data: { methodName: findIndexMethod },
124
+ fix: (fixer) => [fixer.replaceText(callee.property, propertyName), fixer.replaceText(node.arguments[0], "Number.isNaN")]
125
+ });
126
+ }
127
+ context.report({
128
+ node,
129
+ messageId: "indexOfNaN",
130
+ data: { methodName },
131
+ suggest: suggestedFixes
132
+ });
133
+ }
134
+ }
135
+ }
136
+ let listeners = { BinaryExpression: checkBinaryExpression };
137
+ return enforceForSwitchCase && (listeners.SwitchStatement = checkSwitchStatement), enforceForIndexOf && (listeners.CallExpression = checkCallExpression), listeners;
138
+ }
139
+ };
140
+ }));
141
+ //#endregion
142
+ //#region src-js/generated/plugin-eslint/rules/use-isnan.cjs
143
+ module.exports = require_use_isnan().create;
144
+ //#endregion
@@ -0,0 +1,104 @@
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/valid-typeof.js
3
+ /**
4
+ * @fileoverview Ensures that the results of typeof are compared against a valid string
5
+ * @author Ian Christian Myers
6
+ */
7
+ var require_valid_typeof = /* @__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: "problem",
13
+ defaultOptions: [{ requireStringLiterals: !1 }],
14
+ docs: {
15
+ description: "Enforce comparing `typeof` expressions against valid strings",
16
+ recommended: !0,
17
+ url: "https://eslint.org/docs/latest/rules/valid-typeof"
18
+ },
19
+ hasSuggestions: !0,
20
+ schema: [{
21
+ type: "object",
22
+ properties: { requireStringLiterals: { type: "boolean" } },
23
+ additionalProperties: !1
24
+ }],
25
+ messages: {
26
+ invalidValue: "Invalid typeof comparison value.",
27
+ notString: "Typeof comparisons should be to string literals.",
28
+ suggestString: "Use `\"{{type}}\"` instead of `{{type}}`."
29
+ }
30
+ },
31
+ create(context) {
32
+ let VALID_TYPES = new Set([
33
+ "symbol",
34
+ "undefined",
35
+ "object",
36
+ "boolean",
37
+ "number",
38
+ "string",
39
+ "function",
40
+ "bigint"
41
+ ]), OPERATORS = new Set([
42
+ "==",
43
+ "===",
44
+ "!=",
45
+ "!=="
46
+ ]), sourceCode = context.sourceCode, [{ requireStringLiterals }] = context.options, globalScope;
47
+ /**
48
+ * Checks whether the given node represents a reference to a global variable that is not declared in the source code.
49
+ * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables.
50
+ * @param {ASTNode} node `Identifier` node to check.
51
+ * @returns {boolean} `true` if the node is a reference to a global variable.
52
+ */
53
+ function isReferenceToGlobalVariable(node) {
54
+ let variable = globalScope.set.get(node.name);
55
+ return variable && variable.defs.length === 0 && variable.references.some((ref) => ref.identifier === node);
56
+ }
57
+ /**
58
+ * Determines whether a node is a typeof expression.
59
+ * @param {ASTNode} node The node
60
+ * @returns {boolean} `true` if the node is a typeof expression
61
+ */
62
+ function isTypeofExpression(node) {
63
+ return node.type === "UnaryExpression" && node.operator === "typeof";
64
+ }
65
+ return {
66
+ Program(node) {
67
+ globalScope = sourceCode.getScope(node);
68
+ },
69
+ UnaryExpression(node) {
70
+ if (isTypeofExpression(node)) {
71
+ let { parent } = node;
72
+ if (parent.type === "BinaryExpression" && OPERATORS.has(parent.operator)) {
73
+ let sibling = parent.left === node ? parent.right : parent.left;
74
+ if (sibling.type === "Literal" || astUtils.isStaticTemplateLiteral(sibling)) {
75
+ let value = sibling.type === "Literal" ? sibling.value : sibling.quasis[0].value.cooked;
76
+ VALID_TYPES.has(value) || context.report({
77
+ node: sibling,
78
+ messageId: "invalidValue"
79
+ });
80
+ } else sibling.type === "Identifier" && sibling.name === "undefined" && isReferenceToGlobalVariable(sibling) ? context.report({
81
+ node: sibling,
82
+ messageId: requireStringLiterals ? "notString" : "invalidValue",
83
+ suggest: [{
84
+ messageId: "suggestString",
85
+ data: { type: "undefined" },
86
+ fix(fixer) {
87
+ return fixer.replaceText(sibling, "\"undefined\"");
88
+ }
89
+ }]
90
+ }) : requireStringLiterals && !isTypeofExpression(sibling) && context.report({
91
+ node: sibling,
92
+ messageId: "notString"
93
+ });
94
+ }
95
+ }
96
+ }
97
+ };
98
+ }
99
+ };
100
+ }));
101
+ //#endregion
102
+ //#region src-js/generated/plugin-eslint/rules/valid-typeof.cjs
103
+ module.exports = require_valid_typeof().create;
104
+ //#endregion
@@ -0,0 +1,94 @@
1
+ //#region ../../node_modules/.pnpm/eslint@9.39.3_jiti@2.6.1/node_modules/eslint/lib/rules/vars-on-top.js
2
+ /**
3
+ * @fileoverview Rule to enforce var declarations are only at the top of a function.
4
+ * @author Danny Fritz
5
+ * @author Gyandeep Singh
6
+ */
7
+ var require_vars_on_top = /* @__PURE__ */ require("../common/chunk.cjs").t(((exports, module) => {
8
+ /** @type {import('../types').Rule.RuleModule} */
9
+ module.exports = {
10
+ meta: {
11
+ type: "suggestion",
12
+ docs: {
13
+ description: "Require `var` declarations be placed at the top of their containing scope",
14
+ recommended: !1,
15
+ frozen: !0,
16
+ url: "https://eslint.org/docs/latest/rules/vars-on-top"
17
+ },
18
+ schema: [],
19
+ messages: { top: "All 'var' declarations must be at the top of the function scope." }
20
+ },
21
+ create(context) {
22
+ /**
23
+ * Has AST suggesting a directive.
24
+ * @param {ASTNode} node any node
25
+ * @returns {boolean} whether the given node structurally represents a directive
26
+ */
27
+ function looksLikeDirective(node) {
28
+ return node.type === "ExpressionStatement" && node.expression.type === "Literal" && typeof node.expression.value == "string";
29
+ }
30
+ /**
31
+ * Check to see if its a ES6 import declaration
32
+ * @param {ASTNode} node any node
33
+ * @returns {boolean} whether the given node represents a import declaration
34
+ */
35
+ function looksLikeImport(node) {
36
+ return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" || node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier";
37
+ }
38
+ /**
39
+ * Checks whether a given node is a variable declaration or not.
40
+ * @param {ASTNode} node any node
41
+ * @returns {boolean} `true` if the node is a variable declaration.
42
+ */
43
+ function isVariableDeclaration(node) {
44
+ return node.type === "VariableDeclaration" || node.type === "ExportNamedDeclaration" && node.declaration && node.declaration.type === "VariableDeclaration";
45
+ }
46
+ /**
47
+ * Checks whether this variable is on top of the block body
48
+ * @param {ASTNode} node The node to check
49
+ * @param {ASTNode[]} statements collection of ASTNodes for the parent node block
50
+ * @returns {boolean} True if var is on top otherwise false
51
+ */
52
+ function isVarOnTop(node, statements) {
53
+ let l = statements.length, i = 0;
54
+ if (node.parent.type !== "StaticBlock") for (; i < l && !(!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])); ++i);
55
+ for (; i < l; ++i) {
56
+ if (!isVariableDeclaration(statements[i])) return !1;
57
+ if (statements[i] === node) return !0;
58
+ }
59
+ return !1;
60
+ }
61
+ /**
62
+ * Checks whether variable is on top at the global level
63
+ * @param {ASTNode} node The node to check
64
+ * @param {ASTNode} parent Parent of the node
65
+ * @returns {void}
66
+ */
67
+ function globalVarCheck(node, parent) {
68
+ isVarOnTop(node, parent.body) || context.report({
69
+ node,
70
+ messageId: "top"
71
+ });
72
+ }
73
+ /**
74
+ * Checks whether variable is on top at functional block scope level
75
+ * @param {ASTNode} node The node to check
76
+ * @returns {void}
77
+ */
78
+ function blockScopeVarCheck(node) {
79
+ let { parent } = node;
80
+ parent.type === "BlockStatement" && /Function/u.test(parent.parent.type) && isVarOnTop(node, parent.body) || parent.type === "StaticBlock" && isVarOnTop(node, parent.body) || context.report({
81
+ node,
82
+ messageId: "top"
83
+ });
84
+ }
85
+ return { "VariableDeclaration[kind='var']"(node) {
86
+ node.parent.type === "ExportNamedDeclaration" ? globalVarCheck(node.parent, node.parent.parent) : node.parent.type === "Program" ? globalVarCheck(node, node.parent) : blockScopeVarCheck(node);
87
+ } };
88
+ }
89
+ };
90
+ }));
91
+ //#endregion
92
+ //#region src-js/generated/plugin-eslint/rules/vars-on-top.cjs
93
+ module.exports = require_vars_on_top().create;
94
+ //#endregion