diff --git a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap index 5096157a14dda..7721f36078f12 100644 --- a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: help: Use the isNaN function to compare with NaN. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_--ignore-pattern _____.js --ignore-pattern _____.vue fixtures__linter@oxlint.snap b/apps/oxlint/src/snapshots/_--ignore-pattern _____.js --ignore-pattern _____.vue fixtures__linter@oxlint.snap index 588f08796ff29..04b817f25309c 100644 --- a/apps/oxlint/src/snapshots/_--ignore-pattern _____.js --ignore-pattern _____.vue fixtures__linter@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--ignore-pattern _____.js --ignore-pattern _____.vue fixtures__linter@oxlint.snap @@ -6,7 +6,7 @@ arguments: --ignore-pattern **/*.js --ignore-pattern **/*.vue fixtures/linter working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 0 files with 98 rules using 1 threads. +Finished in ms on 0 files with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_--import-plugin -A all -D no-cycle fixtures__flow__@oxlint.snap b/apps/oxlint/src/snapshots/_--import-plugin -A all -D no-cycle fixtures__flow__@oxlint.snap index 9d57950fc16b6..6183fcb7dd170 100644 --- a/apps/oxlint/src/snapshots/_--import-plugin -A all -D no-cycle fixtures__flow__@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--import-plugin -A all -D no-cycle fixtures__flow__@oxlint.snap @@ -6,7 +6,7 @@ arguments: --import-plugin -A all -D no-cycle fixtures/flow/ working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 2 files with 100 rules using 1 threads. +Finished in ms on 2 files with 101 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_--import-plugin fixtures__flow__index.mjs@oxlint.snap b/apps/oxlint/src/snapshots/_--import-plugin fixtures__flow__index.mjs@oxlint.snap index 8a95dbdfa58c8..75aa4eebb7d41 100644 --- a/apps/oxlint/src/snapshots/_--import-plugin fixtures__flow__index.mjs@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--import-plugin fixtures__flow__index.mjs@oxlint.snap @@ -6,7 +6,7 @@ arguments: --import-plugin fixtures/flow/index.mjs working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 100 rules using 1 threads. +Finished in ms on 1 file with 101 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_--vitest-plugin -c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap b/apps/oxlint/src/snapshots/_--vitest-plugin -c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap index cde36ed63560f..cfb742a24ce9a 100644 --- a/apps/oxlint/src/snapshots/_--vitest-plugin -c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--vitest-plugin -c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap @@ -23,7 +23,7 @@ working directory: help: Remove the appending `.skip` Found 1 warning and 1 error. -Finished in ms on 1 file with 110 rules using 1 threads. +Finished in ms on 1 file with 111 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/_-D correctness fixtures__linter__debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/_-D correctness fixtures__linter__debugger.js@oxlint.snap index 173c9a74e3b71..d39c1c9fb58cc 100644 --- a/apps/oxlint/src/snapshots/_-D correctness fixtures__linter__debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-D correctness fixtures__linter__debugger.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: help: Delete this code. Found 0 warnings and 1 error. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/_-W correctness -A no-debugger fixtures__linter__debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/_-W correctness -A no-debugger fixtures__linter__debugger.js@oxlint.snap index 9ac0ebd24d226..11926e74336bd 100644 --- a/apps/oxlint/src/snapshots/_-W correctness -A no-debugger fixtures__linter__debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-W correctness -A no-debugger fixtures__linter__debugger.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -W correctness -A no-debugger fixtures/linter/debugger.js working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 97 rules using 1 threads. +Finished in ms on 1 file with 98 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap index a41380d006010..451e6f250263f 100644 --- a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap @@ -13,7 +13,7 @@ working directory: `---- Found 1 warning and 0 errors. -Finished in ms on 1 file with 99 rules using 1 threads. +Finished in ms on 1 file with 100 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap index c8b15c987b55a..b34f6ffdb16df 100644 --- a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap @@ -13,7 +13,7 @@ working directory: `---- Found 1 warning and 0 errors. -Finished in ms on 1 file with 99 rules using 1 threads. +Finished in ms on 1 file with 100 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__config_ignore_patterns__ignore_extension__eslintrc.json fixtures__config_ignore_patterns__ignore_extension@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__config_ignore_patterns__ignore_extension__eslintrc.json fixtures__config_ignore_patterns__ignore_extension@oxlint.snap index 95bc7ca2113d4..a43786a245a3e 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__config_ignore_patterns__ignore_extension__eslintrc.json fixtures__config_ignore_patterns__ignore_extension@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__config_ignore_patterns__ignore_extension__eslintrc.json fixtures__config_ignore_patterns__ignore_extension@oxlint.snap @@ -12,7 +12,7 @@ working directory: help: Delete this file or add some code to it. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_env__eslintrc_env_browser.json fixtures__eslintrc_env__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_env__eslintrc_env_browser.json fixtures__eslintrc_env__test.js@oxlint.snap index e79323f8a1a5b..cb33e86eda5d2 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_env__eslintrc_env_browser.json fixtures__eslintrc_env__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_env__eslintrc_env_browser.json fixtures__eslintrc_env__test.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -c fixtures/eslintrc_env/eslintrc_env_browser.json fixtures/eslintrc_ working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 99 rules using 1 threads. +Finished in ms on 1 file with 100 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_off__eslintrc.json fixtures__eslintrc_off__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_off__eslintrc.json fixtures__eslintrc_off__test.js@oxlint.snap index 8f748789bc352..49f293a3120bc 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_off__eslintrc.json fixtures__eslintrc_off__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_off__eslintrc.json fixtures__eslintrc_off__test.js@oxlint.snap @@ -12,7 +12,7 @@ working directory: help: Delete this file or add some code to it. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap index 4ff236ce5fc1d..77f21d13514f5 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__eslintrc_vitest_replace__eslintrc.json fixtures__eslintrc_vitest_replace__foo.test.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -c fixtures/eslintrc_vitest_replace/eslintrc.json fixtures/eslintrc_v working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__linter__eslintrc.json fixtures__linter__debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__linter__eslintrc.json fixtures__linter__debugger.js@oxlint.snap index f69b246d08185..065900024163f 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__linter__eslintrc.json fixtures__linter__debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__linter__eslintrc.json fixtures__linter__debugger.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: help: Delete this code. Found 0 warnings and 1 error. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__no_console_off__eslintrc.json fixtures__no_console_off__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__no_console_off__eslintrc.json fixtures__no_console_off__test.js@oxlint.snap index eb0cecc961bc3..382c554509c03 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__no_console_off__eslintrc.json fixtures__no_console_off__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__no_console_off__eslintrc.json fixtures__no_console_off__test.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -c fixtures/no_console_off/eslintrc.json fixtures/no_console_off/test working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__no_empty_allow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_allow_empty_catch__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__no_empty_allow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_allow_empty_catch__test.js@oxlint.snap index 916c27aa074ff..a3f53acca7df7 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__no_empty_allow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_allow_empty_catch__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__no_empty_allow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_allow_empty_catch__test.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -c fixtures/no_empty_allow_empty_catch/eslintrc.json -W no-empty fixt working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 99 rules using 1 threads. +Finished in ms on 1 file with 100 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__no_empty_disallow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_disallow_empty_catch__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__no_empty_disallow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_disallow_empty_catch__test.js@oxlint.snap index 248a3785745eb..95a340ff42192 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__no_empty_disallow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_disallow_empty_catch__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__no_empty_disallow_empty_catch__eslintrc.json -W no-empty fixtures__no_empty_disallow_empty_catch__test.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: help: Remove this block or add a comment inside it Found 1 warning and 0 errors. -Finished in ms on 1 file with 99 rules using 1 threads. +Finished in ms on 1 file with 100 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.js -c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.ts -c fixtures__overrides__.oxlintrc.json fixtures__overrides__other.jsx@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.js -c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.ts -c fixtures__overrides__.oxlintrc.json fixtures__overrides__other.jsx@oxlint.snap index dadc20f0ffb1e..a03d8b7ba3ebf 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.js -c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.ts -c fixtures__overrides__.oxlintrc.json fixtures__overrides__other.jsx@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.js -c fixtures__overrides__.oxlintrc.json fixtures__overrides__test.ts -c fixtures__overrides__.oxlintrc.json fixtures__overrides__other.jsx@oxlint.snap @@ -15,7 +15,7 @@ working directory: help: Replace var with let or const Found 0 warnings and 1 error. -Finished in ms on 1 file with 100 rules using 1 threads. +Finished in ms on 1 file with 101 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- @@ -42,7 +42,7 @@ working directory: help: Delete this console statement. Found 1 warning and 1 error. -Finished in ms on 1 file with 100 rules using 1 threads. +Finished in ms on 1 file with 101 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- @@ -61,7 +61,7 @@ working directory: help: Replace var with let or const Found 0 warnings and 1 error. -Finished in ms on 1 file with 100 rules using 1 threads. +Finished in ms on 1 file with 101 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/_-c fixtures__overrides__directories-config.json fixtures__overrides@oxlint.snap b/apps/oxlint/src/snapshots/_-c fixtures__overrides__directories-config.json fixtures__overrides@oxlint.snap index 5396815ed8312..0a80dbaf99147 100644 --- a/apps/oxlint/src/snapshots/_-c fixtures__overrides__directories-config.json fixtures__overrides@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-c fixtures__overrides__directories-config.json fixtures__overrides@oxlint.snap @@ -35,7 +35,7 @@ working directory: help: Delete this code. Found 2 warnings and 2 errors. -Finished in ms on 7 files with 97 rules using 1 threads. +Finished in ms on 7 files with 98 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__astro__debugger.astro@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__astro__debugger.astro@oxlint.snap index 9efe13bc1a76d..d2b247ff04a5d 100644 --- a/apps/oxlint/src/snapshots/_fixtures__astro__debugger.astro@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__astro__debugger.astro@oxlint.snap @@ -39,7 +39,7 @@ working directory: help: Delete this code. Found 4 warnings and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap index ba76d052df6cc..eee2c5b37a5bc 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap @@ -28,7 +28,7 @@ working directory: help: Use the isNaN function to compare with NaN. Found 3 warnings and 0 errors. -Finished in ms on 3 files with 98 rules using 1 threads. +Finished in ms on 3 files with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap index 1dfded89c41e6..4e625d4e35454 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap @@ -21,7 +21,7 @@ working directory: help: Use the isNaN function to compare with NaN. Found 2 warnings and 0 errors. -Finished in ms on 2 files with 98 rules using 1 threads. +Finished in ms on 2 files with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js@oxlint.snap index e6dfdeca45810..9e83bac5f6469 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: help: Delete this code. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__svelte__debugger.svelte@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__svelte__debugger.svelte@oxlint.snap index 3538ff1bb2556..f21f8ed22f74d 100644 --- a/apps/oxlint/src/snapshots/_fixtures__svelte__debugger.svelte@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__svelte__debugger.svelte@oxlint.snap @@ -16,7 +16,7 @@ working directory: help: Delete this code. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__vue__debugger.vue@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__vue__debugger.vue@oxlint.snap index c335bb0f538e4..41255d3386467 100644 --- a/apps/oxlint/src/snapshots/_fixtures__vue__debugger.vue@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__vue__debugger.vue@oxlint.snap @@ -23,7 +23,7 @@ working directory: help: Delete this code. Found 2 warnings and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_fixtures__vue__empty.vue@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__vue__empty.vue@oxlint.snap index 829728692f753..fe00a080bda4e 100644 --- a/apps/oxlint/src/snapshots/_fixtures__vue__empty.vue@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__vue__empty.vue@oxlint.snap @@ -6,7 +6,7 @@ arguments: fixtures/vue/empty.vue working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/_foo.asdf@oxlint.snap b/apps/oxlint/src/snapshots/_foo.asdf@oxlint.snap index 3e4213c24af75..4039b37dc6e05 100644 --- a/apps/oxlint/src/snapshots/_foo.asdf@oxlint.snap +++ b/apps/oxlint/src/snapshots/_foo.asdf@oxlint.snap @@ -6,7 +6,7 @@ arguments: foo.asdf working directory: ---------- Found 0 warnings and 0 errors. -Finished in ms on 0 files with 98 rules using 1 threads. +Finished in ms on 0 files with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__auto_config_detection_debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__auto_config_detection_debugger.js@oxlint.snap index 351f78d5b244f..cf772aa920f4e 100644 --- a/apps/oxlint/src/snapshots/fixtures__auto_config_detection_debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__auto_config_detection_debugger.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: fixtures/auto_config_detection help: Delete this code. Found 0 warnings and 1 error. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__ignore_directory_-c eslintrc.json@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__ignore_directory_-c eslintrc.json@oxlint.snap index ed17b47f7ba13..c1448f6e7518a 100644 --- a/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__ignore_directory_-c eslintrc.json@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__ignore_directory_-c eslintrc.json@oxlint.snap @@ -14,7 +14,7 @@ working directory: fixtures/config_ignore_patterns/ignore_directory help: Delete this file or add some code to it. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__with_oxlintrc_-c .__test__eslintrc.json --ignore-pattern _.ts .@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__with_oxlintrc_-c .__test__eslintrc.json --ignore-pattern _.ts .@oxlint.snap index 82c650d9a6965..874ec0f5979e3 100644 --- a/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__with_oxlintrc_-c .__test__eslintrc.json --ignore-pattern _.ts .@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__config_ignore_patterns__with_oxlintrc_-c .__test__eslintrc.json --ignore-pattern _.ts .@oxlint.snap @@ -12,7 +12,7 @@ working directory: fixtures/config_ignore_patterns/with_oxlintrc help: Delete this file or add some code to it. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__disable_eslint_and_unicorn_alias_rules_-c .oxlintrc-eslint.json test.js -c .oxlintrc-unicorn.json test.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__disable_eslint_and_unicorn_alias_rules_-c .oxlintrc-eslint.json test.js -c .oxlintrc-unicorn.json test.js@oxlint.snap index f344b0ecb8b36..5b1b01aa13fc5 100644 --- a/apps/oxlint/src/snapshots/fixtures__disable_eslint_and_unicorn_alias_rules_-c .oxlintrc-eslint.json test.js -c .oxlintrc-unicorn.json test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__disable_eslint_and_unicorn_alias_rules_-c .oxlintrc-eslint.json test.js -c .oxlintrc-unicorn.json test.js@oxlint.snap @@ -16,7 +16,7 @@ arguments: -c .oxlintrc-unicorn.json test.js working directory: fixtures/disable_eslint_and_unicorn_alias_rules ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 62 rules using 1 threads. +Finished in ms on 1 file with 63 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__linter_debugger.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__linter_debugger.js@oxlint.snap index bf227f2dfe90e..99fc956e70cd6 100644 --- a/apps/oxlint/src/snapshots/fixtures__linter_debugger.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__linter_debugger.js@oxlint.snap @@ -14,7 +14,7 @@ working directory: fixtures/linter help: Delete this code. Found 1 warning and 0 errors. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__output_formatter_diagnostic_--format=default test.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__output_formatter_diagnostic_--format=default test.js@oxlint.snap index b5f77a93f0617..2869fa9134556 100644 --- a/apps/oxlint/src/snapshots/fixtures__output_formatter_diagnostic_--format=default test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__output_formatter_diagnostic_--format=default test.js@oxlint.snap @@ -33,7 +33,7 @@ working directory: fixtures/output_formatter_diagnostic help: Delete this code. Found 2 warnings and 1 error. -Finished in ms on 1 file with 98 rules using 1 threads. +Finished in ms on 1 file with 99 rules using 1 threads. ---------- CLI result: LintFoundErrors ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__overrides_env_globals_-c .oxlintrc.json .@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__overrides_env_globals_-c .oxlintrc.json .@oxlint.snap index fa2245acef4c6..c69431376ae32 100644 --- a/apps/oxlint/src/snapshots/fixtures__overrides_env_globals_-c .oxlintrc.json .@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__overrides_env_globals_-c .oxlintrc.json .@oxlint.snap @@ -51,7 +51,7 @@ working directory: fixtures/overrides_env_globals `---- Found 5 warnings and 0 errors. -Finished in ms on 3 files with 98 rules using 1 threads. +Finished in ms on 3 files with 99 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/apps/oxlint/src/snapshots/fixtures__two_rules_with_same_rule_name_-c .oxlintrc.json test.js@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__two_rules_with_same_rule_name_-c .oxlintrc.json test.js@oxlint.snap index 344d577bfc5f4..b031565413ec8 100644 --- a/apps/oxlint/src/snapshots/fixtures__two_rules_with_same_rule_name_-c .oxlintrc.json test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/fixtures__two_rules_with_same_rule_name_-c .oxlintrc.json test.js@oxlint.snap @@ -6,7 +6,7 @@ arguments: -c .oxlintrc.json test.js working directory: fixtures/two_rules_with_same_rule_name ---------- Found 0 warnings and 0 errors. -Finished in ms on 1 file with 62 rules using 1 threads. +Finished in ms on 1 file with 63 rules using 1 threads. ---------- CLI result: LintSucceeded ---------- diff --git a/crates/oxc_linter/src/rules.rs b/crates/oxc_linter/src/rules.rs index 89ce665f7d68f..b4a9458114e67 100644 --- a/crates/oxc_linter/src/rules.rs +++ b/crates/oxc_linter/src/rules.rs @@ -332,6 +332,7 @@ mod unicorn { pub mod no_empty_file; pub mod no_hex_escape; pub mod no_instanceof_array; + pub mod no_invalid_fetch_options; pub mod no_invalid_remove_event_listener; pub mod no_length_as_slice_end; pub mod no_lonely_if; @@ -936,6 +937,7 @@ oxc_macros::declare_all_lint_rules! { unicorn::explicit_length_check, unicorn::filename_case, unicorn::new_for_builtins, + unicorn::no_invalid_fetch_options, unicorn::no_abusive_eslint_disable, unicorn::no_anonymous_default_export, unicorn::no_array_for_each, diff --git a/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs b/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs new file mode 100644 index 0000000000000..1b583d0e02d6c --- /dev/null +++ b/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs @@ -0,0 +1,209 @@ +use std::borrow::Cow; + +use cow_utils::CowUtils; +use oxc_allocator::Box; +use oxc_ast::{ + ast::{Argument, Expression, ObjectExpression, ObjectPropertyKind, PropertyKey}, + AstKind, +}; +use oxc_diagnostics::OxcDiagnostic; +use oxc_macros::declare_oxc_lint; +use oxc_semantic::AstNode; +use oxc_span::Span; + +use crate::{ast_util::is_new_expression, rule::Rule, LintContext}; + +fn no_invalid_fetch_options_diagnostic(span: Span, method: &str) -> OxcDiagnostic { + let message = format!(r#""body" is not allowed when method is "{method}""#); + + OxcDiagnostic::warn(message).with_label(span) +} + +#[derive(Debug, Default, Clone)] +pub struct NoInvalidFetchOptions; + +declare_oxc_lint!( + /// ### What it does + /// + /// Disallow invalid options in `fetch()` and `new Request()`. Specifically, this rule ensures that + /// a body is not provided when the method is `GET` or `HEAD`, as it will result in a `TypeError`. + /// + /// ### Why is this bad? + /// + /// The `fetch()` function throws a `TypeError` when the method is `GET` or `HEAD` and a body is provided. + /// This can lead to unexpected behavior and errors in your code. By disallowing such invalid options, + /// the rule ensures that requests are correctly configured and prevents unnecessary errors. + /// + /// ### Examples + /// + /// Examples of **incorrect** code for this rule: + /// ```javascript + /// const response = await fetch('/', {method: 'GET', body: 'foo=bar'}); + /// + /// const request = new Request('/', {method: 'GET', body: 'foo=bar'}); + /// ``` + /// + /// Examples of **correct** code for this rule: + /// ```javascript + /// const response = await fetch('/', {method: 'POST', body: 'foo=bar'}); + /// + /// const request = new Request('/', {method: 'POST', body: 'foo=bar'}); + /// ``` + NoInvalidFetchOptions, + unicorn, + correctness, +); + +impl Rule for NoInvalidFetchOptions { + fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) { + let arg = match node.kind() { + AstKind::CallExpression(call_expr) => { + if !call_expr.callee.is_specific_id("fetch") || call_expr.arguments.len() < 2 { + return; + } + + &call_expr.arguments[1] + } + AstKind::NewExpression(new_expr) => { + if !is_new_expression(new_expr, &["Request"], Some(2), None) { + return; + } + + &new_expr.arguments[1] + } + _ => return, + }; + + let Argument::ObjectExpression(expr) = arg else { return }; + let result = is_invalid_fetch_options(expr, ctx); + + if let Some((method_name, body_span)) = result { + ctx.diagnostic(no_invalid_fetch_options_diagnostic(body_span, &method_name)); + } + } +} + +fn is_invalid_fetch_options<'a>( + obj_expr: &'a Box<'_, ObjectExpression<'_>>, + ctx: &'a LintContext<'_>, +) -> Option<(Cow<'a, str>, Span)> { + // fetch and Request method defaults to "GET" + let mut body_span = Span::default(); + let mut method_name = Cow::Borrowed("GET"); + + for property in &obj_expr.properties { + if property.is_spread() { + return None; + } + + let ObjectPropertyKind::ObjectProperty(obj_prop) = property else { + continue; + }; + let PropertyKey::StaticIdentifier(key_ident) = &obj_prop.key else { + continue; + }; + + let key_ident_name = key_ident.name.as_str(); + + if key_ident_name == "body" { + if obj_prop.value.is_null_or_undefined() { + body_span.end = body_span.start; + } else { + body_span = key_ident.span; + } + } else if key_ident_name == "method" { + let method = match &obj_prop.value { + Expression::StringLiteral(value_ident) => &value_ident.value, + Expression::Identifier(value_ident) => { + let symbols = ctx.semantic().symbols(); + let reference_id = value_ident.reference_id(); + + let Some(symbol_id) = symbols.get_reference(reference_id).symbol_id() else { + continue; + }; + + let decl = ctx.semantic().nodes().get_node(symbols.get_declaration(symbol_id)); + + let AstKind::VariableDeclarator(declarator) = decl.kind() else { + continue; + }; + + let Some(Expression::StringLiteral(str_lit)) = &declarator.init else { + continue; + }; + + &str_lit.value + } + _ => continue, + }; + + method_name = method.cow_to_ascii_uppercase(); + } + } + + if (method_name == "GET" || method_name == "HEAD") && !body_span.is_empty() { + Some((method_name, body_span)) + } else { + None + } +} + +#[test] +fn test() { + use crate::tester::Tester; + + let pass = vec![ + r#"fetch(url, {method: "POST", body})"#, + r#"new Request(url, {method: "POST", body})"#, + r"fetch(url, {})", + r"new Request(url, {})", + r"fetch(url)", + r"new Request(url)", + r#"fetch(url, {method: "UNKNOWN", body})"#, + r#"new Request(url, {method: "UNKNOWN", body})"#, + r"fetch(url, {body: undefined})", + r"new Request(url, {body: undefined})", + r"fetch(url, {body: null})", + r"new Request(url, {body: null})", + r"fetch(url, {...options, body})", + r"new Request(url, {...options, body})", + r"new fetch(url, {body})", + r"Request(url, {body})", + r"not_fetch(url, {body})", + r"new not_Request(url, {body})", + r"fetch({body}, url)", + r"new Request({body}, url)", + r#"fetch(url, {[body]: "foo=bar"})"#, + r#"new Request(url, {[body]: "foo=bar"})"#, + r#"fetch(url, {body: "foo=bar", body: undefined});"#, + r#"new Request(url, {body: "foo=bar", body: undefined});"#, + r#"fetch(url, {method: "HEAD", body: "foo=bar", method: "post"});"#, + r#"new Request(url, {method: "HEAD",body: "foo=bar", method: "POST"});"#, + r#"fetch('/', {body: new URLSearchParams({ data: "test" }), method: "POST"})"#, + r#"const method = "post"; new Request(url, {method, body: "foo=bar"})"#, + r#"const method = "post"; fetch(url, {method, body: "foo=bar"})"#, + ]; + + let fail = vec![ + r"fetch(url, {body})", + r"new Request(url, {body})", + r#"fetch(url, {method: "GET", body})"#, + r#"new Request(url, {method: "GET", body})"#, + r#"fetch(url, {method: "HEAD", body})"#, + r#"new Request(url, {method: "HEAD", body})"#, + r#"fetch(url, {method: "head", body})"#, + r#"new Request(url, {method: "head", body})"#, + r#"const method = "head"; new Request(url, {method, body: "foo=bar"})"#, + r#"const method = "head"; fetch(url, {method, body: "foo=bar"})"#, + r"fetch(url, {body}, extraArgument)", + r"new Request(url, {body}, extraArgument)", + r#"fetch(url, {body: undefined, body: "foo=bar"});"#, + r#"new Request(url, {body: undefined, body: "foo=bar"});"#, + r#"fetch(url, {method: "post", body: "foo=bar", method: "HEAD"});"#, + r#"new Request(url, {method: "post", body: "foo=bar", method: "HEAD"});"#, + r#"fetch('/', {body: new URLSearchParams({ data: "test" })})"#, + ]; + + Tester::new(NoInvalidFetchOptions::NAME, NoInvalidFetchOptions::PLUGIN, pass, fail) + .test_and_snapshot(); +} diff --git a/crates/oxc_linter/src/snapshots/unicorn_no_invalid_fetch_options.snap b/crates/oxc_linter/src/snapshots/unicorn_no_invalid_fetch_options.snap new file mode 100644 index 0000000000000..4af1dd184c973 --- /dev/null +++ b/crates/oxc_linter/src/snapshots/unicorn_no_invalid_fetch_options.snap @@ -0,0 +1,104 @@ +--- +source: crates/oxc_linter/src/tester.rs +--- + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:13] + 1 │ fetch(url, {body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:19] + 1 │ new Request(url, {body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:28] + 1 │ fetch(url, {method: "GET", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:34] + 1 │ new Request(url, {method: "GET", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:29] + 1 │ fetch(url, {method: "HEAD", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:35] + 1 │ new Request(url, {method: "HEAD", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:29] + 1 │ fetch(url, {method: "head", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:35] + 1 │ new Request(url, {method: "head", body}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:50] + 1 │ const method = "head"; new Request(url, {method, body: "foo=bar"}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:44] + 1 │ const method = "head"; fetch(url, {method, body: "foo=bar"}) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:13] + 1 │ fetch(url, {body}, extraArgument) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:19] + 1 │ new Request(url, {body}, extraArgument) + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:30] + 1 │ fetch(url, {body: undefined, body: "foo=bar"}); + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:36] + 1 │ new Request(url, {body: undefined, body: "foo=bar"}); + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:29] + 1 │ fetch(url, {method: "post", body: "foo=bar", method: "HEAD"}); + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "HEAD" + ╭─[no_invalid_fetch_options.tsx:1:35] + 1 │ new Request(url, {method: "post", body: "foo=bar", method: "HEAD"}); + · ──── + ╰──── + + ⚠ eslint-plugin-unicorn(no-invalid-fetch-options): "body" is not allowed when method is "GET" + ╭─[no_invalid_fetch_options.tsx:1:13] + 1 │ fetch('/', {body: new URLSearchParams({ data: "test" })}) + · ──── + ╰────