mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
test(oxlint): test two real rules with same name but from different plugins (#8821)
Related to #8814
This test case is designed to verify that two different rules, having
the same name but coming from different plugins, are treated as distinct
rules rather than simple aliases.
In `unicorn`, there is only one rule, `no-negated-condition`, which is
aliased to `eslint`.
655b212688/crates/oxc_linter/src/config/rules.rs (L166-L178)
This commit is contained in:
parent
b00b8c8b46
commit
0bf2bcf359
7 changed files with 38 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"plugins": [],
|
||||
"rules": {
|
||||
"eslint/no-nested-ternary": "off"
|
||||
"eslint/no-negated-condition": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
"unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/no-nested-ternary": "off"
|
||||
"unicorn/no-negated-condition": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
console.log(bar ? baz : qux === quxx ? bing : bam);
|
||||
if (!condition) {
|
||||
console.log(123)
|
||||
} else {
|
||||
console.log(666)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"plugins": [
|
||||
"unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"eslint/no-nested-ternary": "off",
|
||||
"unicorn/no-nested-ternary": "off"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
console.log(bar ? baz : qux === quxx ? bing : bam);
|
||||
|
|
@ -826,7 +826,6 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_disable_eslint_and_unicorn_alias_rules() {
|
||||
// Issue: <https://github.com/oxc-project/oxc/issues/8485>
|
||||
let args_1 = &["-c", ".oxlintrc-eslint.json", "test.js"];
|
||||
let args_2 = &["-c", ".oxlintrc-unicorn.json", "test.js"];
|
||||
Tester::new()
|
||||
|
|
@ -834,6 +833,15 @@ mod test {
|
|||
.test_and_snapshot_multiple(&[args_1, args_2]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_two_rules_with_same_rule_name_from_different_plugins() {
|
||||
// Issue: <https://github.com/oxc-project/oxc/issues/8485>
|
||||
let args = &["-c", ".oxlintrc.json", "test.js"];
|
||||
Tester::new()
|
||||
.with_cwd("fixtures/two_rules_with_same_rule_name".into())
|
||||
.test_and_snapshot(args);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_adjust_ignore_patterns() {
|
||||
let base = PathBuf::from("/project/root");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
source: apps/oxlint/src/tester.rs
|
||||
---
|
||||
##########
|
||||
arguments: -c .oxlintrc.json test.js
|
||||
working directory: fixtures/two_rules_with_same_rule_name
|
||||
----------
|
||||
Found 0 warnings and 0 errors.
|
||||
Finished in <variable>ms on 1 file with 61 rules using 1 threads.
|
||||
----------
|
||||
CLI result: LintSucceeded
|
||||
----------
|
||||
Loading…
Reference in a new issue