-
-
Notifications
You must be signed in to change notification settings - Fork 976
Fix font-family-no-missing-generic-family-keyword
false positives for math
#8489
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
Conversation
🦋 Changeset detectedLatest commit: 723b391 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Note:
That is entirely unrelated :) @otomad, thank you for working on this issue. Can you split this into two separate pull requests? |
No, current And if |
I meant that the current Edit: my comment was purely intended to say that the existence of the fork and whether we switch to it or not should not be a factor in how we solve this specific issue. Either we can fix this issue with
|
Should I open a new issue before pull request?
|
Our convention indeed is to first open an issue and then a pull request :) |
PR packaged and instant preview available. Install locally:
|
`12px serif, math font` is a invalid font value, but before current commit, this case will display a strange font name ("serif font") in the error.
Oops, it seems that break It seems that it is useful to specify whether the property is
|
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.
@otomad Thank you for the pull request, and for splitting it into two.
Unless there are any objections, I think we can merge this as it fixes the issue. We can create an issue to investigate whether refactoring to use CSSTree can improve things. Someone can then pick that up if they have time.
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.
Thank you for addressing the math
keyword for the font properties. Sounds great 👍🏼
I've left a few minor suggestions, so could you take a look? 🙏🏼
Due to the possibility of `refactoring no-duplicate-at-import-rules`, `declaration-block-no-redundant-longhand-properties`, `color-function-notation`, etc. later to reuse `isCommaDiv` function, its type declaration is revised to make it more accurate.
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.
LGTM 👍🏼
| datasource | package | from | to | | ---------- | --------- | ------- | ------- | | npm | stylelint | 16.17.0 | 16.18.0 | ## [v16.18.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#16180---2025-04-06) It adds 2 new rules and fixes 2 bugs. We've turned on these rules, and the `syntax-string-no-invalid` and `layer-name-pattern` ones from recent releases, in our [standard config](https://www.npmjs.com/package/stylelint-config-standard). - Added: `color-function-alias-notation` rule ([#8499](stylelint/stylelint#8499)) ([@EduardAkhmetshin](https://github.com/EduardAkhmetshin)). - Added: `container-name-pattern` rule ([#8498](stylelint/stylelint#8498)) ([@nate10j](https://github.com/nate10j)). - Fixed: `declaration-property-value-no-unknown` false positives for `math` of `font-size` ([#8495](stylelint/stylelint#8495)) ([@otomad](https://github.com/otomad)). - Fixed: `font-family-no-missing-generic-family-keyword` false positives for `math` ([#8489](stylelint/stylelint#8489)) ([@otomad](https://github.com/otomad)).
| datasource | package | from | to | | ---------- | --------- | ------- | ------- | | npm | stylelint | 16.17.0 | 16.18.0 | ## [v16.18.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#16180---2025-04-06) It adds 2 new rules and fixes 2 bugs. We've turned on these rules, and the `syntax-string-no-invalid` and `layer-name-pattern` ones from recent releases, in our [standard config](https://www.npmjs.com/package/stylelint-config-standard). - Added: `color-function-alias-notation` rule ([#8499](stylelint/stylelint#8499)) ([@EduardAkhmetshin](https://github.com/EduardAkhmetshin)). - Added: `container-name-pattern` rule ([#8498](stylelint/stylelint#8498)) ([@nate10j](https://github.com/nate10j)). - Fixed: `declaration-property-value-no-unknown` false positives for `math` of `font-size` ([#8495](stylelint/stylelint#8495)) ([@otomad](https://github.com/otomad)). - Fixed: `font-family-no-missing-generic-family-keyword` false positives for `math` ([#8489](stylelint/stylelint#8489)) ([@otomad](https://github.com/otomad)).
Closes #8436
Due to a special case
font: math math;
(the firstmath
is thefont-size
, the secondmath
is thefont-family
), it is not feasible to return themath
directly infindFontFamily
.Currently this is done by checking in
findFontFamily
when the value is a keyword for bothfont-family
andfont-size
, if its next node is a comma or it is already the last node, then treat it as afont-family
keyword, otherwise treat it as afont-size
keyword.It seems that when using
css-tree
, it will not pass the invalid examples in thefindFontFamily
test, such as:12pt/10pt Red/Black
,12pt/10pt Hawaii 5-0
.