Repository navigation
chore(lint): ratchet literal fontSize, borderRadius and hex in scf-core features (#819) - #942
Merged
Merged
Conversation
3 tasks
…re features (#819) Closes #819. The tokens landed in #621 and nothing held the line, so the counts went the wrong way through three releases of reskinning. This pins them per directory per pattern and fails anything worse. - scripts/lint/check-literal-ratchet.mjs — the check. Per directory, not one total, so you cannot add literals to office while fixing communities and still pass. Reports the directory's ceiling, the files under it, and marks the ones changed in this branch. - scripts/lint/literal-baseline.json — 40 directories, measured fresh on main. - Wired into pnpm lint, pnpm prepush, pnpm radium:check and the CI lint job. - .radium/scaffald-ui.md — the rule, and the map from each literal value to its token. `--update` lowers ceilings and refuses to raise them. Falling counts do not fail the build, they print the tightening to apply: failing on an improvement would put every unrelated PR in the business of editing the baseline. **The issue's numbers were wrong and the baseline does not use them.** #819 measured `borderRadius: <n>` (337 sites) and missed `borderRadius={<n>}`, the JSX prop form, which is another 355 — more than the style-object form. The real figure is 693, not 360. Hex was counted as `'#abc'` only, missing 124 double-quoted sites. Counting one syntax and not the other would have left the obvious bypass open on day one. fontSize was measured correctly and has since improved on its own: 637, down from 720. Measured ceilings: borderRadius 693, fontSize 637, hexColor 273, on main at 1ca0032. Two things in the issue turned out not to be needed. It proposed pinning `luscher-test` for literal colour; that directory has no hex literals left, so no exception is added. `marketing/theme.ts` is pinned, with the reason recorded in the baseline — it is a deliberate palette the file itself explains is not the product's, carrying WCAG notes against each value. Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
force-pushed
the
chore/819-literal-ratchet
branch
from
October 2, 2026 08:48
10d17fc to
4f5254c
Compare
This was referenced Oct 2, 2026
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.
Closes #819. First item of release 4 (#939).
What lands
scripts/lint/check-literal-ratchet.mjs— ceilings per feature directory, per pattern. Per directory rather than one total on purpose: a single number lets you add literals toofficewhile fixingcommunitiesand still pass.scripts/lint/literal-baseline.json— 40 directories, measured fresh onmainat1ca00321d.pnpm lint:literals,pnpm lint,pnpm prepush,pnpm radium:check, and a CI step in the lint job..radium/scaffald-ui.md— the rule and the map from each literal value to its token.--updatelowers ceilings and refuses to raise them. Falling counts don't fail the build, they print the tightening to apply — failing on an improvement would put every unrelated PR in the business of editing the baseline.The issue's numbers were wrong, and the baseline doesn't use them
#819 measured
borderRadius: <n>and reported 360 sites. It didn't measureborderRadius={<n>}, the JSX prop form — that's another 355, more than the style-object form's 337. The real figure is 693. Hex was counted as'#abc'only, missing 124 double-quoted sites.Counting one syntax and not the other would have left the obvious bypass open on day one, so all three forms are counted and the baseline is measured fresh rather than carried over.
fontSizewas measured correctly, and has improved on its own since: 637, down from the 720 the issue reported.borderRadiusfontSizeTwo of the issue's instructions turned out not to apply
luscher-testbecause "the colour-preference assessment is literal colour by definition". That directory has no hex literals left — it usesrgb()through tokens now. No exception added.marketing/theme.tsis pinned, with the reason in the baseline: a deliberate palette the file itself explains is not the product's, carrying WCAG contrast notes against each value.The first CI run caught slack in my own baseline
Worth recording, because it is the ratchet doing its job on the person who wrote it. The first CI run passed but reported
borderRadius 693, fontSize 637where the committed baseline said 697/643. CI builds the merge commit, and #934 had landed on main after I branched, removing literals fromnotificationsanddrawer.A pass is a pass, so nothing failed — but shipping that baseline would have meant 10 sites of built-in slack on day one, which is the opposite of the point. Rebased onto
1ca00321dand re-seeded:The general lesson for anyone adding to this baseline: seed it against the merge target, not your branch point, or the first tightening someone else does is really just reclaiming your slack.
Verification
Each acceptance criterion exercised rather than reasoned about:
Adding one
fontSize: 13toanalytics/components/KpiCard.tsx— exits 1, names the ceiling and puts the culprit first:Removing one — passes, and offers the tightening;
--updatewrites a one-line diff:--updatewith a rise — refused, exit 1: "it lowers ceilings, it does not raise them."pnpm prepushgreen with the new step. Both probe edits reverted;git statusconfirmed clean.One thing worth knowing separately
CI does not run
pnpm lint— the lint job runspnpm check, which islocales:validate+nx lint+typecheck. Solint:routes,lint:sorted-keys,lint:overridesandlint:migrationsare prepush-only and not enforced in CI at all, which means they don't gate anyone who setsSKIP_PREPUSH=1. That's why this change adds its own explicit CI step rather than relying on the chain. Filed as #941.Also:
scripts/radium-check.shalready exits 1 onmainfor three pre-existing hits (two are doc-comment false positives, one is the@hookform/resolversgrep). Its own header says it's informational, so the real gates here are prepush and CI.🤖 Generated with Claude Code