Skip to content
Closed
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
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/config/config_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl ConfigStoreBuilder {
self.upsert_where(severity, |r| r.category() == *category);
}
LintFilterKind::Rule(plugin, rule) => {
let (plugin, rule) = super::rules::unalias_plugin_name(plugin, rule);
let plugin = super::rules::unalias_plugin_name(plugin);
self.upsert_where(severity, |r| r.plugin_name() == plugin && r.name() == rule);
}
LintFilterKind::Generic(name) => self.upsert_where(severity, |r| r.name() == name),
Expand All @@ -318,7 +318,7 @@ impl ConfigStoreBuilder {
self.rules.retain(|rule, _| rule.category() != *category);
}
LintFilterKind::Rule(plugin, rule) => {
let (plugin, rule) = super::rules::unalias_plugin_name(plugin, rule);
let plugin = super::rules::unalias_plugin_name(plugin);
self.rules.retain(|r, _| r.plugin_name() != plugin || r.name() != rule);
}
LintFilterKind::Generic(name) => self.rules.retain(|rule, _| rule.name() != name),
Expand Down
26 changes: 12 additions & 14 deletions crates/oxc_linter/src/config/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,26 +240,24 @@ fn parse_rule_key(name: &str) -> (String, String) {
name.to_string(),
);
};
unalias_plugin_name(plugin_name, rule_name)
(unalias_plugin_name(plugin_name).to_string(), rule_name.to_string())
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The special handling for @next plugin's rule name (trimming 'next/' prefix) has been lost. Previously, @next rules had their names processed with rule_name.trim_start_matches(\"next/\"). This logic needs to be preserved in parse_rule_key for correct rule name resolution.

Suggested change
(unalias_plugin_name(plugin_name).to_string(), rule_name.to_string())
if plugin_name == "@next" {
(unalias_plugin_name(plugin_name).to_string(), rule_name.trim_start_matches("next/").to_string())
} else {
(unalias_plugin_name(plugin_name).to_string(), rule_name.to_string())
}

Copilot uses AI. Check for mistakes.
}

pub(super) fn unalias_plugin_name(plugin_name: &str, rule_name: &str) -> (String, String) {
let (oxlint_plugin_name, rule_name) = match plugin_name {
"@typescript-eslint" => ("typescript", rule_name),
pub(super) fn unalias_plugin_name(plugin_name: &str) -> &str {
match plugin_name {
"@typescript-eslint" => "typescript",
// import-x has the same rules but better performance
"import-x" => ("import", rule_name),
"jsx-a11y" => ("jsx_a11y", rule_name),
"react-perf" => ("react_perf", rule_name),
"import-x" => "import",
"jsx-a11y" => "jsx_a11y",
"react-perf" => "react_perf",
// e.g. "@next/next/google-font-display"
"@next" => ("nextjs", rule_name.trim_start_matches("next/")),
"@next" => "nextjs",
// For backwards compatibility, react hook rules reside in the react plugin.
"react-hooks" => ("react", rule_name),
"react-hooks" => "react",
// For backwards compatibility, deepscan rules reside in the oxc plugin.
"deepscan" => ("oxc", rule_name),
_ => (plugin_name, rule_name),
};

(oxlint_plugin_name.to_string(), rule_name.to_string())
"deepscan" => "oxc",
_ => plugin_name,
}
}

fn parse_rule_value(
Expand Down
Loading