chore(lint): R10 S2 review — guard against px-frozen font sizes + token convention note
- eslint no-restricted-syntax: a new text-[Npx] font size is now an error (matches strings + template chunks; rem arbitraries like text-[0.75rem] don't match). Keeps the rem system from silently rotting. Mutation-verified it fires on text-[Npx]. - index.css: document the token-vs-arbitrary split (name the two common small steps; rare 8/9/12/13px stay text-[Nrem]; never text-xs for 12px — it carries a line-height).
This commit is contained in:
@@ -48,6 +48,23 @@ export default tseslint.config(
|
||||
"error",
|
||||
{ allowShortCircuit: true, allowTernary: true },
|
||||
],
|
||||
// R10 S2: keep the rem system from rotting. A px-frozen `text-[Npx]` font size does NOT scale
|
||||
// with the Settings --font-scale slider while its rem neighbours do; use `text-2xs`/`text-3xs`
|
||||
// or a `text-[Nrem]` arbitrary instead. Matches both plain strings and template-literal chunks;
|
||||
// rem arbitraries (text-[0.75rem]) don't match (no "px"). Font-size `text-` only — not w-/h-/p-.
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: "Literal[value=/text-\\[\\d+px\\]/]",
|
||||
message:
|
||||
"px-frozen font size doesn't scale with --font-scale: use text-2xs/text-3xs or text-[Nrem], not text-[Npx] (R10 S2).",
|
||||
},
|
||||
{
|
||||
selector: "TemplateElement[value.raw=/text-\\[\\d+px\\]/]",
|
||||
message:
|
||||
"px-frozen font size doesn't scale with --font-scale: use text-2xs/text-3xs or text-[Nrem], not text-[Npx] (R10 S2).",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
prettier,
|
||||
|
||||
Reference in New Issue
Block a user