-
-
Notifications
You must be signed in to change notification settings - Fork 719
fix(oxlintrc): resolve relative plugin specifiers before merging extended configs #14562
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
fix(oxlintrc): resolve relative plugin specifiers before merging extended configs #14562
Conversation
| let mut normalized = FxHashSet::default(); | ||
| normalized.reserve(external_plugins.len()); | ||
|
|
||
| // we can safely consume external_plugins while iterating over it since its going to be replaced soon | ||
| for plugin in std::mem::take(external_plugins) { | ||
| let is_relative = plugin.starts_with("./") || plugin.starts_with("../"); | ||
| if is_relative { | ||
| let absolute = config_dir.join(&plugin); | ||
| // TODO: non utf8 path compatibility | ||
| normalized.insert(absolute.to_string_lossy().into_owned()); | ||
| } else { | ||
| normalized.insert(plugin); | ||
| } | ||
| } | ||
|
|
||
| config.external_plugins = Some(normalized); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can just mutate it in place, rather than allocating a new hash set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am new to rust, thanks for the tip!
CodSpeed Performance ReportMerging #14562 will not alter performanceComparing Summary
Footnotes
|
5f64b74 to
f07a3d2
Compare
32cceaf to
afdab8e
Compare
camc314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
3c97e2d
into
oxc-project:c/10-13-add_repro
…nded configs (#14562) - Fixes #14478 ## What's going wrong - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. ## Fix - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…nded configs (#14562) - Fixes #14478 ## What's going wrong - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. ## Fix - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…nded configs (#14562) - Fixes #14478 ## What's going wrong - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. ## Fix - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…nded configs (#14562) - Fixes #14478 ## What's going wrong - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. ## Fix - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…nded configs (#14562) - Fixes #14478 ## What's going wrong - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. ## Fix - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…nded configs (#14562) - Fixes #14478 - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Arsh <emmagoldmanvevo+github@pm.me>
…nded configs (#14562) - Fixes #14478 - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Arsh <emmagoldmanvevo+github@pm.me>
…nded configs (#14562) - Fixes #14478 - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Arsh <emmagoldmanvevo+github@pm.me>
…nded configs (#14562) - Fixes #14478 - Relative specifiers need to joined with their config's directory path. - When extended configs are merged. we drop the "other" config's path. - In this "extends" case, the plugins from the "other" config are resolved relative to the "self" config's path. That shouldn't happen. - All relative specifiers are resolved _before_ the merge. - Since full platform-specific (correct) paths to the plugin are logged when loading fails, this won't work well with the snapshot tests. <img width="898" height="249" alt="image" src="https://github.com/user-attachments/assets/7e4d0fa1-c0c1-4dc5-8135-dbf663900902" /> I am vacillating on this solution. Maybe external_plugin should be an enum. --------- Co-authored-by: Arsh <emmagoldmanvevo+github@pm.me>
What's going wrong
Fix
I am vacillating on this solution. Maybe external_plugin should be an enum.