Skip to content

fix(lint): don't report revert-layer as a font family without @font-face - #6872

Open
kevin9327 wants to merge 1 commit into
heygen-com:mainfrom
kevin9327:fix/font-revert-layer
Open

kevin9327 wants to merge 1 commit into
heygen-com:mainfrom
kevin9327:fix/font-revert-layer

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

What

font_family_without_font_face no longer reports revert-layer as a missing font family.

GENERIC_FAMILIES lists the CSS-wide keywords inherit, initial, unset and revert, but not revert-layer, the fifth one (CSS Cascade 5, supported in every current browser). A rule like

.title { font-family: revert-layer; }

is valid CSS that rolls the family back to the previous cascade layer, yet the linter reports it as an error: "Font family used without @font-face declaration: revert-layer".

Why

The finding is an error-severity false positive, and its fix hint (add an @font-face for revert-layer) cannot be followed.

Related work

None found (searched issues and PRs for revert-layer).

How

Add "revert-layer" next to "revert" in GENERIC_FAMILIES, so it is skipped like the other CSS-wide keywords.

Test plan

  • Unit tests added/updated: new case "does not flag the revert-layer keyword" in packages/lint/src/rules/fonts.test.ts. fonts.test.ts passes (58 tests); the rest of src/rules/ has the same results with and without the change.
  • Formatted with oxfmt 0.41.0.

fails without the fix: packages/lint/src/rules/fonts.test.ts › "does not flag the revert-layer keyword" (one font_family_without_font_face finding instead of none)

This PR was prepared with AI assistance; I reviewed the change and ran the tests.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant