Outtrue

A set of lint rules that keep your design system clean and agent-ready.

pnpm add -D oxlint outtrue
or copyprompt.

Outtrue has three different configs. base enables three rules to start with: no-raw-values, layout-only-classname and one-way-imports. recommended adds twelve more and all turns on all 23.

.oxlintrc.json
{
  "extends": ["./node_modules/outtrue/configs/recommended.json"]
}

no-raw-values

Flags hardcoded lengths and colors in classes, attributes and inline styles. oxlint --fix automatically rewrites a length that is on the spacing scale and a width such as ring-[3px].

plan-card.tsx
<div className="rounded-xl p-[12px]">
<div className="rounded-xl p-3">
  <PlanName />
</div>
p-[12px] hardcodes a length. 12px is p-3 on the spacing scale.

layout-only-classname

Flags a className that restyles a primitive. A className can only place the primitive or arrange its children.

pricing.tsx
<Button className="mt-4 rounded-full bg-blue-600">Upgrade</Button>
<Button className="mt-4" variant="primary">Upgrade</Button>
className on <Button> can only place it or arrange its children: margin, size, position and flex or grid layout. rounded-full, bg-blue-600 restyle the component. Use a prop, or add a variant in @/design-system/components/button.

Let a class through with allow, or on one component with allowFor.

.oxlintrc.json
{
  "rules": {
    "design-system/layout-only-classname": [
      "error",
      {
        "allow": ["^hover:bg-muted$"],
        "allowFor": {
          "Card": ["^p[xy]?-"],
          "Dialog.Content": ["^p[xy]?-"]
        }
      }
    ]
  }
}

one-way-imports

Flags an import from a level above.

components/plan-card.tsx
import { PLANS } from "@/app/pricing/plans";
export default function PlanCard() {
export default function PlanCard({ plans }: PlanCardProps) {
src/components sits below src/app and can't import from it. Pass what this needs through props, or move the file up to src/app.

Use layers to list your folders, lowest first.

.oxlintrc.json
{
  "rules": {
    "design-system/one-way-imports": [
      "error",
      { "layers": ["src/components/ui", "src/components", "src/app"] }
    ]
  }
}

no-rebuilt-primitives

Flags a raw <button>, <input> or overlay where a primitive exists.

settings.tsx
<button type="submit">Save</button>
<Button type="submit">Save</Button>
<button> rebuilds a primitive the design system already has. Use Button.

no-duplicate-primitives

Flags a component file named like a primitive, such as billing/button.tsx.

components/billing/button.tsx
export default function Button({ plan }: Props) {
export default function UpgradeButton({ plan }: Props) {
  const checkout = useCheckout(plan);
  return <Button onClick={checkout}>Upgrade to {plan}</Button>;
}
src/components/billing/button.tsx has the same name as the primitive in src/design-system/components/button.tsx. Use the primitive, or name this file for what it adds.

Rename the file as well. This one becomes billing/upgrade-button.tsx.

wrapped-libraries

Flags an import of a library the design system wraps, such as Base UI.

settings.tsx
import { Dialog } from "@base-ui/react/dialog";
import { Dialog } from "@/design-system/components/dialog";
@base-ui/react/dialog is a library the design system wraps. Import the primitive from src/design-system, or add one there.

index-in-sync

Flags a component missing from the index or an index line with no file.

design-system/INDEX.md
- Button: triggers an action. `components/button`
- Dialog: shows content over the page. `components/dialog`
- Tooltip: names a control on hover. `components/tooltip`
tooltip has no line in src/design-system/INDEX.md. Add a line that names it and says what it is for.

complete-composition

Flags a composable component used without a required part.

faq.tsx
<Accordion>
  <AccordionItem>
    <AccordionTrigger>Can I cancel anytime?</AccordionTrigger>
    <AccordionPanel>Yes, from the billing page.</AccordionPanel>
  </AccordionItem>
</Accordion>
<Accordion> is missing AccordionPanel. Use every required part, as in the component's full example.

List the parts each component needs in parts, or nothing is checked.

.oxlintrc.json
{
  "rules": {
    "design-system/complete-composition": [
      "error",
      {
        "parts": {
          "Accordion": ["AccordionItem", "AccordionTrigger", "AccordionPanel"],
          "Dialog": [["DialogContent", "DialogPopup"]]
        }
      }
    ]
  }
}

closed-variants

Flags a variant or size prop typed as any string.

button.tsx
interface ButtonProps {
  children: React.ReactNode;
  variant?: string;
  variant?: "primary" | "secondary";
}
variant accepts any string or number, so nothing says which values exist. List the allowed values as a union, such as 'primary' | 'secondary'.

semantic-tokens-only

Flags a raw palette class such as text-gray-900 outside the design system.

pricing.tsx
<p className="text-gray-900">Billed yearly</p>
<p className="text-foreground">Billed yearly</p>
text-gray-900 uses a raw token, which says nothing about when to use it. Use the semantic variable for this role, or add one.

Map a raw class to the variable that replaces it in suggest and oxlint --fix will rewrite it for you automatically.

.oxlintrc.json
{
  "rules": {
    "design-system/semantic-tokens-only": [
      "error",
      { "suggest": { "text-gray-900": "text-foreground" } }
    ]
  }
}

no-deprecated

Flags a deprecated component, prop or import path.

pricing.tsx
<Button color="blue">Upgrade</Button>
<Button variant="primary">Upgrade</Button>
color on <Button> is deprecated. Use variant.

Map each old name to the new one in components, props or imports. oxlint --fix automatically rewrites an import path.

.oxlintrc.json
{
  "rules": {
    "design-system/no-deprecated": [
      "error",
      {
        "components": { "Modal": "Dialog" },
        "props": { "Button.color": "variant" }
      }
    ]
  }
}

primitive-naming

Flags a primitive named after a page or a variant, such as pricing-card-pro.

pricing-card-pro.tsx
export default function PricingCardPro({ children }: Props) {
export default function Card({ children, variant }: Props) {
  return <div className="rounded-xl p-4">{children}</div>;
}
pricing-card-pro is named after a page or a variant: pricing, pro. Name the primitive for what it is, card, and move the variant into a prop.

Rename the file as well. This one becomes card.tsx.

no-boolean-variants

Flags a boolean prop such as isPrimary where a variant value belongs.

button.tsx
interface ButtonProps {
  children: React.ReactNode;
  isPrimary?: boolean;
  variant?: "primary" | "secondary";
}
isPrimary is a boolean for one look, so two of them can be on at once. Make it a value of a variant or size prop.

no-theme-overrides

Flags a color set for one theme at the call site, such as dark:bg-gray-900.

plan-card.tsx
<div className="bg-white dark:bg-gray-900">
<div className="bg-background">
  <PlanName />
</div>
dark:bg-gray-900 sets a color for the dark theme at the call site. Use a token that changes with the theme, or add one.

prefer-shorthand

Flags w-4 h-4, h-screen and an arbitrary z-[n]. oxlint --fix automatically rewrites w-4 h-4 to size-4.

avatar.tsx
<span className="w-4 h-4 rounded-full" />
<span className="size-4 rounded-full" />
w-4 h-4 is a square. Use size-4.

no-template-classname

Flags a className built with a template literal.

tabs.tsx
<li className={`px-3 ${active ? "text-foreground" : "text-muted"}`}>
<li className={cn("px-3", active ? "text-foreground" : "text-muted")}>
  {label}
</li>
className is built with a template literal. Compose classes with cn().

icon-button-label

Flags an icon-only button with no label or an empty one. An aria-label or a title counts.

row-actions.tsx
<Button>
<Button aria-label="Delete">
  <TrashIcon />
</Button>
<Button> holds only an icon, so a screen reader has nothing to announce. Add an aria-label that names the action.

no-cross-surface-imports

Flags one part of the product importing a component from another.

billing/invoice.tsx
import EmptyState from "@/components/settings/empty-state";
import EmptyState from "@/design-system/components/empty-state";
billing imports from settings. A component two parts of the product use belongs to the design system. Move it to src/design-system/components, or pass it in through props.

Each folder in src/components counts as one part. Put a folder in shared if every part can import it or in composers if it can import every part.

.oxlintrc.json
{
  "rules": {
    "design-system/no-cross-surface-imports": [
      "error",
      { "shared": ["layout"], "composers": ["shell"] }
    ]
  }
}

no-reach-in-selectors

Flags a class that styles the inside of a primitive, such as [&_svg]:size-4.

row-actions.tsx
<Button className="[&_svg]:size-4">Delete</Button>
<Button iconSize="sm">Delete</Button>
[&_svg]:size-4 on <Button> styles the inside of the component from outside. Add a prop or a variant in @/design-system/components/button.

known-tokens

Flags a color step the theme does not define, such as bg-gray-150.

divider.tsx
<div className="h-px bg-gray-150" />
<div className="h-px bg-gray-200" />
bg-gray-150 names a step the theme does not define, so it renders nothing. gray has 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950.

classname-passthrough

Flags a primitive that accepts className and never applies it.

badge.tsx
export default function Badge({ children, className }: BadgeProps) {
  return <span className="rounded-md px-2">{children}</span>;
  return <span className={cn("rounded-md px-2", className)}>{children}</span>;
}
className is taken from the props and never reaches an element, so placing this component from outside does nothing. Merge it into the root element's classes.

no-important

Flags the ! modifier.

pricing.tsx
<h2 className="mt-0!">Plans</h2>
<h2 className="mt-0">Plans</h2>
mt-0! forces a style with !important. Change the class it is fighting, or add a variant to the component.

no-inline-style

Flags a fixed value in a style object.

plan-card.tsx
<div style={{ padding: 12 }} />
<div className="p-3" />
style sets padding to a fixed value. Use a class or a token, and keep style for values computed at runtime.

More

If you enjoy these rules and want to learn more, take a look at Interfaces, my design engineering magazine.

It’s where I share everything I know about building great interfaces. From animation and typography to performance and accessibility.

InterfacesThe Design Engineering Magazine
Try Interfaces (opens in a new tab)