refactor(linter): simplify unalias_plugin_name#14921
refactor(linter): simplify unalias_plugin_name#14921lilnasy wants to merge 1 commit intooxc-project:mainfrom
unalias_plugin_name#14921Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the unalias_plugin_name function by removing its second parameter and changing its return type from a tuple to a string slice, making the function more focused and easier to use.
Key changes:
unalias_plugin_namenow returns only the plugin name as&strinstead of a tuple- Callers handle rule name processing independently
- Special case handling for
@nextplugin moved to caller
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_linter/src/config/rules.rs | Refactored unalias_plugin_name to return only the plugin name and updated parse_rule_key to handle rule name separately |
| crates/oxc_linter/src/config/config_builder.rs | Updated call sites to only destructure the plugin name from unalias_plugin_name |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ); | ||
| }; | ||
| unalias_plugin_name(plugin_name, rule_name) | ||
| (unalias_plugin_name(plugin_name).to_string(), rule_name.to_string()) |
There was a problem hiding this comment.
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.
| (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()) | |
| } |
CodSpeed Performance ReportMerging #14921 will not alter performanceComparing Summary
Footnotes
|
Follow up to #14912.
unalias_plugin_namedoesn't need a second parameter. It was kept that way to keep the review diff small.