fix(dtcg): emit required typography lineHeight and letterSpacing - #177
Open
Arshgill01 wants to merge 1 commit into
Open
fix(dtcg): emit required typography lineHeight and letterSpacing#177Arshgill01 wants to merge 1 commit into
Arshgill01 wants to merge 1 commit into
Conversation
YAML unquoted lineHeight values were dropped because the typography
model only accepted string dimensions. Keep numeric lineHeight as a
unitless multiplier, and emit letterSpacing {value: 0, unit: "px"}
when DESIGN.md omits it so DTCG export satisfies the 2025.10 schema.
Fixes google-labs-code#172
Co-authored-by: Arshdeep singh <arshgill6120@gmail.com>
Contributor
Author
Soft ping — workflow approvalStill MERGEABLE /
Run needing approval: https://github.com/google-labs-code/design.md/actions/runs/33625694230 Happy to rebase if |
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.
Fixes #172.
What changed
export --format dtcgadvertised the 2025.10 DTCG schema but omitted two of the five required typography properties (lineHeightandletterSpacing), so every typography token failed validation.Two separate gaps:
lineHeightwas in the source but dropped. YAML parses unquotedlineHeight: 1.6as a number. The typography model only accepted string dimensions, so the value never reached the DTCG emitter. Quoted strings ("1.6") already worked. Finite numericlineHeightis now kept as a unitless multiplier (the DTCG meaning). Bare numbers onfontSize/letterSpacingstill error because those properties require an explicit unit.letterSpacinghas no DESIGN.md source. The DTCG 2025.10 typography value schema requiresletterSpacing. When the role omits it, the exporter now emits{ "value": 0, "unit": "px" }so the token validates. Explicit source values are unchanged.How this differs from closed #174
#174 (unmerged) only kept YAML numeric
lineHeightand explicitly did not invent aletterSpacingdefault. That left the schema-required field missing, so DTCG output still would not validate.This PR includes that lineHeight model fix and emits the letterSpacing default so option 1 from #172 is complete.
Verification
bun install bun run lint bun run test bun run buildTargeted:
bun test src/linter/model/handler.test.ts src/linter/dtcg/handler.test.tsAI assistance
Cursor Grok assisted with investigation, TDD, and drafting this PR. I reviewed the change and ran the tests above.