stylelint-plugin-rhythmguard
Nobody chose 13px; Rhythmguard reads the spacing scale from your design tokens, reports off-scale spacing in CSS, SCSS and Tailwind class strings with the two nearest steps, and fails CI only on new drift.

Checked against: the spacing tokens of 16 design-token packages, read directly (Bootstrap, Carbon, Primer, PatternFly, GOV.UK Frontend, NHS.UK Frontend, Mozilla Protocol, WordPress, Wikimedia Codex, Radix Themes, Mantine, Polaris, Spectrum, mittwald Flow and Tailwind), and 57 public repositories, design systems and the apps built on them, pinned by commit and measured again whenever the rules or the scale inference change (quiet benchmark).
Start here
npx rhythmguard
No install, no config, and it writes no file. It detects your stack and token files, infers your spacing scale from your own tokens, audits the current directory, and prints the exact config to paste, with the .rhythmguardrc.json that makes a bare npx rhythmguard audit . use the same scale. This is the whole run on Bootstrap's v6-dev branch, unedited:
Then pick the door that describes you.
Your scale lives in a token file
Rhythmguard reads the scale from the file your design system already ships: DTCG JSON (including 2025.10 dimension objects and $root tokens), Style Dictionary JSON, Tokens Studio exports, flat JSON, CSS custom properties, Tailwind v4 @theme, and Sass variables and maps. It also reads the 16 token packages above when they are installed. Spacing written as multiples of a unit with no fixed length (--gap: calc(1rlh - 1rex) with calc(var(--gap) * 2)) is checked as a ladder of multipliers with unitLadder on use-scale and rhythmguard audit --unit-ladder (unit ladders). Figma variables exports are not read. Name the file once in .rhythmguardrc.json; scale: "auto" in the Stylelint rules and npx rhythmguard audit then use the same scale:
{
"audit": {
"scale": "auto",
"tokenSources": ["./tokens/spacing.tokens.json"]
}
}
{
"extends": ["stylelint-plugin-rhythmguard/configs/recommended"],
"rules": {
"rhythmguard/use-scale": [true, { "scale": "auto" }]
}
}
npx rhythmguard scale prints the scale, the file it came from and the token that holds each step. In the audit, prefer-token names that token and its file (Use var(--space-3) (tokens/tokens.json).), and --report-missing-tokens reports a var() of a token that nothing defines. The ESLint rule for class strings reads the same files: scaleSources with scale: "auto", your Tailwind v4 CSS entry as tailwindCss, and the .rhythmguardrc.json token sources and decisions (Your project's scale). More for design-system teams: shared configs and the embed entry point, token sources in the audit, scale presets.
You write CSS or Tailwind in a product repo
Your scale might be a 4px grid, an 8pt grid, Tailwind's ladder or steps your team picked. Add the linter you already run. Most projects need one; a project with both stylesheets and class strings can run both.
Stylesheets: Stylelint
npm install --save-dev stylelint stylelint-plugin-rhythmguard
{
"extends": ["stylelint-plugin-rhythmguard/configs/recommended"]
}
That enables rhythmguard/use-scale on spacing properties with the default scale (0, 4, 8, 12, 16, 24, 32, 40, 48, 64). Tailwind projects use the tailwind config instead, which reads spacing tokens from @theme and falls back to Tailwind's default ladder: