Skip to content

Fix token parsing for Studio edge cases#3859

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/figma-plugin-issue-review-180a
Draft

Fix token parsing for Studio edge cases#3859
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/figma-plugin-issue-review-180a

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 4, 2026

Why does this PR exist?

Closes #3854
Closes #3856
Closes #3857

Recent issues reported token-loading/rendering failures and incorrect type buckets for tokens coming from Studio or malformed JSON.

What does this pull request do?

  • Ignores non-string incoming token name metadata when normalizing parsed token JSON, so token paths still come from the JSON hierarchy.
  • Tightens isSingleToken so groups with child tokens named name and value are not misidentified as leaf tokens.
  • Normalizes Studio type aliases space -> spacing and size -> sizing during token conversion, including inherited group types.
  • Adds regression coverage for the malformed name case, the name/value child-token group case, and Studio type aliases.

Testing this change

  • Not run locally: this automation container does not have node, npm, yarn, or installed node_modules, so Jest/lint commands cannot start here.
  • Attempted focused Jest command: yarn test --runTestsByPath src/utils/convertTokens.test.ts src/app/components/utils.test.ts --runInBand.

Additional Notes (if any)

The code changes are intentionally scoped to token conversion/type guarding and should be low-risk for existing valid token JSON.

Open in Web View Automation 

Co-authored-by: Jan Six <six.jan@gmail.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

⚠️ No Changeset found

Latest commit: d701c43

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

⤵️ 📦 ✨ The artifact was successfully created! Want to test it? Download it here 👀 🎁

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Commit SHA:7171f5393a3ae96c4fba4490d24cef3a0ef3f749

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: cursor/figma-plugin-issue-review-180a 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 61.57 (0) 53.08 (0.03) 59.33 (0.01) 61.97 (0)
🟢 packages/tokens-studio-for-figma/src/utils/convertTokens.tsx 80.7 (0.31) 77.14 (1.76) 85.71 (2.38) 79.62 (0.46)

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

Labels

None yet

Projects

None yet

1 participant