Skip to content

fix(css): skip useGenericFontNames rule in @supports feature declarations#8979

Closed
kaigritun wants to merge 2 commits intobiomejs:mainfrom
kaigritun:fix/use-generic-font-names-supports-query
Closed

fix(css): skip useGenericFontNames rule in @supports feature declarations#8979
kaigritun wants to merge 2 commits intobiomejs:mainfrom
kaigritun:fix/use-generic-font-names-supports-query

Conversation

@kaigritun
Copy link

Summary

When a font property is used inside an @supports condition (e.g., @supports (font: -apple-system-body) {}), it's testing for browser support rather than actually setting a font. This should not trigger the 'Generic font family missing' error.

Before

@supports (font: -apple-system-body) {
  /* ... */
}

Would trigger: lint/a11y/useGenericFontNames: Generic font family missing.

After

No longer triggers the error for properties inside @supports feature declarations.

Changes

  • Added is_in_supports_feature_declaration() helper function to check if a property is inside an @supports condition
  • Updated rule to skip validation when inside CSS_SUPPORTS_FEATURE_DECLARATION nodes
  • Added test cases for @supports with font and font-family properties
  • Updated documentation to mention this exception

Test Plan

  • Added test cases to valid.css:
    • @supports (font: -apple-system-body) { }
    • @supports (font-family: -apple-system) { }
  • All existing tests pass

Closes #8845

…ions

When a font property is used in an @supports condition, it's testing for browser
support rather than actually setting a font. This should not trigger the
'Generic font family missing' error.

Closes biomejs#8845
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: 511a53c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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

@github-actions github-actions bot added A-Linter Area: linter L-CSS Language: CSS labels Feb 5, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Walkthrough

This change extends the useGenericFontNames CSS lint rule to skip analysis of declarations inside @supports feature blocks. It adds a helper is_in_supports_feature_declaration to detect when a CssGenericProperty has a CSS_SUPPORTS_FEATURE_DECLARATION ancestor, and returns early for those cases. The rule documentation and tests were updated (including fixing a selector typo) to reflect the new behaviour.

Possibly related PRs

Suggested reviewers

  • siketyan
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: skipping the useGenericFontNames rule within @supports feature declarations.
Description check ✅ Passed The description is well-related to the changeset, explaining the rationale, implementation details, and test plan for skipping the rule in @supports declarations.
Linked Issues check ✅ Passed The PR successfully addresses #8845 by implementing the core requirement: skipping the useGenericFontNames rule when properties appear inside @supports feature declarations.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the issue: rule implementation, helper function, test cases, and documentation updates for @supports handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kaigritun
Copy link
Author

Added changeset as requested.

@ematipico ematipico closed this Feb 6, 2026
@ematipico
Copy link
Member

Fixed by #8848

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 useGenericFontNames triggers in the @supports query

2 participants