Design System

Enforcement ​

A rule nobody checks stops being true quietly, in a pull request nobody had time to read closely. Eleven lint rules check what can be checked. They run at error, and they replace a reviewer noticing.

What is enforced ​

RuleRejectsBecause
no-arbitrary-valuep-[5px], w-[137px]A value in a class name is a value that sits on no scale
no-stock-colortext-red-400, bg-gray-500The framework's ramps are not this system's colours, and they do not move with the appearance
no-raw-color#353942, a colour functionA colour written as a literal has no name, no second value, and no contrast figure
no-primitive-tokenvar(--palette-…)The primitive tier holds values and names no job
no-legacy-tokenvar(--c-space-2)The vocabulary this system replaces. Two systems both being live is the state the migration exists to end
no-ramp-stepbg-primary-500A numbered step is a position on a ramp rather than a job
no-preset-scaletext-sm, rounded-mdThe framework's own scale names, which resolve to a role nobody chose
no-unknown-tokenbg-nonexistent-thingA utility whose token is not published generates nothing
no-inline-stylestyle="width: 100%"A declaration on an element is a value the layer above cannot see
no-style-blocka <style> block in a componentA component stylesheet is a second system running beside this one
require-escape-reasonswitching any of the above off without saying whyAn exception nobody wrote down cannot be told from a mistake

Colour contrast is measured rather than linted: 169 pairings in both appearances, as How pairings are checked explains.

A rule with no correct alternative teaches people to switch rules off. Three constructs use the same square brackets as an arbitrary value and are allowed.

ConstructExampleWhy it is allowed
An arbitrary variantdata-[level=INFO]:text-fg-infoIt is a selector, always followed by a colon, and carries no measurement
A track templategrid-cols-[auto_1fr]The framework has no namespace for a track list, so there is no token to move to
A keywordmax-h-[inherit]It names a behaviour, not a measurement

An inline style is allowed when any value in it comes from an expression, such as a virtual list writing a computed row offset. :style="{ width: '100%' }" is all literal, so it is rejected: that one is w-full.

Spec files are exempt from the two colour rules, because a test proving a component drops a class needs a class the system would never use.

Four names with the legacy prefix are not tokens, so the rule allows them. Three are channels holding a setting or a computed value. The fourth is a highlight colour name stored on each request, so renaming it would stop every request already marked with that colour from painting.

The escape hatch ​

Any rule can be switched off, and doing so requires a written reason naming which case in Governance the value is.

vue
<!-- eslint-disable-next-line design/no-arbitrary-value -- case 3: the box reserves
     the width of a caret that inherits 1em, so it tracks the text setting rather
     than the pixel grid. -->
<div class="w-[1em]">

A reason under twelve characters is rejected as well as a missing one. eslint-disable-next-line reaches only the next line, so an attribute further down a multi-line tag needs a disable and enable pair around the element.

The private case carries an expiry. A value private to one component stops being private when a third component needs it, and moves to a shared utility, as the scroll rail hiding did.

What the rules cannot see ​

GapWhat it means
The class rules read templates onlyA class assembled in a script file is invisible to all of them
They match class and :class exactlyAn attribute such as header-class or a pass-through class carries no protection at all
no-arbitrary-value skips anything variant-prefixedA variant-prefixed arbitrary value is not reported
require-escape-reason reads named disablesA bare disable with no rule named is not caught, and switches everything off

The preset is the largest uncovered surface. The rules run on the interface and this site's theme but never on the preset package, which is why the preset writes scale names that first-party markup may not.

Turning rules on where violations already exist ​

The interface carried 721 violations across 229 files the day these rules were written. Failing the build on all of them would only have got the rules switched off.

Instead, a committed suppressions file lists a count per file per rule, and it may only count down. A new violation fails immediately, even in a file that already carries suppressed ones, and removing the last one in a file fails the build until the smaller file is committed. Two violations remain, both a style block in an editor wrapper.