Skip to content

fix: allow overriding rule group by each rule#5459

Merged
siketyan merged 2 commits intobiomejs:mainfrom
siketyan:fix/GH-5456
Mar 26, 2025
Merged

fix: allow overriding rule group by each rule#5459
siketyan merged 2 commits intobiomejs:mainfrom
siketyan:fix/GH-5456

Conversation

@siketyan
Copy link
Member

@siketyan siketyan commented Mar 25, 2025

Summary

Fixed #5456

Previously, merging a rule configuration into a rule group configuration was not supported.
Added a merge implementation as expanding the group and merge specific rules.

Test Plan

Test added.

@siketyan siketyan requested review from a team March 25, 2025 17:55
@siketyan siketyan self-assigned this Mar 25, 2025
@github-actions github-actions bot added A-Project Area: project A-Tooling Area: internal tools labels Mar 25, 2025
Comment on lines 753 to 769
*self = match (&self, other) {
(Self::Plain(lhs), Self::Plain(rhs)) => {
let mut lhs = lhs.clone();
lhs.merge_with(rhs);
Self::Plain(lhs)
}
(Self::Group(lhs), Self::Group(rhs)) => {
let mut lhs = lhs.clone();
lhs.merge_with(rhs);
Self::Group(lhs)
}
(Self::Plain(lhs), Self::Group(rhs)) => {
let mut lhs = G::from(*lhs);
lhs.merge_with(rhs);
Self::Group(lhs)
}
(Self::Group(_), Self::Plain(rhs)) => Self::Plain(rhs),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is ugly, but there is a moved value issue :(

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Looks good! Just some linting to fix

@siketyan siketyan merged commit 7d79dd3 into biomejs:main Mar 26, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project A-Tooling Area: internal tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 [v2] Overrides not working when all linter category rules are on

2 participants

Comments