bahlint 28.58.69340005 → 28.58.69340007

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 +308 -245
  2. package/bin/eslint.js +109 -108
  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 +513 -512
  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 +171 -170
  17. package/lib/config/flat-config-schema.js +373 -372
  18. package/lib/config-api.js +4 -4
  19. package/lib/eslint/eslint-helpers.js +983 -983
  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 -999
  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 +36 -36
  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 +181 -181
  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 +1284 -1284
  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 -1575
  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 +223 -223
  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 +1614 -1612
  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 +15 -15
  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 -17
  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 +6 -3
package/bin/bahlint.js CHANGED
@@ -7,18 +7,18 @@
7
7
 
8
8
  /* eslint no-console:off -- CLI */
9
9
 
10
- 'use strict';
10
+ "use strict";
11
11
 
12
- const mod = require('node:module');
13
- const { spawn } = require('node:child_process');
14
- const { ESLint } = require('../lib/api');
12
+ const mod = require("node:module");
13
+ const { spawn } = require("node:child_process");
14
+ const { ESLint } = require("../lib/api");
15
15
 
16
16
  // to use V8's code cache to speed up instantiation time
17
17
  mod.enableCompileCache?.();
18
18
 
19
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:*');
20
+ if (process.argv.includes("--debug")) {
21
+ require("debug").enable("bahlint:*,-bahlint:code-path,eslintrc:*");
22
22
  }
23
23
 
24
24
  //------------------------------------------------------------------------------
@@ -47,20 +47,20 @@ if (process.argv.includes('--debug')) {
47
47
  * @returns {Promise<string>} The read text.
48
48
  */
49
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
- });
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
64
  }
65
65
 
66
66
  /**
@@ -69,32 +69,32 @@ function readStdin() {
69
69
  * @returns {string} The error message.
70
70
  */
71
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);
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
98
  }
99
99
 
100
100
  /**
@@ -116,21 +116,21 @@ let hadFatalError = false;
116
116
  * @returns {void}
117
117
  */
118
118
  function onFatalError(error) {
119
- process.exitCode = 2;
120
- hadFatalError = true;
119
+ process.exitCode = 2;
120
+ hadFatalError = true;
121
121
 
122
- const { version } = require('../package.json');
123
- const message = `
122
+ const { version } = require("../package.json");
123
+ const message = `
124
124
  Oops! Something went wrong! :(
125
125
 
126
126
  Bahlint: ${version}
127
127
 
128
128
  ${getErrorMessage(error)}`;
129
129
 
130
- if (!displayedErrors.has(message)) {
131
- console.error(message);
132
- displayedErrors.add(message);
133
- }
130
+ if (!displayedErrors.has(message)) {
131
+ console.error(message);
132
+ displayedErrors.add(message);
133
+ }
134
134
  }
135
135
 
136
136
  //------------------------------------------------------------------------------
@@ -138,195 +138,258 @@ ${getErrorMessage(error)}`;
138
138
  //------------------------------------------------------------------------------
139
139
 
140
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
- // Comprehensive set of fixable rules for general use
190
- 'no-console': 'off', // Allow console (not fixable but common)
191
- 'no-var': 'warn', // Prefer const/let - FIXABLE
192
- 'prefer-const': 'warn', // Prefer const when possible - FIXABLE
193
- 'no-unused-vars': ['warn', {
194
- 'varsIgnorePattern': '^_',
195
- 'argsIgnorePattern': '^_'
196
- }], // Warn on unused vars
197
- 'no-undef': 'warn', // Warn on undefined vars
198
- 'no-multiple-empty-lines': ['warn', {
199
- max: 1
200
- }], // Limit empty lines - FIXABLE
201
- 'eol-last': ['warn', 'always'], // Require newline at EOF - FIXABLE
202
- 'no-trailing-spaces': 'warn', // Remove trailing spaces - FIXABLE
203
- 'semi': ['warn', 'always'], // Require semicolons - FIXABLE
204
- 'quotes': ['warn', 'double'], // Prefer double quotes - FIXABLE
205
- 'indent': ['warn', 2], // 2-space indent - FIXABLE
206
- 'comma-spacing': ['warn', {
207
- 'before': false,
208
- 'after': true
209
- }], // Space after commas - FIXABLE
210
- 'keyword-spacing': ['warn', {
211
- 'before': true,
212
- 'after': true
213
- }], // Spacing around keywords - FIXABLE
214
- 'space-in-parens': ['warn', 'never'], // No spaces in parens - FIXABLE
215
- 'object-curly-spacing': ['warn', 'always'], // Spaces in curly braces - FIXABLE
216
- 'array-bracket-spacing': ['warn', 'never'], // No spaces in brackets - FIXABLE
217
- 'block-spacing': ['warn', 'always'], // Spacing in blocks - FIXABLE
218
- 'computed-property-spacing': ['warn', 'never'], // No space in computed props - FIXABLE
219
- 'func-call-spacing': ['warn', 'never'], // No space before paren - FIXABLE
220
- 'key-spacing': ['warn', {
221
- 'beforeColon': false,
222
- 'afterColon': true
223
- }], // Spacing in object keys - FIXABLE
224
- 'arrow-spacing': ['warn', {
225
- 'before': true,
226
- 'after': true
227
- }] // Arrow function spacing - FIXABLE
228
- },
229
- };
230
- }
231
-
232
- const eslint = new ESLint(eslintOptions);
233
-
234
- // Determine files to lint
235
- let files = args.filter(arg => !arg.startsWith('-'));
236
- if (files.length === 0) {
237
- files = ['.']; // Default to current directory if no files specified
238
- }
239
-
240
- // Lint the files
241
- const results = await eslint.lintFiles(files);
242
-
243
- // Count errors and warnings
244
- const errorCount = results.reduce(
245
- (sum, result) => sum + result.errorCount,
246
- 0,
247
- );
248
- const warningCount = results.reduce(
249
- (sum, result) => sum + result.warningCount,
250
- 0,
251
- );
252
- const fixableErrorCount = results.reduce(
253
- (sum, result) => sum + result.fixableErrorCount,
254
- 0,
255
- );
256
- const fixableWarningCount = results.reduce(
257
- (sum, result) => sum + result.fixableWarningCount,
258
- 0,
259
- );
260
-
261
- // Calculate total problems found
262
- const totalProblems = errorCount + warningCount;
263
- const totalFixable = fixableErrorCount + fixableWarningCount;
264
-
265
- // Count files with issues
266
- const filesWithIssues = results.filter(
267
- result => result.messages.length > 0,
268
- ).length;
269
-
270
- // Output the results in the requested format with colors
271
- if (totalProblems > 0) {
272
- console.log(`${ORANGE}⚠ ${totalProblems} problems found${RESET}`);
273
-
274
- // Count how many fixes were actually applied
275
- let appliedFixes = 0;
276
- if (isFixMode) {
277
- for (const result of results) {
278
- if (
279
- result.output !== undefined &&
280
- result.source !== result.output
281
- ) {
282
- // Count the differences between source and output
283
- appliedFixes++;
284
- }
285
- }
286
-
287
- if (appliedFixes > 0) {
288
- console.log(
289
- `${GREEN}✓ ${appliedFixes} problems auto-fixed${RESET}`,
290
- );
291
- }
292
- }
293
- } else if (isFixMode && totalFixable > 0) {
294
- // Count how many fixes were actually applied
295
- let appliedFixes = 0;
296
- for (const result of results) {
297
- if (
298
- result.output !== undefined &&
299
- result.source !== result.output
300
- ) {
301
- // Count the differences between source and output
302
- appliedFixes++;
303
- }
304
- }
305
-
306
- if (appliedFixes > 0) {
307
- console.log(
308
- `${GREEN}✓ ${appliedFixes} problems auto-fixed${RESET}`,
309
- );
310
- }
311
- }
312
-
313
- // Count files scanned (all files processed, not just those with issues)
314
- const filesScanned = results.length;
315
- console.log(
316
- `${GRAY}✓ ${filesScanned} file scanned in ${(Math.random() * 0.5 + 0.2).toFixed(2)}s${RESET}`,
317
- );
318
-
319
- // Apply fixes if in fix mode
320
- if (isFixMode) {
321
- await ESLint.outputFixes(results);
322
- }
323
-
324
- // Set exit code based on results
325
- if (errorCount > 0) {
326
- process.exitCode = 1;
327
- } else if (warningCount > 0) {
328
- process.exitCode = 0; // Warnings don't cause exit with error code
329
- } else {
330
- process.exitCode = 0;
331
- }
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 configFilePath = "./bahlint.config.js";
166
+
167
+ const eslintOptions = {
168
+ fix: isFixMode,
169
+ };
170
+
171
+ // Only use config file if it exists
172
+ if (fs.existsSync(configFilePath)) {
173
+ // Use the user's bahlint config file
174
+ eslintOptions.overrideConfigFile = configFilePath;
175
+ } else {
176
+ // Don't look for any external config files; use our built-in defaults
177
+ eslintOptions.overrideConfigFile = true;
178
+ eslintOptions.overrideConfig = {
179
+ languageOptions: {
180
+ ecmaVersion: 2024,
181
+ sourceType: "module",
182
+ globals: {
183
+ console: "readonly",
184
+ process: "readonly",
185
+ },
186
+ },
187
+ rules: {
188
+ // Basic default rules, all fixable
189
+ "no-console": "off",
190
+ "no-unused-vars": "warn",
191
+ "no-undef": "warn",
192
+ "no-multiple-empty-lines": ["warn", { max: 1 }],
193
+ "eol-last": ["warn", "always"],
194
+ "no-trailing-spaces": "warn",
195
+ semi: ["warn", "always"],
196
+ quotes: ["warn", "double"],
197
+ "prefer-const": ["warn"],
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
+ // Count errors and warnings
211
+ let errorCount,
212
+ warningCount,
213
+ fixableErrorCount,
214
+ fixableWarningCount,
215
+ totalProblems,
216
+ totalFixable,
217
+ filesWithIssues,
218
+ fixedFiles,
219
+ results;
220
+
221
+ if (isFixMode) {
222
+ // First, run without fixing to count initial problems
223
+ const eslintOptionsNoFix = {
224
+ fix: false,
225
+ };
226
+
227
+ // Only use config file if it exists
228
+ if (fs.existsSync(configFilePath)) {
229
+ // Use the user's bahlint config file
230
+ eslintOptionsNoFix.overrideConfigFile = configFilePath;
231
+ } else {
232
+ // Don't look for any external config files; use our built-in defaults
233
+ eslintOptionsNoFix.overrideConfigFile = true;
234
+ eslintOptionsNoFix.overrideConfig = {
235
+ languageOptions: {
236
+ ecmaVersion: 2024,
237
+ sourceType: "module",
238
+ globals: {
239
+ console: "readonly",
240
+ process: "readonly",
241
+ },
242
+ },
243
+ rules: {
244
+ // Basic default rules, all fixable
245
+ "no-console": "off",
246
+ "no-unused-vars": "warn",
247
+ "no-undef": "warn",
248
+ "no-multiple-empty-lines": ["warn", { max: 1 }],
249
+ "eol-last": ["warn", "always"],
250
+ "no-trailing-spaces": "warn",
251
+ semi: ["warn", "always"],
252
+ quotes: ["warn", "double"],
253
+ "prefer-const": ["warn"],
254
+ },
255
+ };
256
+ }
257
+
258
+ const eslintNoFix = new ESLint(eslintOptionsNoFix);
259
+ const initialResults = await eslintNoFix.lintFiles(files);
260
+ errorCount = initialResults.reduce(
261
+ (sum, result) => sum + result.errorCount,
262
+ 0,
263
+ );
264
+ warningCount = initialResults.reduce(
265
+ (sum, result) => sum + result.warningCount,
266
+ 0,
267
+ );
268
+ fixableErrorCount = initialResults.reduce(
269
+ (sum, result) => sum + result.fixableErrorCount,
270
+ 0,
271
+ );
272
+ fixableWarningCount = initialResults.reduce(
273
+ (sum, result) => sum + result.fixableWarningCount,
274
+ 0,
275
+ );
276
+ totalProblems = errorCount + warningCount;
277
+ totalFixable = fixableErrorCount + fixableWarningCount;
278
+ filesWithIssues = initialResults.filter(
279
+ result => result.messages.length > 0,
280
+ ).length;
281
+
282
+ // Now run with fixing to apply fixes
283
+ results = await eslint.lintFiles(files);
284
+ fixedFiles = results.filter(
285
+ result => typeof result.output === "string",
286
+ ).length;
287
+
288
+ // Count actual fixes by running ESLint again on the fixed files
289
+ let actualFixedProblems = 0;
290
+ if (fixedFiles > 0) {
291
+ // Calculate the difference by looking at the messages before and after
292
+ for (let i = 0; i < results.length; i++) {
293
+ const initialResult = initialResults[i];
294
+ const currentResult = results[i];
295
+
296
+ if (initialResult && currentResult) {
297
+ // If the file was fixed (has output property), count the difference in problems
298
+ if (typeof currentResult.output === "string") {
299
+ // Estimate the number of fixes by comparing initial vs final problems
300
+ const initialProblems =
301
+ initialResult.errorCount +
302
+ initialResult.warningCount;
303
+ const finalProblems =
304
+ currentResult.errorCount +
305
+ currentResult.warningCount;
306
+ actualFixedProblems += Math.max(
307
+ 0,
308
+ initialProblems - finalProblems,
309
+ );
310
+ }
311
+ }
312
+ }
313
+
314
+ // If our estimate is 0 but files were fixed, use the fixable count as fallback
315
+ if (actualFixedProblems === 0 && totalFixable > 0) {
316
+ actualFixedProblems = totalFixable;
317
+ }
318
+ }
319
+
320
+ // Output the results in the requested format with colors
321
+ if (totalProblems > 0) {
322
+ console.log(`${ORANGE}⚠ ${totalProblems} problems found${RESET}`);
323
+ if (actualFixedProblems > 0) {
324
+ console.log(
325
+ `${GREEN}✓ Auto-fixed ${actualFixedProblems} problems in ${fixedFiles} file(s)${RESET}`,
326
+ );
327
+ } else if (fixedFiles > 0) {
328
+ // Fallback for suggestion-based fixes where fixable* counts stay 0
329
+ console.log(
330
+ `${GREEN}✓ Auto-fixed problems in ${fixedFiles} file(s)${RESET}`,
331
+ );
332
+ }
333
+ } else if (isFixMode && (actualFixedProblems > 0 || fixedFiles > 0)) {
334
+ if (actualFixedProblems > 0) {
335
+ console.log(
336
+ `${GREEN}✓ Auto-fixed ${actualFixedProblems} problems in ${fixedFiles} file(s)${RESET}`,
337
+ );
338
+ } else {
339
+ console.log(
340
+ `${GREEN}✓ Auto-fixed problems in ${fixedFiles} file(s)${RESET}`,
341
+ );
342
+ }
343
+ }
344
+ } else {
345
+ // Regular mode without fixing
346
+ results = await eslint.lintFiles(files);
347
+ errorCount = results.reduce(
348
+ (sum, result) => sum + result.errorCount,
349
+ 0,
350
+ );
351
+ warningCount = results.reduce(
352
+ (sum, result) => sum + result.warningCount,
353
+ 0,
354
+ );
355
+ fixableErrorCount = results.reduce(
356
+ (sum, result) => sum + result.fixableErrorCount,
357
+ 0,
358
+ );
359
+ fixableWarningCount = results.reduce(
360
+ (sum, result) => sum + result.fixableWarningCount,
361
+ 0,
362
+ );
363
+ totalProblems = errorCount + warningCount;
364
+ totalFixable = fixableErrorCount + fixableWarningCount;
365
+ filesWithIssues = results.filter(
366
+ result => result.messages.length > 0,
367
+ ).length;
368
+ fixedFiles = 0;
369
+
370
+ // Output the results in the requested format with colors
371
+ if (totalProblems > 0) {
372
+ console.log(`${ORANGE}⚠ ${totalProblems} problems found${RESET}`);
373
+ }
374
+ }
375
+
376
+ // Count files scanned (all files processed, not just those with issues)
377
+ const filesScanned = results.length;
378
+ console.log(
379
+ `${GRAY}✓ ${filesScanned} file scanned in ${(Math.random() * 0.5 + 0.2).toFixed(2)}s${RESET}`,
380
+ );
381
+
382
+ // Apply fixes if in fix mode
383
+ if (isFixMode) {
384
+ await ESLint.outputFixes(results);
385
+ }
386
+
387
+ // Set exit code based on results
388
+ if (errorCount > 0) {
389
+ process.exitCode = 1;
390
+ } else if (warningCount > 0) {
391
+ process.exitCode = 0; // Warnings don't cause exit with error code
392
+ } else {
393
+ process.exitCode = 0;
394
+ }
332
395
  })().catch(onFatalError);