Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter: cannot disable no-nested-ternary rule anymore #8485

Open
jeremy-dupre opened this issue Jan 14, 2025 · 4 comments · May be fixed by #8600
Open

linter: cannot disable no-nested-ternary rule anymore #8485

jeremy-dupre opened this issue Jan 14, 2025 · 4 comments · May be fixed by #8600
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@jeremy-dupre
Copy link

jeremy-dupre commented Jan 14, 2025

What version of Oxlint are you using?

0.15.6

What command did you run?

oxlint -c .oxlintrc.json src

What does your .oxlint.json config file look like?

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"browser": true,
"es2024": true
},
"settings": {},
"plugins": ["oxc", "typescript", "unicorn"],
"categories": {
"correctness": "error",
"perf": "error",
"suspicious": "error",
"restriction": "error",
"style": "warn",
"pedantic": "warn",
"nursery": "off"
},
"rules": {
"no-nested-ternary": "off",
"eslint/no-nested-ternary": "off",
"unicorn/no-nested-ternary": "off"
}
}

What happened?

Since the new 'eslint/no-nested-ternary' rule appeared in 0.15.x (duplicating/replacing the previous unicorn/no-nested-ternary rule?), it seems it cannot be deactivated anymore. With the above setup the rule is still active and generates warning.
It was not the case in 0.14.x

@jeremy-dupre jeremy-dupre added A-linter Area - Linter C-bug Category - Bug labels Jan 14, 2025
@shulaoda
Copy link
Contributor

shulaoda commented Jan 18, 2025

Related to #5714

Should we change it?

// NOTE: this logic means there's no way to disable ESLint
// correctness rules. I think that's fine for now.

@1zumii
Copy link
Contributor

1zumii commented Jan 19, 2025

@shulaoda
i found that eslint/no-nested-ternary rule is set as RuleCategory::Style

maybe not the filter condition caused this issue?

NoNestedTernary,
eslint,
style,

@shulaoda
Copy link
Contributor

@shulaoda i found that eslint/no-nested-ternary rule is set as RuleCategory::Style

maybe not the filter condition caused this issue?

oxc/crates/oxc_linter/src/rules/eslint/no_nested_ternary.rs

Lines 41 to 43 in c15af02

 NoNestedTernary, 
 eslint, 
 style,

Yes, I made a mistake.

@1zumii
Copy link
Contributor

1zumii commented Jan 19, 2025

i guess problem is in this branch, only remove one of these rules with same name.

result that unicorn's rule is removed, but eslint's rule still remains.

} else if rule_configs.iter().all(|r| r.severity.is_allow()) {
if let Some(rule) = rules_for_override.iter().find(|r| r.name() == *name) {
rules_to_remove.push(rule.clone());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants