mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
parent
33e5a49c78
commit
810671a4a0
5 changed files with 53 additions and 1 deletions
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"plugins": ["jest"],
|
||||
"categories": {
|
||||
"correctness": "off"
|
||||
},
|
||||
"rules": {
|
||||
"jest/no-identical-title": "error"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"plugins": ["vitest"],
|
||||
"categories": {
|
||||
"correctness": "off"
|
||||
},
|
||||
"rules": {
|
||||
"vitest/no-identical-title": "error"
|
||||
}
|
||||
}
|
||||
4
apps/oxlint/fixtures/jest_and_vitest_alias_rules/test.js
Normal file
4
apps/oxlint/fixtures/jest_and_vitest_alias_rules/test.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
describe("foo", () => {
|
||||
it("works", () => {});
|
||||
it("works", () => {});
|
||||
});
|
||||
|
|
@ -796,4 +796,27 @@ mod test {
|
|||
assert_eq!(result.number_of_warnings, 0);
|
||||
assert_eq!(result.number_of_errors, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_jest_and_vitest_alias_rules() {
|
||||
let args = &[
|
||||
"-c",
|
||||
"fixtures/jest_and_vitest_alias_rules/oxlint-jest.json",
|
||||
"fixtures/jest_and_vitest_alias_rules/test.js",
|
||||
];
|
||||
let result = test(args);
|
||||
assert_eq!(result.number_of_files, 1);
|
||||
assert_eq!(result.number_of_warnings, 0);
|
||||
assert_eq!(result.number_of_errors, 1);
|
||||
|
||||
let args = &[
|
||||
"-c",
|
||||
"fixtures/jest_and_vitest_alias_rules/oxlint-vitest.json",
|
||||
"fixtures/jest_and_vitest_alias_rules/test.js",
|
||||
];
|
||||
let result = test(args);
|
||||
assert_eq!(result.number_of_files, 1);
|
||||
assert_eq!(result.number_of_warnings, 0);
|
||||
assert_eq!(result.number_of_errors, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,9 +421,16 @@ impl RulesCache {
|
|||
let mut all_rules: Vec<_> = if self.plugins.is_all() {
|
||||
RULES.clone()
|
||||
} else {
|
||||
let mut plugins = self.plugins;
|
||||
|
||||
// we need to include some jest rules when vitest is enabled, see [`VITEST_COMPATIBLE_JEST_RULES`]
|
||||
if plugins.contains(LintPlugins::VITEST) {
|
||||
plugins = plugins.union(LintPlugins::JEST);
|
||||
}
|
||||
|
||||
RULES
|
||||
.iter()
|
||||
.filter(|rule| self.plugins.contains(LintPlugins::from(rule.plugin_name())))
|
||||
.filter(|rule| plugins.contains(LintPlugins::from(rule.plugin_name())))
|
||||
.cloned()
|
||||
.collect()
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue