Add validation for deprecated design tokens#324782
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the build-time stylelint design-token validation with a new check that flags usage of deprecated --vscode-bodyFontSize* tokens and suggests their current replacements. It wires the new validateDeprecatedTokens validator into the gulp stylelint task (including its own summary tally/footer category), and it retargets the existing font-size and font-weight suggestions from the agents--prefixed ramp to the generic --vscode-fontSize-* / --vscode-fontWeight-* ramp, updating the accompanying comments accordingly.
The deprecation mapping is correct and matches the @deprecated annotations in src/vs/platform/theme/common/sizes/baseSizes.ts and the design-tokens instructions doc. The one point worth a human decision: these validators run by default on src/vs/sessions/**, where the surrounding CSS and the sessions ramp table in design-tokens.instructions.md use the agents--prefixed variants, so switching the ramp/weight suggestions to the generic tokens introduces a convention inconsistency in that area.
Changes:
- Add
validateDeprecatedTokensto detect deprecated--vscode-bodyFontSize*vars and suggest replacements, with prefix-boundary handling to avoid double-reporting. - Integrate the new validator into
build/stylelint.ts(findings collection,deprecatedcount category, and footer summary). - Retarget
FONT_SIZE_RAMPand the font-weight suggestion from--vscode-agents-fontSize-*/--vscode-agents-fontWeight-*to the generic--vscode-fontSize-*/--vscode-fontWeight-*tokens (plus comment wording updates).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| build/lib/stylelint/validateDesignTokens.ts | Adds the validateDeprecatedTokens validator and deprecated-token map; retargets font-size/weight suggestions to generic tokens and refreshes comments. |
| build/stylelint.ts | Imports and runs the new validator, adds the deprecated category to the tally, total, and summary footer. |
This pull request updates the design token validation logic to align with the latest naming conventions and adds a new check for deprecated token usage. The most significant changes are the renaming of several font size and weight tokens to their new generic forms, and the introduction of a linter that detects and reports deprecated tokens, suggesting their replacements. The summary reporting at the end of the stylelint run now also includes a count of deprecated token findings.
Design token naming updates:
validateDesignTokens.tsto use the new--vscode-fontSize-*and--vscode-fontWeight-*variables instead of the old--vscode-agents-*and--vscode-bodyFontSize*variables. This affects the mapping, comments, and violation messages. [1] [2] [3] [4] [5]Deprecated token detection:
validateDeprecatedTokensinvalidateDesignTokens.tsthat scans for usages of deprecated design tokens and reports them with suggested replacements.validateDeprecatedTokensinto the stylelint pipeline inbuild/stylelint.ts, so deprecated token usage is now detected and reported during linting. [1] [2]Reporting improvements:
deprecatedcategory to the design token summary counts and included it in the final summary output. [1] [2] [3]