Skip to content
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
13 changes: 13 additions & 0 deletions apps/oxlint/fixtures/overrides_with_plugin/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"overrides": [
{
"files": ["*.test.ts"],
"plugins": ["jest", "vitest"],
"rules": {
"jest/valid-title": "deny",
"no-unused-vars": "off"
}
}
]
}

7 changes: 7 additions & 0 deletions apps/oxlint/fixtures/overrides_with_plugin/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe("", () => {
//

it("", () => {});
});

const foo = 123;
1 change: 1 addition & 0 deletions apps/oxlint/fixtures/overrides_with_plugin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const foo = 123;
6 changes: 6 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,4 +1165,10 @@ mod test {
let args = &["-c", ".oxlintrc.json"];
Tester::new().with_cwd("fixtures/issue_11054".into()).test_and_snapshot(args);
}

#[test]
fn test_plugins_in_overrides_enabled_correctly() {
let args = &["-c", ".oxlintrc.json"];
Tester::new().with_cwd("fixtures/overrides_with_plugin".into()).test_and_snapshot(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
source: apps/oxlint/src/tester.rs
---
##########
arguments: -c .oxlintrc.json
working directory: fixtures/overrides_with_plugin
----------

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-title.html\eslint-plugin-jest(valid-title)]8;;\: "Should not have an empty title"
,-[index.test.ts:1:10]
1 | describe("", () => {
: ^^
2 | //
`----
help: "Write a meaningful title for your test"

! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html\eslint(no-unused-vars)]8;;\: Variable 'foo' is declared but never used. Unused variables should start with a '_'.
,-[index.ts:1:7]
1 | const foo = 123;
: ^|^
: `-- 'foo' is declared here
`----
help: Consider removing this declaration.

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-title.html\eslint-plugin-jest(valid-title)]8;;\: "Should not have an empty title"
,-[index.test.ts:4:6]
3 |
4 | it("", () => {});
: ^^
5 | });
`----
help: "Write a meaningful title for your test"

Found 1 warning and 2 errors.
Finished in <variable>ms on 2 files with 101 rules using 1 threads.
----------
CLI result: LintFoundErrors
----------
11 changes: 7 additions & 4 deletions crates/oxc_linter/src/config/config_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ impl Config {
let mut env = self.base.config.env.clone();
let mut globals = self.base.config.globals.clone();
let mut plugins = self.base.config.plugins;

for override_config in overrides_to_apply.clone() {
if let Some(override_plugins) = override_config.plugins {
plugins |= override_plugins;
}
}

let mut rules = self
.base
.rules
Expand All @@ -107,10 +114,6 @@ impl Config {
override_config.rules.override_rules(&mut rules, &all_rules);
}

if let Some(override_plugins) = override_config.plugins {
plugins |= override_plugins;
}

if let Some(override_env) = &override_config.env {
override_env.override_envs(&mut env);
}
Expand Down
Loading