Meridian
esc
  • Actions

  • Navigate

navigate selectesc close

Meridian/Kit · Lint rules

Kit · @meridian/eslint-plugin

The rules in this book, as errors.

A review checklist only works if someone reads it. These rules run in the editor and in CI. Components are matched by where they're imported from, not by tag name, so aliases still get caught.
eslint.config.js
import meridian from "@meridian/eslint-plugin";
export default [meridian.configs.recommended];
npx eslint .
app/deploys/page.tsx
   14:9  error  Solid danger only inside a dialog danger-is-outlined
  22:24  error  Raw colour #DC3E42 in color       no-raw-colors
   31:7  error  Status needs a word               status-needs-label
   3:10  error  Import colors from tokens.stylex  stylex-import-vars…
✖ 4 problems (4 errors) · 1 fixable with --fix

Each rule has a docs page with ✓/✗ examples and a link back to the page of this book it enforces. 141 tests.

Rules

The ten rules of @meridian/eslint-plugin
RuleWhat it checks
stylex-import-vars-from-stylex-filesVariables come from .stylex entry points; autofix
no-raw-colorsHex, rgb() and named colours in styles
danger-is-outlineddangerSolid only inside a dialog
one-accent-per-fileCobalt is the single conversion moment
status-needs-labelNo colour-only status or icon-only badge
icon-button-labelIcon buttons need label
one-staged-barOne staged-changes bar per page
no-classname-on-kitUse the style prop
meter-no-bad-toneMeters go amber, never red
prefer-longhandpaddingBlock over "4px 8px"

Setup

eslint.config.js · with overrides
import tsParser from "@typescript-eslint/parser";
import meridian from "@meridian/eslint-plugin";

export default [
  {
    files: ["**/*.{ts,tsx}"],
    languageOptions: { parser: tsParser, parserOptions: { ecmaFeatures: { jsx: true } } },
  },
  meridian.configs.recommended, // or meridian.configs.strict
  {
    // optional overrides
    rules: {
      "@meridian/no-raw-colors": ["error", { allow: ["#111110"], ignoreFiles: ["/legacy/"] }],
    },
  },
];

@meridian/eslint-plugin is flat config only, for ESLint 9 and 10. recommended warns on one-accent-per-file and prefer-longhand and errors on the rest; strict makes all ten errors.

Component rules resolve JSX tags by import binding: import { Button as B } from "@meridian/ui" and <UI.Button> are both checked; a Button from anywhere else is not. When the kit is vendored, list its paths in settings.meridian.componentSources.

Every rule · 10

@meridian/stylex-import-vars-from-stylex-files

Require StyleX variables to be imported straight from the kit's .stylex entry points

Enforces Tokens: StyleX · p. 52
Recommended
error
Autofix
yes(source specifier, when the whole import can move); otherwise a suggestion splits the import
Kit README
Rule 1: import variables from the .stylex entry points

StyleX resolves defineVars / defineConsts at compile time and only recognises them when they're imported directly from a .stylex file. A barrel re-export compiles to a runtime object and breaks the build.

✗ Incorrect
import { colors, space } from "@meridian/ui/tokens";
import { media } from "@meridian/ui";
import { Button, colors } from "@meridian/ui";      // suggestion: split into two imports
✓ Correct
import { colors, space } from "@meridian/ui/tokens.stylex";
import { media } from "@meridian/ui/palette.stylex";
import { theme, type } from "@meridian/ui/tokens";   // styles and themes may use the barrel
eslint.config.js · rules
// No options.
"@meridian/stylex-import-vars-from-stylex-files": "error",

@meridian/no-raw-colors

Disallow hard-coded colors in StyleX styles; use the colors roles

Enforces Color: Light & dark roles · p. 7
Recommended
error
Autofix
no
Kit README
Writing styles · Changing a color

Color roles flip between light and dark automatically; a literal doesn't, and it silently drifts from the palette. Components read roles, never hex values or the palette. Always-dark surfaces use colors.codeBg / colors.codeFg.

✗ Incorrect
const s = stylex.create({
  card: { backgroundColor: "#fff", boxShadow: "0 0 0 1px rgba(0,0,0,.08)" },
  link: { color: { default: "blue", ":hover": "navy" } },
});
✓ Correct
const s = stylex.create({
  card: { backgroundColor: colors.surface, boxShadow: `0 0 0 1px ${colors.border}` },
  link: { color: { default: colors.accent, ":hover": colors.accentHover } },
  icon: { fill: "currentColor", backgroundColor: "transparent" },
});
eslint.config.js · rules
"@meridian/no-raw-colors": ["error", {
  allow: ["#111110"],            // extra literals to accept (case-insensitive). Always allowed: transparent, currentColor,
                                 // inherit, initial, unset, revert, revert-layer, none
  ignoreFiles: ["/legacy/"],     // skip files whose path contains any of these substrings (no globs)
  tokenDirs: ["/tokens/"],       // defineVars/createTheme are not checked in these folders (default ["/tokens/"])
}]

@meridian/danger-is-outlined

Allow variant="dangerSolid" only on the confirm button inside a dialog

Enforces Buttons · p. 15
Recommended
error
Autofix
suggestion(variant="danger")
Kit README
Rules the components enforce

Danger is outlined. A filled red button is the last, deliberate step of a destructive flow, after the dialog has stated the consequence. Anywhere else it shouts.

✗ Incorrect
<Button variant="dangerSolid">Delete</Button>
✓ Correct
<Button variant="danger" icon={trash}>Delete</Button>
<Dialog open title="Delete api-gateway" footer={<Button variant="dangerSolid">Delete api-gateway</Button>} />
eslint.config.js · rules
"@meridian/danger-is-outlined": ["error", {
  dialogs: ["Dialog", "ConfirmDialog"],              // ancestors that allow dangerSolid; extra names match your own wrappers
  components: ["Button", "IconButton", "CopyButton"] // kit components to check
}]

@meridian/one-accent-per-file

Limit Cobalt (variant="accent") actions to the single conversion moment per module

Enforces Color: Accent & semantic · p. 6
Recommended
warn(error in strict)
Autofix
no
Kit README
Rules the components enforce

Primary actions are ink. Cobalt is reserved for the single conversion moment on a page — upgrade, deploy, create. Two accent buttons compete and neither reads as the moment.

✗ Incorrect
<Button variant="accent">Upgrade</Button>
<Button variant="accent">Contact sales</Button>
✓ Correct
<Button variant="accent">Upgrade</Button>
<Button variant="secondary">Contact sales</Button>
eslint.config.js · rules
"@meridian/one-accent-per-file": ["warn", { max: 1 }]

@meridian/status-needs-label

Require a word next to every status: <Status> needs children, icon-only <Badge> needs an aria-label

Enforces Badges, status & keys · p. 18
Recommended
error
Autofix
no
Kit README
Rules the components enforce

Status is an outlined hexagon plus a word, never a colored dot alone. Color must never be the only carrier of meaning: it fails for color-blind users, screen readers and greyscale screenshots.

✗ Incorrect
<Status state="bad" />
<Badge tone="good"><Check aria-hidden /></Badge>
✓ Correct
<Status state="bad">Failed</Status>
<Badge tone="good"><Check aria-hidden /> Healthy</Badge>
<Badge tone="good" aria-label="Verified"><Check aria-hidden /></Badge>
eslint.config.js · rules
// No options.
"@meridian/status-needs-label": "error",

@meridian/one-staged-bar

Allow one <StagedBar> per module

Enforces Staged changes · p. 25
Recommended
error
Autofix
no
Kit README
Rules the components enforce

One StagedBar per page. It floats bottom-center and becomes a full-width footer under 640px, so a second bar stacks on top of the first and the user can't tell which changes each one applies.

✗ Incorrect
<StagedBar added={2} onDiscard={discardDns} onReview={reviewDns} />
<StagedBar changed={1} onDiscard={discardAcl} onReview={reviewAcl} />
✓ Correct
<StagedBar added={2} changed={1} onDiscard={discardAll} onReview={reviewAll} />
eslint.config.js · rules
// No options.
"@meridian/one-staged-bar": "error",

@meridian/icon-button-label

Require a non-empty label on <IconButton> (it becomes the accessible name and tooltip)

Enforces Accessibility · p. 51
Recommended
error
Autofix
yes(renames aria-label to label)
Kit README
Components

An icon-only button has no visible text; label is its only accessible name. Accessibility: real roles and labels, color never the sole carrier of meaning.

✗ Incorrect
<IconButton icon={<RotateCw />} />
<IconButton label="" icon={<RotateCw />} />
<IconButton aria-label="Reconnect" icon={<RotateCw />} />   // autofix → label="Reconnect"
✓ Correct
<IconButton label="Reconnect" icon={<RotateCw size={14} strokeWidth={1.5} aria-hidden />} />
eslint.config.js · rules
// No options.
"@meridian/icon-button-label": "error",

@meridian/no-classname-on-kit

Disallow className on kit components; override with the style prop

Enforces StyleX in use · p. 53
Recommended
error
Autofix
no
Kit README
Writing styles

Every kit component takes a style prop of StyleX styles, applied last so it wins; there's no className. A class would be dropped or fight StyleX's atomic ordering.

✗ Incorrect
<Card className="mt-4" />
✓ Correct
const s = stylex.create({ card: { marginTop: space.s4 } });
<Card style={s.card} />
eslint.config.js · rules
// No options.
"@meridian/no-classname-on-kit": "error",

@meridian/meter-no-bad-tone

Keep meters out of red: no tone prop, no colors.bad* styles on <Meter>

Enforces Cards & metrics · p. 19
Recommended
error
Autofix
no
Kit README
Rules the components enforce

Meters turn amber at 80% and never red: a full disk or quota is a warning, not a failure. Red is reserved for things that have actually failed.

✗ Incorrect
<Meter value={97} tone="bad" />
<Meter value={97} style={s.red} />
const s = stylex.create({ red: { color: colors.bad } });
✓ Correct
<Meter value={97} label="Disk" detail="97%" />
eslint.config.js · rules
// No options.
"@meridian/meter-no-bad-tone": "error",

@meridian/prefer-longhand

Prefer longhand properties over multi-value shorthands in stylex.create

Enforces StyleX in use · p. 53
Recommended
warn(error in strict)
Autofix
suggestion(for plain string values)
Kit README
Writing styles

StyleX merges styles per property. Mixing padding with a later paddingTop override behaves predictably only with longhands, and longhands read better in review. The kit writes paddingInline / paddingBlock and borderTopColor.

✗ Incorrect
const s = stylex.create({ row: { padding: "4px 8px", gap: "8px 12px" } });
✓ Correct
const s = stylex.create({ row: { paddingBlock: "4px", paddingInline: "8px", rowGap: "8px", columnGap: "12px" } });
const t = stylex.create({ card: { padding: space.s6 } });
eslint.config.js · rules
// No options.
"@meridian/prefer-longhand": "warn", // "error" in strict

Meridian Design Language47