Skip to main content

max / balanced_breakfast

lint: match theme-token-coverage on declarations, not token names The rule extracted every token-shaped string from the :root block, comment bodies included, so a comment that merely NAMES a token failed the build even when the token is declared nowhere in the file. It bit during the makeover-webview adoption: --bevel-raised and --bevel-inset moved out to the generated sheet, and the comment recording where they went had to be reworded into something vaguer to get past the lint. Now strips comments and matches declaration syntax (a token followed by a colon). An undeclared-but-mentioned token passes; a real token with no /* themed | composition | invariant */ annotation still fails. Closes GoingsOn problem 63a8ed2c.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-01 20:23 UTC
Signed with PGP, not checked
Commit: e7c750cf110830b72de5951df0538bd18fd3fbea
Parent: 79fb74b
1 file changed, +8 insertions, -0 deletions
@@ -81,7 +81,15 @@
81 81 # themes.js applies the intent layer generically (setProperty on each
82 82 # theme.intents key), so there is no per-token map to grep; the annotation
83 83 # is the contract. Catches a new token added without deciding what drives it.
84 + # Scanning is restricted to declaration syntax (a token followed by a colon)
85 + # with comment bodies stripped first. Matching the bare token name meant a
86 + # comment that merely NAMES a token failed the build even when the token is
87 + # declared nowhere in the file. That bites exactly as the design system
88 + # succeeds: every token that moves out to a generated sheet leaves behind a
89 + # comment saying where it went, and each of those was a build failure.
84 90 root_tokens=$(awk '/^:root \{/{flag=1; next} /^\}/{flag=0} flag' "$SRC_CSS" \
91 + | sed 's|/\*[^*]*\*/||g' \
92 + | grep -oE -- '--[a-z0-9-]+[[:space:]]*:' \
85 93 | grep -oE -- '--[a-z0-9-]+' | sort -u || true)
86 94 unmapped=""
87 95 for tok in $root_tokens; do