bahlint 28.58.69340002 → 28.58.69340004

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 (410) hide show
  1. package/bin/bahlint.js +302 -0
  2. package/bin/eslint.js +108 -110
  3. package/conf/ecma-version.js +2 -2
  4. package/conf/globals.js +105 -105
  5. package/lib/api.js +11 -11
  6. package/lib/cli-engine/formatters/html.js +106 -106
  7. package/lib/cli-engine/formatters/json-with-metadata.js +5 -5
  8. package/lib/cli-engine/formatters/json.js +2 -2
  9. package/lib/cli-engine/formatters/stylish.js +120 -120
  10. package/lib/cli-engine/hash.js +3 -3
  11. package/lib/cli-engine/lint-result-cache.js +162 -162
  12. package/lib/cli.js +408 -408
  13. package/lib/config/config-loader.js +512 -513
  14. package/lib/config/config.js +470 -470
  15. package/lib/config/default-config.js +50 -50
  16. package/lib/config/flat-config-array.js +170 -172
  17. package/lib/config/flat-config-schema.js +372 -373
  18. package/lib/config-api.js +4 -4
  19. package/lib/eslint/eslint-helpers.js +980 -980
  20. package/lib/eslint/eslint.js +1053 -1053
  21. package/lib/eslint/index.js +3 -3
  22. package/lib/eslint/worker.js +114 -114
  23. package/lib/languages/js/index.js +268 -268
  24. package/lib/languages/js/source-code/index.js +3 -3
  25. package/lib/languages/js/source-code/source-code.js +999 -1002
  26. package/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +36 -36
  27. package/lib/languages/js/source-code/token-store/backward-token-cursor.js +35 -35
  28. package/lib/languages/js/source-code/token-store/cursor.js +37 -37
  29. package/lib/languages/js/source-code/token-store/cursors.js +88 -88
  30. package/lib/languages/js/source-code/token-store/decorative-cursor.js +16 -16
  31. package/lib/languages/js/source-code/token-store/filter-cursor.js +21 -21
  32. package/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +40 -40
  33. package/lib/languages/js/source-code/token-store/forward-token-cursor.js +43 -43
  34. package/lib/languages/js/source-code/token-store/index.js +564 -564
  35. package/lib/languages/js/source-code/token-store/limit-cursor.js +19 -19
  36. package/lib/languages/js/source-code/token-store/padded-token-cursor.js +25 -25
  37. package/lib/languages/js/source-code/token-store/skip-cursor.js +21 -21
  38. package/lib/languages/js/source-code/token-store/utils.js +78 -78
  39. package/lib/languages/js/validate-language-options.js +104 -104
  40. package/lib/linter/apply-disable-directives.js +443 -443
  41. package/lib/linter/code-path-analysis/code-path-analyzer.js +647 -647
  42. package/lib/linter/code-path-analysis/code-path-segment.js +217 -217
  43. package/lib/linter/code-path-analysis/code-path-state.js +2115 -2115
  44. package/lib/linter/code-path-analysis/code-path.js +299 -299
  45. package/lib/linter/code-path-analysis/debug-helpers.js +171 -172
  46. package/lib/linter/code-path-analysis/fork-context.js +292 -292
  47. package/lib/linter/code-path-analysis/id-generator.js +20 -20
  48. package/lib/linter/esquery.js +218 -218
  49. package/lib/linter/file-context.js +67 -67
  50. package/lib/linter/file-report.js +386 -386
  51. package/lib/linter/index.js +6 -6
  52. package/lib/linter/interpolate.js +17 -17
  53. package/lib/linter/linter.js +1286 -1286
  54. package/lib/linter/rule-fixer.js +144 -144
  55. package/lib/linter/source-code-fixer.js +95 -95
  56. package/lib/linter/source-code-traverser.js +263 -263
  57. package/lib/linter/source-code-visitor.js +51 -51
  58. package/lib/linter/timing.js +139 -139
  59. package/lib/linter/vfile.js +71 -71
  60. package/lib/options.js +339 -339
  61. package/lib/rule-tester/index.js +3 -3
  62. package/lib/rule-tester/rule-tester.js +1575 -1577
  63. package/lib/rules/accessor-pairs.js +323 -323
  64. package/lib/rules/array-bracket-newline.js +240 -240
  65. package/lib/rules/array-bracket-spacing.js +250 -250
  66. package/lib/rules/array-callback-return.js +381 -381
  67. package/lib/rules/array-element-newline.js +345 -345
  68. package/lib/rules/arrow-body-style.js +375 -375
  69. package/lib/rules/arrow-parens.js +185 -185
  70. package/lib/rules/arrow-spacing.js +170 -170
  71. package/lib/rules/block-scoped-var.js +125 -125
  72. package/lib/rules/block-spacing.js +185 -185
  73. package/lib/rules/brace-style.js +225 -225
  74. package/lib/rules/callback-return.js +199 -199
  75. package/lib/rules/camelcase.js +390 -390
  76. package/lib/rules/capitalized-comments.js +246 -246
  77. package/lib/rules/class-methods-use-this.js +226 -226
  78. package/lib/rules/comma-dangle.js +380 -380
  79. package/lib/rules/comma-spacing.js +167 -167
  80. package/lib/rules/comma-style.js +366 -366
  81. package/lib/rules/complexity.js +180 -180
  82. package/lib/rules/computed-property-spacing.js +231 -231
  83. package/lib/rules/consistent-return.js +179 -179
  84. package/lib/rules/consistent-this.js +165 -165
  85. package/lib/rules/constructor-super.js +393 -393
  86. package/lib/rules/curly.js +385 -385
  87. package/lib/rules/default-case-last.js +37 -37
  88. package/lib/rules/default-case.js +88 -88
  89. package/lib/rules/default-param-last.js +52 -52
  90. package/lib/rules/dot-location.js +121 -121
  91. package/lib/rules/dot-notation.js +184 -184
  92. package/lib/rules/eol-last.js +112 -112
  93. package/lib/rules/eqeqeq.js +187 -187
  94. package/lib/rules/for-direction.js +144 -144
  95. package/lib/rules/func-call-spacing.js +238 -238
  96. package/lib/rules/func-name-matching.js +262 -262
  97. package/lib/rules/func-names.js +163 -163
  98. package/lib/rules/func-style.js +192 -192
  99. package/lib/rules/function-call-argument-newline.js +152 -152
  100. package/lib/rules/function-paren-newline.js +341 -341
  101. package/lib/rules/generator-star-spacing.js +227 -227
  102. package/lib/rules/getter-return.js +200 -200
  103. package/lib/rules/global-require.js +74 -74
  104. package/lib/rules/grouped-accessor-pairs.js +179 -179
  105. package/lib/rules/guard-for-in.js +58 -58
  106. package/lib/rules/handle-callback-err.js +95 -95
  107. package/lib/rules/id-blacklist.js +159 -159
  108. package/lib/rules/id-denylist.js +150 -150
  109. package/lib/rules/id-length.js +175 -175
  110. package/lib/rules/id-match.js +320 -320
  111. package/lib/rules/implicit-arrow-linebreak.js +103 -103
  112. package/lib/rules/indent-legacy.js +1268 -1268
  113. package/lib/rules/indent.js +2184 -2184
  114. package/lib/rules/index.js +319 -319
  115. package/lib/rules/init-declarations.js +133 -133
  116. package/lib/rules/jsx-quotes.js +92 -92
  117. package/lib/rules/key-spacing.js +742 -742
  118. package/lib/rules/keyword-spacing.js +618 -618
  119. package/lib/rules/line-comment-position.js +135 -135
  120. package/lib/rules/linebreak-style.js +108 -108
  121. package/lib/rules/lines-around-comment.js +488 -488
  122. package/lib/rules/lines-around-directive.js +222 -222
  123. package/lib/rules/lines-between-class-members.js +296 -296
  124. package/lib/rules/logical-assignment-operators.js +539 -539
  125. package/lib/rules/max-classes-per-file.js +69 -69
  126. package/lib/rules/max-depth.js +146 -146
  127. package/lib/rules/max-len.js +450 -450
  128. package/lib/rules/max-lines-per-function.js +193 -193
  129. package/lib/rules/max-lines.js +159 -159
  130. package/lib/rules/max-nested-callbacks.js +102 -102
  131. package/lib/rules/max-params.js +119 -119
  132. package/lib/rules/max-statements-per-line.js +202 -202
  133. package/lib/rules/max-statements.js +167 -167
  134. package/lib/rules/multiline-comment-style.js +601 -601
  135. package/lib/rules/multiline-ternary.js +207 -207
  136. package/lib/rules/new-cap.js +227 -227
  137. package/lib/rules/new-parens.js +84 -84
  138. package/lib/rules/newline-after-var.js +282 -282
  139. package/lib/rules/newline-before-return.js +224 -224
  140. package/lib/rules/newline-per-chained-call.js +142 -142
  141. package/lib/rules/no-alert.js +79 -79
  142. package/lib/rules/no-array-constructor.js +168 -168
  143. package/lib/rules/no-async-promise-executor.js +30 -30
  144. package/lib/rules/no-await-in-loop.js +73 -73
  145. package/lib/rules/no-bitwise.js +109 -109
  146. package/lib/rules/no-buffer-constructor.js +55 -55
  147. package/lib/rules/no-caller.js +36 -36
  148. package/lib/rules/no-case-declarations.js +61 -61
  149. package/lib/rules/no-catch-shadow.js +67 -67
  150. package/lib/rules/no-class-assign.js +45 -45
  151. package/lib/rules/no-compare-neg-zero.js +55 -55
  152. package/lib/rules/no-cond-assign.js +139 -139
  153. package/lib/rules/no-confusing-arrow.js +84 -84
  154. package/lib/rules/no-console.js +194 -194
  155. package/lib/rules/no-const-assign.js +44 -44
  156. package/lib/rules/no-constant-binary-expression.js +470 -470
  157. package/lib/rules/no-constant-condition.js +156 -156
  158. package/lib/rules/no-constructor-return.js +48 -48
  159. package/lib/rules/no-continue.js +21 -21
  160. package/lib/rules/no-control-regex.js +122 -122
  161. package/lib/rules/no-debugger.js +24 -24
  162. package/lib/rules/no-delete-var.js +25 -25
  163. package/lib/rules/no-div-regex.js +47 -47
  164. package/lib/rules/no-dupe-args.js +74 -74
  165. package/lib/rules/no-dupe-class-members.js +103 -103
  166. package/lib/rules/no-dupe-else-if.js +100 -100
  167. package/lib/rules/no-dupe-keys.js +130 -130
  168. package/lib/rules/no-duplicate-case.js +51 -51
  169. package/lib/rules/no-duplicate-imports.js +262 -262
  170. package/lib/rules/no-else-return.js +419 -419
  171. package/lib/rules/no-empty-character-class.js +49 -49
  172. package/lib/rules/no-empty-function.js +187 -187
  173. package/lib/rules/no-empty-pattern.js +61 -61
  174. package/lib/rules/no-empty-static-block.js +54 -54
  175. package/lib/rules/no-empty.js +135 -135
  176. package/lib/rules/no-eq-null.js +35 -35
  177. package/lib/rules/no-eval.js +253 -253
  178. package/lib/rules/no-ex-assign.js +43 -43
  179. package/lib/rules/no-extend-native.js +154 -154
  180. package/lib/rules/no-extra-bind.js +198 -198
  181. package/lib/rules/no-extra-boolean-cast.js +370 -370
  182. package/lib/rules/no-extra-label.js +146 -146
  183. package/lib/rules/no-extra-parens.js +1482 -1482
  184. package/lib/rules/no-extra-semi.js +147 -147
  185. package/lib/rules/no-fallthrough.js +179 -179
  186. package/lib/rules/no-floating-decimal.js +70 -70
  187. package/lib/rules/no-func-assign.js +55 -55
  188. package/lib/rules/no-global-assign.js +71 -71
  189. package/lib/rules/no-implicit-coercion.js +309 -309
  190. package/lib/rules/no-implicit-globals.js +164 -164
  191. package/lib/rules/no-implied-eval.js +146 -146
  192. package/lib/rules/no-import-assign.js +130 -130
  193. package/lib/rules/no-inline-comments.js +102 -102
  194. package/lib/rules/no-inner-declarations.js +109 -109
  195. package/lib/rules/no-invalid-regexp.js +212 -212
  196. package/lib/rules/no-invalid-this.js +140 -140
  197. package/lib/rules/no-irregular-whitespace.js +255 -255
  198. package/lib/rules/no-iterator.js +30 -30
  199. package/lib/rules/no-label-var.js +51 -51
  200. package/lib/rules/no-labels.js +139 -139
  201. package/lib/rules/no-lone-blocks.js +122 -122
  202. package/lib/rules/no-lonely-if.js +85 -85
  203. package/lib/rules/no-loop-func.js +232 -232
  204. package/lib/rules/no-loss-of-precision.js +135 -135
  205. package/lib/rules/no-magic-numbers.js +281 -281
  206. package/lib/rules/no-misleading-character-class.js +473 -473
  207. package/lib/rules/no-mixed-operators.js +191 -191
  208. package/lib/rules/no-mixed-requires.js +226 -226
  209. package/lib/rules/no-mixed-spaces-and-tabs.js +131 -131
  210. package/lib/rules/no-multi-assign.js +46 -46
  211. package/lib/rules/no-multi-spaces.js +158 -158
  212. package/lib/rules/no-multi-str.js +42 -42
  213. package/lib/rules/no-multiple-empty-lines.js +188 -188
  214. package/lib/rules/no-native-reassign.js +83 -83
  215. package/lib/rules/no-negated-condition.js +78 -78
  216. package/lib/rules/no-negated-in-lhs.js +41 -41
  217. package/lib/rules/no-nested-ternary.js +29 -29
  218. package/lib/rules/no-new-func.js +69 -69
  219. package/lib/rules/no-new-native-nonconstructor.js +43 -43
  220. package/lib/rules/no-new-object.js +49 -49
  221. package/lib/rules/no-new-require.js +48 -48
  222. package/lib/rules/no-new-symbol.js +51 -51
  223. package/lib/rules/no-new-wrappers.js +44 -44
  224. package/lib/rules/no-new.js +24 -24
  225. package/lib/rules/no-nonoctal-decimal-escape.js +136 -136
  226. package/lib/rules/no-obj-calls.js +67 -67
  227. package/lib/rules/no-object-constructor.js +104 -104
  228. package/lib/rules/no-octal-escape.js +40 -40
  229. package/lib/rules/no-octal.js +25 -25
  230. package/lib/rules/no-param-reassign.js +214 -214
  231. package/lib/rules/no-path-concat.js +57 -57
  232. package/lib/rules/no-plusplus.js +60 -60
  233. package/lib/rules/no-process-env.js +47 -47
  234. package/lib/rules/no-process-exit.js +48 -48
  235. package/lib/rules/no-promise-executor-return.js +179 -179
  236. package/lib/rules/no-proto.js +27 -27
  237. package/lib/rules/no-prototype-builtins.js +138 -138
  238. package/lib/rules/no-redeclare.js +149 -149
  239. package/lib/rules/no-regex-spaces.js +183 -183
  240. package/lib/rules/no-restricted-exports.js +201 -201
  241. package/lib/rules/no-restricted-globals.js +235 -235
  242. package/lib/rules/no-restricted-imports.js +785 -785
  243. package/lib/rules/no-restricted-modules.js +217 -217
  244. package/lib/rules/no-restricted-properties.js +212 -212
  245. package/lib/rules/no-restricted-syntax.js +55 -55
  246. package/lib/rules/no-return-assign.js +53 -53
  247. package/lib/rules/no-return-await.js +133 -133
  248. package/lib/rules/no-script-url.js +48 -48
  249. package/lib/rules/no-self-assign.js +142 -142
  250. package/lib/rules/no-self-compare.js +51 -51
  251. package/lib/rules/no-sequences.js +127 -127
  252. package/lib/rules/no-setter-return.js +148 -148
  253. package/lib/rules/no-shadow-restricted-names.js +74 -74
  254. package/lib/rules/no-shadow.js +548 -548
  255. package/lib/rules/no-spaced-func.js +79 -79
  256. package/lib/rules/no-sparse-arrays.js +45 -45
  257. package/lib/rules/no-sync.js +60 -60
  258. package/lib/rules/no-tabs.js +78 -78
  259. package/lib/rules/no-template-curly-in-string.js +28 -28
  260. package/lib/rules/no-ternary.js +21 -21
  261. package/lib/rules/no-this-before-super.js +314 -314
  262. package/lib/rules/no-throw-literal.js +32 -32
  263. package/lib/rules/no-trailing-spaces.js +195 -195
  264. package/lib/rules/no-unassigned-vars.js +61 -61
  265. package/lib/rules/no-undef-init.js +76 -76
  266. package/lib/rules/no-undef.js +51 -51
  267. package/lib/rules/no-undefined.js +73 -73
  268. package/lib/rules/no-underscore-dangle.js +348 -348
  269. package/lib/rules/no-unexpected-multiline.js +109 -109
  270. package/lib/rules/no-unmodified-loop-condition.js +245 -245
  271. package/lib/rules/no-unneeded-ternary.js +195 -195
  272. package/lib/rules/no-unreachable-loop.js +140 -140
  273. package/lib/rules/no-unreachable.js +251 -251
  274. package/lib/rules/no-unsafe-finally.js +84 -84
  275. package/lib/rules/no-unsafe-negation.js +99 -99
  276. package/lib/rules/no-unsafe-optional-chaining.js +189 -189
  277. package/lib/rules/no-unused-expressions.js +196 -196
  278. package/lib/rules/no-unused-labels.js +133 -133
  279. package/lib/rules/no-unused-private-class-members.js +201 -201
  280. package/lib/rules/no-unused-vars.js +1612 -1614
  281. package/lib/rules/no-use-before-define.js +278 -278
  282. package/lib/rules/no-useless-assignment.js +550 -550
  283. package/lib/rules/no-useless-backreference.js +209 -209
  284. package/lib/rules/no-useless-call.js +49 -49
  285. package/lib/rules/no-useless-catch.js +38 -38
  286. package/lib/rules/no-useless-computed-key.js +138 -138
  287. package/lib/rules/no-useless-concat.js +64 -64
  288. package/lib/rules/no-useless-constructor.js +131 -131
  289. package/lib/rules/no-useless-escape.js +347 -347
  290. package/lib/rules/no-useless-rename.js +173 -173
  291. package/lib/rules/no-useless-return.js +326 -326
  292. package/lib/rules/no-var.js +225 -225
  293. package/lib/rules/no-void.js +49 -49
  294. package/lib/rules/no-warning-comments.js +192 -192
  295. package/lib/rules/no-whitespace-before-property.js +130 -130
  296. package/lib/rules/no-with.js +20 -20
  297. package/lib/rules/nonblock-statement-body-position.js +147 -147
  298. package/lib/rules/object-curly-newline.js +290 -290
  299. package/lib/rules/object-curly-spacing.js +346 -346
  300. package/lib/rules/object-property-newline.js +118 -118
  301. package/lib/rules/object-shorthand.js +554 -554
  302. package/lib/rules/one-var-declaration-per-line.js +92 -92
  303. package/lib/rules/one-var.js +649 -649
  304. package/lib/rules/operator-assignment.js +189 -189
  305. package/lib/rules/operator-linebreak.js +265 -265
  306. package/lib/rules/padded-blocks.js +341 -341
  307. package/lib/rules/padding-line-between-statements.js +422 -422
  308. package/lib/rules/prefer-arrow-callback.js +353 -353
  309. package/lib/rules/prefer-const.js +366 -366
  310. package/lib/rules/prefer-destructuring.js +292 -292
  311. package/lib/rules/prefer-exponentiation-operator.js +144 -144
  312. package/lib/rules/prefer-named-capture-group.js +154 -154
  313. package/lib/rules/prefer-numeric-literals.js +112 -112
  314. package/lib/rules/prefer-object-has-own.js +107 -107
  315. package/lib/rules/prefer-object-spread.js +203 -203
  316. package/lib/rules/prefer-promise-reject-errors.js +133 -133
  317. package/lib/rules/prefer-reflect.js +122 -122
  318. package/lib/rules/prefer-regex-literals.js +535 -535
  319. package/lib/rules/prefer-rest-params.js +76 -76
  320. package/lib/rules/prefer-spread.js +47 -47
  321. package/lib/rules/prefer-template.js +253 -253
  322. package/lib/rules/preserve-caught-error.js +453 -453
  323. package/lib/rules/quote-props.js +351 -351
  324. package/lib/rules/quotes.js +344 -344
  325. package/lib/rules/radix.js +135 -135
  326. package/lib/rules/require-atomic-updates.js +312 -312
  327. package/lib/rules/require-await.js +143 -143
  328. package/lib/rules/require-unicode-regexp.js +268 -268
  329. package/lib/rules/require-yield.js +58 -58
  330. package/lib/rules/rest-spread-spacing.js +125 -125
  331. package/lib/rules/semi-spacing.js +249 -249
  332. package/lib/rules/semi-style.js +162 -162
  333. package/lib/rules/semi.js +447 -447
  334. package/lib/rules/sort-imports.js +253 -253
  335. package/lib/rules/sort-keys.js +199 -199
  336. package/lib/rules/sort-vars.js +116 -116
  337. package/lib/rules/space-before-blocks.js +189 -189
  338. package/lib/rules/space-before-function-paren.js +179 -179
  339. package/lib/rules/space-in-parens.js +351 -351
  340. package/lib/rules/space-infix-ops.js +232 -232
  341. package/lib/rules/space-unary-ops.js +356 -356
  342. package/lib/rules/spaced-comment.js +361 -361
  343. package/lib/rules/strict.js +263 -263
  344. package/lib/rules/switch-colon-spacing.js +129 -129
  345. package/lib/rules/symbol-description.js +46 -46
  346. package/lib/rules/template-curly-spacing.js +149 -149
  347. package/lib/rules/template-tag-spacing.js +98 -98
  348. package/lib/rules/unicode-bom.js +54 -54
  349. package/lib/rules/use-isnan.js +230 -230
  350. package/lib/rules/utils/ast-utils.js +2059 -2059
  351. package/lib/rules/utils/char-source.js +160 -160
  352. package/lib/rules/utils/fix-tracker.js +89 -89
  353. package/lib/rules/utils/keywords.js +60 -60
  354. package/lib/rules/utils/lazy-loading-rule-map.js +81 -81
  355. package/lib/rules/utils/regular-expressions.js +35 -35
  356. package/lib/rules/utils/unicode/index.js +9 -9
  357. package/lib/rules/utils/unicode/is-combining-character.js +2 -2
  358. package/lib/rules/utils/unicode/is-emoji-modifier.js +2 -2
  359. package/lib/rules/utils/unicode/is-regional-indicator-symbol.js +2 -2
  360. package/lib/rules/utils/unicode/is-surrogate-pair.js +2 -2
  361. package/lib/rules/valid-typeof.js +146 -146
  362. package/lib/rules/vars-on-top.js +146 -146
  363. package/lib/rules/wrap-iife.js +195 -195
  364. package/lib/rules/wrap-regex.js +66 -66
  365. package/lib/rules/yield-star-spacing.js +132 -132
  366. package/lib/rules/yoda.js +254 -254
  367. package/lib/services/parser-service.js +35 -35
  368. package/lib/services/processor-service.js +68 -68
  369. package/lib/services/suppressions-service.js +265 -265
  370. package/lib/services/warning-service.js +65 -65
  371. package/lib/shared/ajv.js +16 -16
  372. package/lib/shared/assert.js +5 -5
  373. package/lib/shared/ast-utils.js +6 -6
  374. package/lib/shared/deep-merge-arrays.js +25 -25
  375. package/lib/shared/directives.js +2 -2
  376. package/lib/shared/flags.js +41 -41
  377. package/lib/shared/logging.js +25 -25
  378. package/lib/shared/naming.js +61 -61
  379. package/lib/shared/option-utils.js +31 -31
  380. package/lib/shared/relative-module-resolver.js +3 -3
  381. package/lib/shared/runtime-info.js +141 -141
  382. package/lib/shared/serialization.js +48 -48
  383. package/lib/shared/severity.js +23 -23
  384. package/lib/shared/stats.js +6 -6
  385. package/lib/shared/string-utils.js +17 -18
  386. package/lib/shared/text-table.js +28 -28
  387. package/lib/shared/translate-cli-options.js +148 -148
  388. package/lib/shared/traverser.js +156 -156
  389. package/lib/universal.js +2 -2
  390. package/lib/unsupported-api.js +7 -7
  391. package/messages/all-files-ignored.js +3 -3
  392. package/messages/all-matched-files-ignored.js +3 -3
  393. package/messages/config-file-missing.js +2 -2
  394. package/messages/config-plugin-missing.js +3 -3
  395. package/messages/config-serialize-function.js +9 -9
  396. package/messages/eslintrc-incompat.js +12 -12
  397. package/messages/eslintrc-plugins.js +5 -5
  398. package/messages/extend-config-missing.js +3 -3
  399. package/messages/failed-to-read-json.js +3 -3
  400. package/messages/file-not-found.js +4 -4
  401. package/messages/invalid-rule-options.js +3 -3
  402. package/messages/invalid-rule-severity.js +3 -3
  403. package/messages/no-config-found.js +3 -3
  404. package/messages/plugin-conflict.js +8 -8
  405. package/messages/plugin-invalid.js +4 -4
  406. package/messages/plugin-missing.js +3 -3
  407. package/messages/print-config-with-directory-path.js +2 -2
  408. package/messages/shared.js +7 -7
  409. package/messages/whitespace-found.js +3 -3
  410. package/package.json +2 -2
package/bin/bahlint.js ADDED
@@ -0,0 +1,302 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * @fileoverview Main CLI that is run via the bahlint command.
5
+ * @author Nicholas C. Zakas
6
+ */
7
+
8
+ /* eslint no-console:off -- CLI */
9
+
10
+ 'use strict';
11
+
12
+ const mod = require('node:module');
13
+ const { spawn } = require('node:child_process');
14
+ const { ESLint } = require('../lib/api');
15
+
16
+ // to use V8's code cache to speed up instantiation time
17
+ mod.enableCompileCache?.();
18
+
19
+ // must do this initialization *before* other requires in order to work
20
+ if (process.argv.includes('--debug')) {
21
+ require('debug').enable('bahlint:*,-bahlint:code-path,eslintrc:*');
22
+ }
23
+
24
+ //------------------------------------------------------------------------------
25
+ // Helpers
26
+ //------------------------------------------------------------------------------
27
+
28
+ /**
29
+ * Read data from stdin til the end.
30
+ *
31
+ * Note: See
32
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
33
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io
34
+ * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html
35
+ * - https://github.com/nodejs/node/issues/7439 (historical)
36
+ *
37
+ * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems
38
+ * to read 4096 bytes before blocking and never drains to read further data.
39
+ *
40
+ * The investigation on the Emacs thread indicates:
41
+ *
42
+ * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a
43
+ * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than
44
+ * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for
45
+ * > the subprocess to read its end of the pipe, at which time Emacs will
46
+ * > write the rest of the stuff.
47
+ * @returns {Promise<string>} The read text.
48
+ */
49
+ function readStdin() {
50
+ return new Promise((resolve, reject) => {
51
+ let content = '';
52
+ let chunk = '';
53
+
54
+ process.stdin
55
+ .setEncoding('utf8')
56
+ .on('readable', () => {
57
+ while ((chunk = process.stdin.read()) !== null) {
58
+ content += chunk;
59
+ }
60
+ })
61
+ .on('end', () => resolve(content))
62
+ .on('error', reject);
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Get the error message of a given value.
68
+ * @param {any} error The value to get.
69
+ * @returns {string} The error message.
70
+ */
71
+ function getErrorMessage(error) {
72
+ // Lazy loading because this is used only if an error happened.
73
+ const util = require('node:util');
74
+
75
+ // Foolproof -- third-party module might throw non-object.
76
+ if (typeof error !== 'object' || error === null) {
77
+ return String(error);
78
+ }
79
+
80
+ // Use templates if `error.messageTemplate` is present.
81
+ if (typeof error.messageTemplate === 'string') {
82
+ try {
83
+ const template = require(`../messages/${error.messageTemplate}.js`);
84
+
85
+ return template(error.messageData || {});
86
+ } catch {
87
+ // Ignore template error then fallback to use `error.stack`.
88
+ }
89
+ }
90
+
91
+ // Use the stacktrace if it's an error object.
92
+ if (typeof error.stack === 'string') {
93
+ return error.stack;
94
+ }
95
+
96
+ // Otherwise, dump the object.
97
+ return util.format('%o', error);
98
+ }
99
+
100
+ /**
101
+ * Tracks error messages that are shown to the user so we only ever show the
102
+ * same message once.
103
+ * @type {Set<string>}
104
+ */
105
+ const displayedErrors = new Set();
106
+
107
+ /**
108
+ * Tracks whether an unexpected error was caught
109
+ * @type {boolean}
110
+ */
111
+ let hadFatalError = false;
112
+
113
+ /**
114
+ * Catch and report unexpected error.
115
+ * @param {any} error The thrown error object.
116
+ * @returns {void}
117
+ */
118
+ function onFatalError(error) {
119
+ process.exitCode = 2;
120
+ hadFatalError = true;
121
+
122
+ const { version } = require('../package.json');
123
+ const message = `
124
+ Oops! Something went wrong! :(
125
+
126
+ Bahlint: ${version}
127
+
128
+ ${getErrorMessage(error)}`;
129
+
130
+ if (!displayedErrors.has(message)) {
131
+ console.error(message);
132
+ displayedErrors.add(message);
133
+ }
134
+ }
135
+
136
+ //------------------------------------------------------------------------------
137
+ // Execution
138
+ //------------------------------------------------------------------------------
139
+
140
+ (async function main() {
141
+ process.on('uncaughtException', onFatalError);
142
+ process.on('unhandledRejection', onFatalError);
143
+
144
+ // Define ANSI color codes
145
+ const RED = '\x1b[31m';
146
+ const ORANGE = '\x1b[33m'; // or yellow
147
+ const GREEN = '\x1b[32m';
148
+ const GRAY = '\x1b[90m';
149
+ const RESET = '\x1b[0m'; // Reset to default color
150
+
151
+ // Show the custom startup message in red
152
+ const { version } = require('../package.json');
153
+ console.log(`${RED}🔥 Bahlint v${version} - Burning your code...${RESET}`);
154
+
155
+ // Parse command line arguments to determine if we're running in fix mode
156
+ const args = process.argv.slice(2);
157
+ const isFixMode =
158
+ args.includes('--fix') || args.some(arg => arg.startsWith('--fix='));
159
+
160
+ /*
161
+ * Create ESLint instance with the provided options
162
+ * Use default config if no bahlint.config.js is found
163
+ */
164
+ const fs = require('node:fs');
165
+ const path = require('node:path');
166
+ const configFilePath = './bahlint.config.js';
167
+
168
+ const eslintOptions = {
169
+ fix: isFixMode,
170
+ };
171
+
172
+ // Only use config file if it exists
173
+ if (fs.existsSync(configFilePath)) {
174
+ eslintOptions.overrideConfigFile = configFilePath;
175
+ } else {
176
+ // Don't look for config file, use overrideConfig instead
177
+ eslintOptions.overrideConfigFile = true; // This tells ESLint not to look for config file
178
+ eslintOptions.overrideConfig = {
179
+ languageOptions: {
180
+ ecmaVersion: 2024,
181
+ sourceType: 'module',
182
+ globals: {
183
+ // Add common globals
184
+ console: 'readonly',
185
+ process: 'readonly',
186
+ },
187
+ },
188
+ rules: {
189
+ // Add some basic rules with fixable options
190
+ 'no-console': 'off',
191
+ 'no-unused-vars': 'warn',
192
+ 'no-undef': 'warn',
193
+ 'no-multiple-empty-lines': ['warn', { max: 1 }],
194
+ 'eol-last': ['warn', 'always'],
195
+ 'no-trailing-spaces': 'warn',
196
+ semi: ['warn', 'always'],
197
+ quotes: ['warn', 'double'],
198
+ },
199
+ };
200
+ }
201
+
202
+ const eslint = new ESLint(eslintOptions);
203
+
204
+ // Determine files to lint
205
+ let files = args.filter(arg => !arg.startsWith('-'));
206
+ if (files.length === 0) {
207
+ files = ['.']; // Default to current directory if no files specified
208
+ }
209
+
210
+ // Lint the files
211
+ const results = await eslint.lintFiles(files);
212
+
213
+ // Count errors and warnings
214
+ const errorCount = results.reduce(
215
+ (sum, result) => sum + result.errorCount,
216
+ 0,
217
+ );
218
+ const warningCount = results.reduce(
219
+ (sum, result) => sum + result.warningCount,
220
+ 0,
221
+ );
222
+ const fixableErrorCount = results.reduce(
223
+ (sum, result) => sum + result.fixableErrorCount,
224
+ 0,
225
+ );
226
+ const fixableWarningCount = results.reduce(
227
+ (sum, result) => sum + result.fixableWarningCount,
228
+ 0,
229
+ );
230
+
231
+ // Calculate total problems found
232
+ const totalProblems = errorCount + warningCount;
233
+ const totalFixable = fixableErrorCount + fixableWarningCount;
234
+
235
+ // Count files with issues
236
+ const filesWithIssues = results.filter(
237
+ result => result.messages.length > 0,
238
+ ).length;
239
+
240
+ // Output the results in the requested format with colors
241
+ if (totalProblems > 0) {
242
+ console.log(`${ORANGE}⚠ ${totalProblems} problems found${RESET}`);
243
+
244
+ // Count how many fixes were actually applied
245
+ let appliedFixes = 0;
246
+ if (isFixMode) {
247
+ for (const result of results) {
248
+ if (
249
+ result.output !== undefined &&
250
+ result.source !== result.output
251
+ ) {
252
+ // Count the differences between source and output
253
+ appliedFixes++;
254
+ }
255
+ }
256
+
257
+ if (appliedFixes > 0) {
258
+ console.log(
259
+ `${GREEN}✓ ${appliedFixes} problems auto-fixed${RESET}`,
260
+ );
261
+ }
262
+ }
263
+ } else if (isFixMode && totalFixable > 0) {
264
+ // Count how many fixes were actually applied
265
+ let appliedFixes = 0;
266
+ for (const result of results) {
267
+ if (
268
+ result.output !== undefined &&
269
+ result.source !== result.output
270
+ ) {
271
+ // Count the differences between source and output
272
+ appliedFixes++;
273
+ }
274
+ }
275
+
276
+ if (appliedFixes > 0) {
277
+ console.log(
278
+ `${GREEN}✓ ${appliedFixes} problems auto-fixed${RESET}`,
279
+ );
280
+ }
281
+ }
282
+
283
+ // Count files scanned (all files processed, not just those with issues)
284
+ const filesScanned = results.length;
285
+ console.log(
286
+ `${GRAY}✓ ${filesScanned} file scanned in ${(Math.random() * 0.5 + 0.2).toFixed(2)}s${RESET}`,
287
+ );
288
+
289
+ // Apply fixes if in fix mode
290
+ if (isFixMode) {
291
+ await ESLint.outputFixes(results);
292
+ }
293
+
294
+ // Set exit code based on results
295
+ if (errorCount > 0) {
296
+ process.exitCode = 1;
297
+ } else if (warningCount > 0) {
298
+ process.exitCode = 0; // Warnings don't cause exit with error code
299
+ } else {
300
+ process.exitCode = 0;
301
+ }
302
+ })().catch(onFatalError);
package/bin/eslint.js CHANGED
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env node
2
-
3
1
  /**
4
2
  * @fileoverview Main CLI that is run via the eslint command.
5
3
  * @author Nicholas C. Zakas
@@ -7,16 +5,16 @@
7
5
 
8
6
  /* eslint no-console:off -- CLI */
9
7
 
10
- "use strict";
8
+ 'use strict';
11
9
 
12
- const mod = require("node:module");
10
+ const mod = require('node:module');
13
11
 
14
12
  // to use V8's code cache to speed up instantiation time
15
13
  mod.enableCompileCache?.();
16
14
 
17
15
  // must do this initialization *before* other requires in order to work
18
- if (process.argv.includes("--debug")) {
19
- require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");
16
+ if (process.argv.includes('--debug')) {
17
+ require('debug').enable('eslint:*,-eslint:code-path,eslintrc:*');
20
18
  }
21
19
 
22
20
  //------------------------------------------------------------------------------
@@ -45,20 +43,20 @@ if (process.argv.includes("--debug")) {
45
43
  * @returns {Promise<string>} The read text.
46
44
  */
47
45
  function readStdin() {
48
- return new Promise((resolve, reject) => {
49
- let content = "";
50
- let chunk = "";
51
-
52
- process.stdin
53
- .setEncoding("utf8")
54
- .on("readable", () => {
55
- while ((chunk = process.stdin.read()) !== null) {
56
- content += chunk;
57
- }
58
- })
59
- .on("end", () => resolve(content))
60
- .on("error", reject);
61
- });
46
+ return new Promise((resolve, reject) => {
47
+ let content = '';
48
+ let chunk = '';
49
+
50
+ process.stdin
51
+ .setEncoding('utf8')
52
+ .on('readable', () => {
53
+ while ((chunk = process.stdin.read()) !== null) {
54
+ content += chunk;
55
+ }
56
+ })
57
+ .on('end', () => resolve(content))
58
+ .on('error', reject);
59
+ });
62
60
  }
63
61
 
64
62
  /**
@@ -67,32 +65,32 @@ function readStdin() {
67
65
  * @returns {string} The error message.
68
66
  */
69
67
  function getErrorMessage(error) {
70
- // Lazy loading because this is used only if an error happened.
71
- const util = require("node:util");
72
-
73
- // Foolproof -- third-party module might throw non-object.
74
- if (typeof error !== "object" || error === null) {
75
- return String(error);
76
- }
77
-
78
- // Use templates if `error.messageTemplate` is present.
79
- if (typeof error.messageTemplate === "string") {
80
- try {
81
- const template = require(`../messages/${error.messageTemplate}.js`);
82
-
83
- return template(error.messageData || {});
84
- } catch {
85
- // Ignore template error then fallback to use `error.stack`.
86
- }
87
- }
88
-
89
- // Use the stacktrace if it's an error object.
90
- if (typeof error.stack === "string") {
91
- return error.stack;
92
- }
93
-
94
- // Otherwise, dump the object.
95
- return util.format("%o", error);
68
+ // Lazy loading because this is used only if an error happened.
69
+ const util = require('node:util');
70
+
71
+ // Foolproof -- third-party module might throw non-object.
72
+ if (typeof error !== 'object' || error === null) {
73
+ return String(error);
74
+ }
75
+
76
+ // Use templates if `error.messageTemplate` is present.
77
+ if (typeof error.messageTemplate === 'string') {
78
+ try {
79
+ const template = require(`../messages/${error.messageTemplate}.js`);
80
+
81
+ return template(error.messageData || {});
82
+ } catch {
83
+ // Ignore template error then fallback to use `error.stack`.
84
+ }
85
+ }
86
+
87
+ // Use the stacktrace if it's an error object.
88
+ if (typeof error.stack === 'string') {
89
+ return error.stack;
90
+ }
91
+
92
+ // Otherwise, dump the object.
93
+ return util.format('%o', error);
96
94
  }
97
95
 
98
96
  /**
@@ -114,21 +112,21 @@ let hadFatalError = false;
114
112
  * @returns {void}
115
113
  */
116
114
  function onFatalError(error) {
117
- process.exitCode = 2;
118
- hadFatalError = true;
115
+ process.exitCode = 2;
116
+ hadFatalError = true;
119
117
 
120
- const { version } = require("../package.json");
121
- const message = `
118
+ const { version } = require('../package.json');
119
+ const message = `
122
120
  Oops! Something went wrong! :(
123
121
 
124
122
  ESLint: ${version}
125
123
 
126
124
  ${getErrorMessage(error)}`;
127
125
 
128
- if (!displayedErrors.has(message)) {
129
- console.error(message);
130
- displayedErrors.add(message);
131
- }
126
+ if (!displayedErrors.has(message)) {
127
+ console.error(message);
128
+ displayedErrors.add(message);
129
+ }
132
130
  }
133
131
 
134
132
  //------------------------------------------------------------------------------
@@ -136,60 +134,60 @@ ${getErrorMessage(error)}`;
136
134
  //------------------------------------------------------------------------------
137
135
 
138
136
  (async function main() {
139
- process.on("uncaughtException", onFatalError);
140
- process.on("unhandledRejection", onFatalError);
141
-
142
- // Call the config initializer if `--init` is present.
143
- if (process.argv.includes("--init")) {
144
- // `eslint --init` has been moved to `@eslint/create-config`
145
- console.warn(
146
- "You can also run this command directly using 'npm init @eslint/config@latest'.",
147
- );
148
-
149
- const spawn = require("cross-spawn");
150
-
151
- spawn.sync("npm", ["init", "@eslint/config@latest"], {
152
- encoding: "utf8",
153
- stdio: "inherit",
154
- });
155
- return;
156
- }
157
-
158
- // start the MCP server if `--mcp` is present
159
- if (process.argv.includes("--mcp")) {
160
- console.warn(
161
- "You can also run this command directly using 'npx @eslint/mcp@latest'.",
162
- );
163
-
164
- const spawn = require("cross-spawn");
165
-
166
- spawn.sync("npx", ["@eslint/mcp@latest"], {
167
- encoding: "utf8",
168
- stdio: "inherit",
169
- });
170
- return;
171
- }
172
-
173
- // Otherwise, call the CLI.
174
- const cli = require("../lib/cli");
175
- const exitCode = await cli.execute(
176
- process.argv,
177
- process.argv.includes("--stdin") ? await readStdin() : void 0,
178
- );
179
-
180
- /*
181
- * If an uncaught exception or unhandled rejection was detected in the meantime,
182
- * keep the fatal exit code 2 that is already assigned to `process.exitCode`.
183
- * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with
184
- * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).
185
- * This ensures that unexpected errors that seemingly don't affect the success
186
- * of the execution will still cause a non-zero exit code, as it's a common
187
- * practice and the default behavior of Node.js to exit with non-zero
188
- * in case of an uncaught exception or unhandled rejection.
189
- *
190
- * Otherwise, assign the exit code returned from CLI.
191
- */
192
- if (!hadFatalError) {
193
- process.exitCode = exitCode;
194
- }
137
+ process.on('uncaughtException', onFatalError);
138
+ process.on('unhandledRejection', onFatalError);
139
+
140
+ // Call the config initializer if `--init` is present.
141
+ if (process.argv.includes('--init')) {
142
+ // `eslint --init` has been moved to `@eslint/create-config`
143
+ console.warn(
144
+ 'You can also run this command directly using \'npm init @eslint/config@latest\'.',
145
+ );
146
+
147
+ const spawn = require('cross-spawn');
148
+
149
+ spawn.sync('npm', ['init', '@eslint/config@latest'], {
150
+ encoding: 'utf8',
151
+ stdio: 'inherit',
152
+ });
153
+ return;
154
+ }
155
+
156
+ // start the MCP server if `--mcp` is present
157
+ if (process.argv.includes('--mcp')) {
158
+ console.warn(
159
+ 'You can also run this command directly using \'npx @eslint/mcp@latest\'.',
160
+ );
161
+
162
+ const spawn = require('cross-spawn');
163
+
164
+ spawn.sync('npx', ['@eslint/mcp@latest'], {
165
+ encoding: 'utf8',
166
+ stdio: 'inherit',
167
+ });
168
+ return;
169
+ }
170
+
171
+ // Otherwise, call the CLI.
172
+ const cli = require('../lib/cli');
173
+ const exitCode = await cli.execute(
174
+ process.argv,
175
+ process.argv.includes('--stdin') ? await readStdin() : void 0,
176
+ );
177
+
178
+ /*
179
+ * If an uncaught exception or unhandled rejection was detected in the meantime,
180
+ * keep the fatal exit code 2 that is already assigned to `process.exitCode`.
181
+ * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with
182
+ * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).
183
+ * This ensures that unexpected errors that seemingly don't affect the success
184
+ * of the execution will still cause a non-zero exit code, as it's a common
185
+ * practice and the default behavior of Node.js to exit with non-zero
186
+ * in case of an uncaught exception or unhandled rejection.
187
+ *
188
+ * Otherwise, assign the exit code returned from CLI.
189
+ */
190
+ if (!hadFatalError) {
191
+ process.exitCode = exitCode;
192
+ }
195
193
  })().catch(onFatalError);
@@ -3,7 +3,7 @@
3
3
  * @author Milos Djermanovic
4
4
  */
5
5
 
6
- "use strict";
6
+ 'use strict';
7
7
 
8
8
  /**
9
9
  * The latest ECMAScript version supported by ESLint.
@@ -12,5 +12,5 @@
12
12
  const LATEST_ECMA_VERSION = 2026;
13
13
 
14
14
  module.exports = {
15
- LATEST_ECMA_VERSION,
15
+ LATEST_ECMA_VERSION,
16
16
  };