refactor(linter): optimize merge method and clarify precedence semantics#15786
refactor(linter): optimize merge method and clarify precedence semantics#15786
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
- Revert merge signature to take ownership instead of reference - Update call site to pass ownership - Avoid unnecessary clones by using owned values - Expand comment with example showing merge priority Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Oxlintrc::merge method to improve performance and clarify merge semantics based on post-merge review feedback.
- Optimized
mergemethod signature to take ownership ofotherparameter instead of borrowing - Removed unnecessary clones of owned fields (
categoriesandoverrides) - Enhanced documentation with concrete example showing precedence semantics (self wins over other)
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/oxlintrc.rs | Updated merge method signature to take ownership and removed redundant clones; expanded documentation with precedence example |
| crates/oxc_linter/src/config/config_builder.rs | Updated call site to pass owned value instead of reference to match new signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace code block with only comments with inline code blocks for JSON examples to make the documentation clearer and prevent rustdoc errors. Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
CodSpeed Performance ReportMerging #15786 will not alter performanceComparing Summary
Footnotes
|
…ics (oxc-project#15786) Addresses post-merge review feedback on oxc-project#14939. ## Changes - **Optimize `Oxlintrc::merge` signature**: Take ownership of `other` parameter instead of borrowing, avoiding unnecessary clone since caller owns the value - **Remove redundant clones**: Use owned fields directly (`other.categories`, `other.overrides`) - **Clarify merge semantics**: Expand documentation with concrete example showing `self` wins when both configs define the same property - **Fix documentation format**: Use inline code blocks for JSON examples instead of a code block with comments Previously confusing which config took precedence; documentation now makes the behavior explicit and clear. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > review the code review comments on oxc-project#14939 (comment) and action them </details> <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/oxc-project/oxc/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com> Co-authored-by: Cameron <cameron.clark@hey.com>
Addresses post-merge review feedback on #14939.
Changes
Oxlintrc::mergesignature: Take ownership ofotherparameter instead of borrowing, avoiding unnecessary clone since caller owns the valueother.categories,other.overrides)selfwins when both configs define the same propertyPreviously confusing which config took precedence; documentation now makes the behavior explicit and clear.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.