Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): add unicorn/no-invalid-fetch-options rule #9212

Merged
merged 5 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory:
help: Use the isNaN function to compare with NaN.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: --ignore-pattern **/*.js --ignore-pattern **/*.vue fixtures/linter
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 0 files with 98 rules using 1 threads.
Finished in <variable>ms on 0 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: --import-plugin -A all -D no-cycle fixtures/flow/
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 2 files with 100 rules using 1 threads.
Finished in <variable>ms on 2 files with 101 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: --import-plugin fixtures/flow/index.mjs
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
Finished in <variable>ms on 1 file with 101 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ working directory:
help: Remove the appending `.skip`

Found 1 warning and 1 error.
Finished in <variable>ms on 1 file with 110 rules using 1 threads.
Finished in <variable>ms on 1 file with 111 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory:
help: Delete this code.

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: -W correctness -A no-debugger fixtures/linter/debugger.js
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 97 rules using 1 threads.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ working directory:
`----

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ working directory:
`----

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ working directory:
help: Delete this file or add some code to it.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 99 rules using 1 threads.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ working directory:
help: Delete this file or add some code to it.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory:
help: Delete this code.

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 99 rules using 1 threads.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory:
help: Remove this block or add a comment inside it

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ working directory:
help: Replace var with let or const

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
Finished in <variable>ms on 1 file with 101 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Expand All @@ -42,7 +42,7 @@ working directory:
help: Delete this console statement.

Found 1 warning and 1 error.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
Finished in <variable>ms on 1 file with 101 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Expand All @@ -61,7 +61,7 @@ working directory:
help: Replace var with let or const

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 100 rules using 1 threads.
Finished in <variable>ms on 1 file with 101 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ working directory:
help: Delete this code.

Found 2 warnings and 2 errors.
Finished in <variable>ms on 7 files with 97 rules using 1 threads.
Finished in <variable>ms on 7 files with 98 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ working directory:
help: Delete this code.

Found 4 warnings and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
2 changes: 1 addition & 1 deletion apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ working directory:
help: Use the isNaN function to compare with NaN.

Found 3 warnings and 0 errors.
Finished in <variable>ms on 3 files with 98 rules using 1 threads.
Finished in <variable>ms on 3 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ working directory:
help: Use the isNaN function to compare with NaN.

Found 2 warnings and 0 errors.
Finished in <variable>ms on 2 files with 98 rules using 1 threads.
Finished in <variable>ms on 2 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory:
help: Delete this code.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ working directory:
help: Delete this code.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ working directory:
help: Delete this code.

Found 2 warnings and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: fixtures/vue/empty.vue
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
2 changes: 1 addition & 1 deletion apps/oxlint/src/snapshots/_foo.asdf@oxlint.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: foo.asdf
working directory:
----------
Found 0 warnings and 0 errors.
Finished in <variable>ms on 0 files with 98 rules using 1 threads.
Finished in <variable>ms on 0 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory: fixtures/auto_config_detection
help: Delete this code.

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 62 rules using 1 threads.
Finished in <variable>ms on 1 file with 63 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ working directory: fixtures/linter
help: Delete this code.

Found 1 warning and 0 errors.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ working directory: fixtures/output_formatter_diagnostic
help: Delete this code.

Found 2 warnings and 1 error.
Finished in <variable>ms on 1 file with 98 rules using 1 threads.
Finished in <variable>ms on 1 file with 99 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ working directory: fixtures/overrides_env_globals
`----

Found 5 warnings and 0 errors.
Finished in <variable>ms on 3 files with 98 rules using 1 threads.
Finished in <variable>ms on 3 files with 99 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variable>ms on 1 file with 62 rules using 1 threads.
Finished in <variable>ms on 1 file with 63 rules using 1 threads.
----------
CLI result: LintSucceeded
----------
2 changes: 2 additions & 0 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading