Repository navigation
fix(lint): read actual font CSS declarations - #5221
user-github-me wants to merge 1 commit into
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Reading real declarations through PostCSS does fix the false error for unused --font-family tokens and content strings. But it also removes a detection that main has today. With :root { --font-family: "Brand Heading"; } h1 { font-family: var(--font-family); } and no @font-face, main reports the missing family and this branch reports nothing, even though the text will fall back at render. Could you resolve var(--x) references in font-family against custom properties declared in the same styles, or otherwise keep flagging tokens that are actually referenced? Please also add that case as a test.
— Rames
f4eec4a to
6254873
Compare
jrusso1020
left a comment
There was a problem hiding this comment.
My earlier blocking concern is resolved at this head. resolveUsedFontNames now resolves var(--x) against custom properties declared across the supplied style blocks, following aliases with a cycle and depth bound, and the exact case I raised (:root { --font-family: "Brand Heading"; } h1 { font-family: var(--font-family); }) is a test that expects one font_family_without_font_face finding. Unused tokens, content strings and quoted fake @font-face text stay quiet because only real PostCSS declarations are read. A block PostCSS cannot parse now contributes nothing to this rule, but that matches the other postcss-based lint rules, and css_parse_error reports that block separately. The branch still merges cleanly onto current main, and main has not fixed this another way.
— Rames
The font rules scan raw CSS for
font-family, so unused custom properties andcontentstrings can cause false missing-font errors. Quoted fake font-face declarations can also hide real missing fonts. Font tokens that are referenced byfont-family: var(--font-family)must still be checked.Read actual font declarations and descriptors through PostCSS. Resolve references against custom properties declared in the supplied styles, following bounded alias chains and keeping custom-property names case sensitive. Ignore unused tokens, unresolved variables, and cycles. Reuse the resolution for distributed alias warnings and locate missing-font diagnostics at the declaration that uses the token. This is static token resolution; it does not evaluate the full CSS cascade.
Validation:
Windows CI passes on current head
6254873: the current Windows run succeeds in all four lanes, including studio-1. The earlier Puppeteer installation failure is superseded. All current checks pass or are intentionally skipped.