-
-
Notifications
You must be signed in to change notification settings - Fork 941
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 false positives for variables in font-family-no-missing-generic-family-keyword #5240
Conversation
```css | ||
a { font-family: Helvetica, var(--font-family-common); } | ||
``` | ||
|
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.
[note] I think it valuable to add examples which are using variables.
@@ -23,6 +24,12 @@ const messages = ruleMessages(ruleName, { | |||
const isFamilyNameKeyword = (node) => | |||
!node.quote && keywordSets.fontFamilyKeywords.has(node.value.toLowerCase()); | |||
|
|||
const isLastFontFamilyVariable = (value) => { | |||
const lastValue = postcss.list.comma(value).pop(); |
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.
[note] postcss.list.comma()
seems more suitable than postcss.list.space()
in this case.
See also https://postcss.org/api/#list
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 PR ignores always any variables for the font-family property, but perhaps some people might want to ignore explicitly via the ignoreFontFamilies secondary option
I think your PR is the right call. Overloading ignoreFontFamily
for variables is confusing users, and we should reserve it for its original intention of icon fonts, e.g. font-family: awesomefont;
and ignoreFontFamily: ["awesomefont"]
LGTM, thanks.
font-family-no-missing-generic-family-keyword
ignore any variables
|
@jeddy3 Thank you for the review. 😊 |
This change aims to ignore any variables (e.g.
var()
,$var
,@var
etc.) for thefont-family-no-missing-generic-family-keyword
rule.Fix #4765 (retry of #4806)
This PR ignores always any variables for the
font-family
property, but perhaps some people might want to ignore explicitly via theignoreFontFamilies
secondary option as below:Could you please give me feedback about this point?