chore: add lint rules, fix script\configs

This commit is contained in:
2026-10-08 04:51:15 +05:00
parent 76039f7bf3
commit 0e8c2478a1
32 changed files with 753 additions and 272 deletions
+3 -5
View File
@@ -1,9 +1,7 @@
// Color authorship: every color value in app.css must be authored as hct()
// — literals AND derived forms (hct(from var(...) h c t) with channel math) —
// so the whole palette is computed through HCT channels and output as sRGB by
// the postcss-hct plugin. Exceptions: the seed tokens --brand-main/--brand-alt
// (any format allowed) and color-mix(...) (the only sanctioned way to blend
// two tokens).
// (literals and derived forms), so the whole palette is computed through HCT
// and output as sRGB by postcss-hct. Exceptions: the seed tokens
// --brand-main/--brand-alt and color-mix(...) (the only sanctioned blend).
import { isColorValue } from "./helpers.mjs";
+2 -2
View File
@@ -41,14 +41,14 @@ export function collectUsedTokens() {
return used;
}
// A token is "colorful" when its value is a color literal — those must have a
// A token is "colorful" when its value is a color literal; those must have a
// dark-mate. Non-color tokens (fonts, radii, durations) are exempt.
const COLOR_RE =
/#[0-9a-fA-F]{3,8}\b|\b(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklch|oklab|hct|color-mix)\s*\(/i;
export const isColorValue = (value) => COLOR_RE.test(value);
// A token is "derived" when its value references var(...) — it adapts to the
// A token is "derived" when its value references var(...); it adapts to the
// theme automatically, so it must NOT have a hardcoded dark twin.
export const isDerived = (value) => value.includes("var(");
+2 -5
View File
@@ -1,9 +1,6 @@
// Unresolved references: every var(--x) in app.css must point at a token the
// same file defines. A typo here silently drops the declaration, so unlike the
// unused-token dust it is a defect, not a style choice.
//
// `var(--x, fallback)` is legal without --x (CSS custom property fallback), so
// those references are exempt.
// same file defines: a typo silently drops the declaration, so this is a
// defect, not a style choice. `var(--x, fallback)` is legal without --x.
const VAR_REF_RE = /var\(\s*(--[\w-]+)\s*([,)])/g;
+1 -1
View File
@@ -1,5 +1,5 @@
// Unused tokens: defined in app.css but never referenced via var()
// anywhere in src. A dead token is not the single source of truth — it's dust.
// anywhere in src. A dead token is not the single source of truth; it's dust.
// Reported as a warning; it does not fail the run. The `used` set is injectable
// so tests can pass a fixture instead of scanning src.