systomic

No hardcoded values

Lengths and colors come from the scale and the tokens. One-off values drift: 13px here, 11px there, a gray that is almost the border color.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • WarningShows in the editor and in CI output, but doesn't fail the run (unless you pass --deny-warnings).
  • Autofixoxlint --fix fixes it for you.

See the difference

Before
AKAda Kimada@studio.dev
Edit profile
className="p-[13px] gap-[11px] bg-[#f4f4f6]"
After
AKAda Kimada@studio.dev
Edit profile
className="p-3 gap-3 bg-muted"

What doesn't work

6 findings

What works

No findings

Details

Lengths and colors come from the design system’s scales and tokens, not from one-off values. oxlint --fix rewrites a length that is on the scale.

p-[12px] hardcodes a length. 12px is p-3 on the spacing scale.

Reported:

  • Tailwind arbitrary values with px / rem lengths or colors: p-[12px], text-[13px], rounded-[10px], w-[calc(100%-12px)], [height:52px], bg-[#fafafa], text-[rgb(0_0_0/50%)], shadow-[0_1px_2px_rgba(…)].
  • Inline styles and StyleX (stylex.create, including conditional values and pseudo blocks): non-zero numbers and px / rem strings in length properties (padding: 12, marginTop: "8px", fontSize: "0.875rem"), and colors (color: "red", backgroundColor: "#fff", boxShadow: "0 1px 2px #0003").
  • Color attributes: fill="#ff0000", stroke, color, stopColor, ….

Autofix (classes only), when the value is on the scale:

Found Fixed to Scale
p-[12px], gap-[0.5rem], mt-[-4px], h-[1px] p-3, gap-2, -mt-1, h-px spacing (spacing px per step, whole and half steps)
ring-[3px], border-[1px], border-t-[2px] ring-3, border, border-t-2 widths
rounded-[8px] rounded-lg radius (Tailwind’s, plus radii)
text-[14px] text-sm font size (Tailwind’s, plus fontSizes)

Names from radii and fontSizes win over Tailwind’s names for the same value: with "radii": { "control": 4 }, rounded-[4px] is fixed to rounded-control, not rounded-sm. Give each value one name: when several of your names share a value, JavaScript’s key order decides (number-like names such as "1" come first). To use only your own scales, set "extendTailwind": false. A DEFAULT radius is the bare rounded:

Not reported:

  • Tokens: var(…), theme(…), p-(--gutter), calc(100% - var(--sidebar)), stylex.defineVars / token references.
  • Relative and unitless values: %, em, viewport units, 0, z-[60], leading-[1.2], lineHeight: 1.5, durations.
  • Keywords: currentColor, transparent, inherit, none.
  • Plain objects that aren’t styles (const config = { padding: 12 }).

The design system itself has to define raw values somewhere. Exclude it with ignore:

ignore globs are relative to the nearest package.json, so in a monorepo src/design-system/** matches in every package. To exclude a folder in one package only, set the option in an Oxlint overrides entry for that package (see Configuration).

Option Default
spacing 4 (px per spacing step)
radii {}, merged over Tailwind’s radius scale; its names win for the same value
fontSizes {}, merged over Tailwind’s font sizes; its names win for the same value
extendTailwind true; false drops Tailwind’s radius and font size scales and uses only radii and fontSizes
lengths / colors true
allow []: classes or values, * wildcards
ignore []: file globs relative to the nearest package.json; see monorepos
attributes, callees, styleAttributes see styling

Inspired by no-raw-values from Outtrue by Jakub Krehel.

Esc