-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
feat(biome_css_analyze): implement noDuplicateFontNames
#2308
feat(biome_css_analyze): implement noDuplicateFontNames
#2308
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
CodSpeed Performance ReportMerging #2308 will degrade performances by 7.87%Comparing Summary
Benchmarks breakdown
|
NoFontFamilyDuplicateNames
NoFontFamilyDuplicateNames
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.
The first CSS lint rule!!!! 🎆
/// ``` | ||
pub NoFontFamilyDuplicateNames { | ||
version: "next", | ||
name: "noFontFamilyDuplicateNames", |
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.
What do you think about noRedundantFontName
? We already have some rules that follow this naming convention
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.
Or noDuplicateFontNames
to align with our existing rule names?
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.
Both seem valid, your suggestion is better
Some(RuleDiagnostic::new( | ||
rule_category!(), | ||
span, | ||
markup! { | ||
"Unexpected duplicate font name: "<Emphasis>{ state.value }</Emphasis> | ||
}, | ||
)) |
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.
Let's follow the rule pillars:
- show the error
- explain why it could be an error
- suggest a solution
The solution usually is the code action, if we don't have a code action, we should suggest something.
/// | ||
/// This rule checks the `font` and `font-family` properties for duplicate font names. | ||
/// | ||
/// This rule ignores var(--custom-property) variable syntaxes. |
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.
This is actually a good excuse to evaluate the implementation of a possible semantic model for CSS :)
Of course, not in this PR!
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.
Yeah, it will come true in the near future:) e8510f4
af8b357
to
e8510f4
Compare
]; | ||
|
||
pub const FONT_WEIGHT_ABSOLUTE_KEYWORDS: [&str; 2] = ["normal", "bold"]; | ||
pub const FONT_WIGHT_NUMERIC_KEYWORDS: [&str; 9] = [ |
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.
pub const FONT_WIGHT_NUMERIC_KEYWORDS: [&str; 9] = [ | |
pub const FONT_WEIGHT_NUMERIC_KEYWORDS: [&str; 9] = [ |
"contextual", | ||
"no-contextual", | ||
"small-caps", | ||
"small-caps", |
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.
"small-caps", |
748d412
to
bf404c1
Compare
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.
You've done awesome work, @togami2864!
NoFontFamilyDuplicateNames
noDuplicateFontNames
Summary
Experimental implement font-family-no-duplicate-names from stylelint and add some predefined keywords, utils.
Test Plan
added tests and snapshots