Skip to content

fix(dtcg): emit required typography lineHeight and letterSpacing - #177

Open
Arshgill01 wants to merge 1 commit into
google-labs-code:mainfrom
Arshgill01:cursor/fix-dtcg-typography-required-props-71e8
Open

fix(dtcg): emit required typography lineHeight and letterSpacing#177
Arshgill01 wants to merge 1 commit into
google-labs-code:mainfrom
Arshgill01:cursor/fix-dtcg-typography-required-props-71e8

Conversation

@Arshgill01

Copy link
Copy Markdown
Contributor

Fixes #172.

What changed

export --format dtcg advertised the 2025.10 DTCG schema but omitted two of the five required typography properties (lineHeight and letterSpacing), so every typography token failed validation.

Two separate gaps:

  1. lineHeight was in the source but dropped. YAML parses unquoted lineHeight: 1.6 as a number. The typography model only accepted string dimensions, so the value never reached the DTCG emitter. Quoted strings ("1.6") already worked. Finite numeric lineHeight is now kept as a unitless multiplier (the DTCG meaning). Bare numbers on fontSize / letterSpacing still error because those properties require an explicit unit.

  2. letterSpacing has no DESIGN.md source. The DTCG 2025.10 typography value schema requires letterSpacing. 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 lineHeight and explicitly did not invent a letterSpacing default. 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 build

Targeted:

bun test src/linter/model/handler.test.ts src/linter/dtcg/handler.test.ts

AI assistance

Cursor Grok assisted with investigation, TDD, and drafting this PR. I reviewed the change and ran the tests above.

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>
@Arshgill01

Copy link
Copy Markdown
Contributor Author

Soft ping — workflow approval

Still MERGEABLE / UNSTABLE because Test (and the Google Actions Workflow Security Scan) are waiting on maintainer Approve and run workflows for this fork PR.

  • CLA: pass
  • GitHub Actions Scan: pass
  • Local + fork CI were green when opened

Run needing approval: https://github.com/google-labs-code/design.md/actions/runs/33625694230

Happy to rebase if main moves. Fixes #172.

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.

dtcg export omits required typography properties, so output fails the schema it declares

1 participant