diff --git a/apps/oxlint/fixtures/ignore_patterns_whitelist/.oxlintrc.json b/apps/oxlint/fixtures/ignore_patterns_whitelist/.oxlintrc.json new file mode 100644 index 0000000000000..0044ce11bd7ae --- /dev/null +++ b/apps/oxlint/fixtures/ignore_patterns_whitelist/.oxlintrc.json @@ -0,0 +1,9 @@ +{ + "rules": { + "no-debugger": "error" + }, + "ignorePatterns": [ + "*.ts", + "!*.whitelist.ts" + ] +} diff --git a/apps/oxlint/fixtures/ignore_patterns_whitelist/index.ts b/apps/oxlint/fixtures/ignore_patterns_whitelist/index.ts new file mode 100644 index 0000000000000..eab74692130a6 --- /dev/null +++ b/apps/oxlint/fixtures/ignore_patterns_whitelist/index.ts @@ -0,0 +1 @@ +debugger; diff --git a/apps/oxlint/fixtures/ignore_patterns_whitelist/index.whitelist.ts b/apps/oxlint/fixtures/ignore_patterns_whitelist/index.whitelist.ts new file mode 100644 index 0000000000000..eab74692130a6 --- /dev/null +++ b/apps/oxlint/fixtures/ignore_patterns_whitelist/index.whitelist.ts @@ -0,0 +1 @@ +debugger; diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index 696e5cd9f6862..04004cf00d788 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -718,6 +718,15 @@ mod test { .test_and_snapshot_multiple(&[args1, args2]); } + #[test] + fn ignore_patterns_whitelist() { + let args1 = &[]; + let args2 = &["."]; + Tester::new() + .with_cwd("fixtures/ignore_patterns_whitelist".into()) + .test_and_snapshot_multiple(&[args1, args2]); + } + #[test] fn filter_allow_all() { let args = &["-A", "all", "fixtures/linter"]; diff --git a/apps/oxlint/src/snapshots/fixtures__ignore_patterns_whitelist_ .@oxlint.snap b/apps/oxlint/src/snapshots/fixtures__ignore_patterns_whitelist_ .@oxlint.snap new file mode 100644 index 0000000000000..f5842cc8af37c --- /dev/null +++ b/apps/oxlint/src/snapshots/fixtures__ignore_patterns_whitelist_ .@oxlint.snap @@ -0,0 +1,38 @@ +--- +source: apps/oxlint/src/tester.rs +--- +########## +arguments: +working directory: fixtures/ignore_patterns_whitelist +---------- + + x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed + ,-[index.whitelist.ts:1:1] + 1 | debugger; + : ^^^^^^^^^ + `---- + help: Remove the debugger statement + +Found 0 warnings and 1 error. +Finished in ms on 1 file using 1 threads. +---------- +CLI result: LintFoundErrors +---------- + +########## +arguments: . +working directory: fixtures/ignore_patterns_whitelist +---------- + + x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed + ,-[index.whitelist.ts:1:1] + 1 | debugger; + : ^^^^^^^^^ + `---- + help: Remove the debugger statement + +Found 0 warnings and 1 error. +Finished in ms on 1 file using 1 threads. +---------- +CLI result: LintFoundErrors +----------