Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes (attempt 2/3)
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored and camchenry committed Nov 13, 2024
1 parent da0503a commit 21f5b71
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 1 deletion.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions apps/oxlint/fixtures/overrides/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"rules": {
"no-var": "error",
"no-console": "error"
},
"overrides": [
{
"files": ["*.js"],
"rules": {
"no-console": "warn"
}
},
{
"files": ["*.{js,jsx}"],
"rules": {
"no-console": "off"
}
},
{
"files": ["*.ts"],
"rules": {
"no-console": "warn"
}
}
]
}
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/overrides/other.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var msg = "hello";
console.log(msg);
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/overrides/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var msg = "hello";
console.log(msg);
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/overrides/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var msg = "hello";
console.log(msg);
21 changes: 21 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,4 +629,25 @@ mod test {
std::fs::read_to_string("fixtures/print_config/ban_rules/expect.json").unwrap();
assert_eq!(config, expect_json.trim());
}

#[test]
fn test_overrides() {
let result =
test(&["-c", "fixtures/overrides/.oxlintrc.json", "fixtures/overrides/test.js"]);
assert_eq!(result.number_of_files, 1);
assert_eq!(result.number_of_warnings, 0);
assert_eq!(result.number_of_errors, 1);

let result =
test(&["-c", "fixtures/overrides/.oxlintrc.json", "fixtures/overrides/test.ts"]);
assert_eq!(result.number_of_files, 1);
assert_eq!(result.number_of_warnings, 1);
assert_eq!(result.number_of_errors, 1);

let result =
test(&["-c", "fixtures/overrides/.oxlintrc.json", "fixtures/overrides/other.jsx"]);
assert_eq!(result.number_of_files, 1);
assert_eq!(result.number_of_warnings, 0);
assert_eq!(result.number_of_errors, 1);
}
}

0 comments on commit 21f5b71

Please sign in to comment.