Skip to content

Commit fd29535

Browse files
committed
test(oxlint): add test for ignorePatterns whitelist (#13372)
closes #8842 Because of the fix in #13221 we support now allowlist too.
1 parent e1adb0f commit fd29535

File tree

5 files changed

+58
-0
lines changed

5 files changed

+58
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"rules": {
3+
"no-debugger": "error"
4+
},
5+
"ignorePatterns": [
6+
"*.ts",
7+
"!*.whitelist.ts"
8+
]
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;

apps/oxlint/src/lint.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,15 @@ mod test {
718718
.test_and_snapshot_multiple(&[args1, args2]);
719719
}
720720

721+
#[test]
722+
fn ignore_patterns_whitelist() {
723+
let args1 = &[];
724+
let args2 = &["."];
725+
Tester::new()
726+
.with_cwd("fixtures/ignore_patterns_whitelist".into())
727+
.test_and_snapshot_multiple(&[args1, args2]);
728+
}
729+
721730
#[test]
722731
fn filter_allow_all() {
723732
let args = &["-A", "all", "fixtures/linter"];
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
source: apps/oxlint/src/tester.rs
3+
---
4+
##########
5+
arguments:
6+
working directory: fixtures/ignore_patterns_whitelist
7+
----------
8+
9+
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
10+
,-[index.whitelist.ts:1:1]
11+
1 | debugger;
12+
: ^^^^^^^^^
13+
`----
14+
help: Remove the debugger statement
15+
16+
Found 0 warnings and 1 error.
17+
Finished in <variable>ms on 1 file using 1 threads.
18+
----------
19+
CLI result: LintFoundErrors
20+
----------
21+
22+
##########
23+
arguments: .
24+
working directory: fixtures/ignore_patterns_whitelist
25+
----------
26+
27+
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
28+
,-[index.whitelist.ts:1:1]
29+
1 | debugger;
30+
: ^^^^^^^^^
31+
`----
32+
help: Remove the debugger statement
33+
34+
Found 0 warnings and 1 error.
35+
Finished in <variable>ms on 1 file using 1 threads.
36+
----------
37+
CLI result: LintFoundErrors
38+
----------

0 commit comments

Comments
 (0)