-
-
Notifications
You must be signed in to change notification settings - Fork 442
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(config): group-level lint rules calculation #2204
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -488,16 +487,16 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> | |||
matches!(self.recommended, Some(true)) | |||
} | |||
|
|||
pub(crate) const fn is_not_recommended(&self) -> bool { | |||
matches!(self.recommended, Some(false)) | |||
pub(crate) const fn is_recommended_unset(&self) -> bool { |
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.
Thanks for that! Naming is hard, and it's these little touches that can make a difference.
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 agree with you but here is a different case. is_not_recommended
tests Some(false)
while is_recommended_unset
tests None
. To implement the logic I created the latter one, and the former one is no longer needed in the code, hence the change.
To make the namings more consistent I probably should've renamed is_recommended
to is_recommended_true
. But as Ema suggests these preset options will be dropped in v2.0 so I didn't touch them.
d70c3d1
to
a9ee6c0
Compare
Summary
Correctly calculate enabled rules in lint rule groups.
This is the Karnaugh map of lint group preset logic:
A
,R
) \ Parent (A
,R
)N
,F
)N
,T
)F
,F
)F
,T
)T
,F
)T
,T
)N
,N
)R
R
A
A
N
,F
)A
A
N
,T
)R
R
R
R
A
A
F
,N
)R
R
F
,F
)F
,T
)R
R
R
R
R
R
T
,N
)A
A
A
A
A
A
T
,F
)A
A
A
A
A
A
T
,T
)A
A
A
A
A
A
A
:all
,R
:recommended
,N
:None
,T
:true
,F
:false
And the code to implement the above logic is:
When calculating the preset rules, we shouldn't populate the disabled rules set, because that will make specific rules cannot be enabled later.
Closes #2191.
Test Plan
Added a test case borrowed from #2191.