fix(design): catch quoted font names in non-English custom properties - #94
Merged
Conversation
The typo gate only recognized typography custom properties by an English keyword in the property name (--*font*/--*ff*/--*type*). Tokens named in French, like the corpus's --police-texte, carried no such keyword and slipped through unbanned even when quoting a forbidden font (e.g. refs-design/linear-recode/styles.css: --police-texte: "Inter", ...). Add FONT_QUOTED_PROP_RE: any --* custom property whose value quotes one of the forbidden names is flagged, using the quote itself as the usage signal instead of an English keyword. Trade-off: a quoted mention in a non-keyword property (e.g. --comment: "we never use Inter") is flagged too, since it's indistinguishable from real usage without prose parsing. Adds test/design-font-custom-prop.test.ts (6 cases, mutation-checked) covering the two-line real-world fixture, all four banned names, the existing English-keyword branch (regression guard), and the allowed-font negative control.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--*font*/--*ff*/--*type*). A French-named token like the corpus's--police-texte: "Inter", …(refs-design/linear-recode/styles.css:60) carried no such keyword and slipped through unbanned.FONT_QUOTED_PROP_RE: flags any--*custom property whose value quotes a forbidden font name, using the quote itself as the usage signal. Accepted trade-off, documented in the JSDoc: a quoted mention in a non-keyword property (e.g.--comment: "we never use Inter") is flagged too — indistinguishable from real usage without prose parsing.chorecommit bumps CHANGELOG + package.json to 0.1.85 per repo convention (every commit gets its own release cycle).Changes
src/policy/design/design-system-rules.ts(37 → 45 lines)test/design-font-custom-prop.test.ts(new, 6 cases, mutation-checked)CHANGELOG.md,package.json(version bump, separate commit)Test plan
bun test— 987 pass / 1 skip / 0 fail (was 981/1/0 before; +6 tests, +1 file, exactly the additions)bunx tsc --noEmit— exit 0Breaking changes
None.