outtrue
Oxlint rules that keep your design system clean.
pnpm add -D oxlint outtrueExtend one of the three configs. base has three rules to start with, recommended adds the ones that need no setup and all turns on everything.
{
"extends": ["./node_modules/outtrue/configs/recommended.json"]
}Each example below shows the code it flags, the fix and the error it prints.
no-raw-values
Flags hardcoded lengths and colors in classes, attributes and inline styles.
<div className="rounded-xl p-[12px]">
<div className="rounded-xl p-3">
<PlanName />
</div>layout-only-classname
Flags a className that restyles a primitive. It can only place it.
<Button className="mt-4 rounded-full bg-blue-600">Upgrade</Button>
<Button className="mt-4" variant="primary">Upgrade</Button>one-way-imports
Flags an import from a level above.
import { PLANS } from "@/app/pricing/plans";
export default function PlanCard() {
export default function PlanCard({ plans }: PlanCardProps) {no-rebuilt-primitives
Flags a raw <button>, <input> or hand-built overlay where a primitive already exists.
<button type="submit">Save</button>
<Button type="submit">Save</Button>index-in-sync
Flags a component missing from the index or an index line whose file is gone.
- Button: runs an action. `components/button`
- Dialog: asks for a decision. `components/dialog`
- Tooltip: names a control on hover. `components/tooltip`complete-composition
Flags a composable component used without a required part.
<Accordion>
<AccordionItem>
<AccordionTrigger>Can I cancel anytime?</AccordionTrigger>
<AccordionPanel>Yes, from the billing page.</AccordionPanel>
</AccordionItem>
</Accordion>closed-variants
Flags a variant or size prop typed as any string.
interface ButtonProps {
children: React.ReactNode;
variant?: string;
variant?: "primary" | "secondary";
}semantic-tokens-only
Flags a raw palette class such as text-gray-900 outside the design system.
<p className="text-gray-900">Billed yearly</p>
<p className="text-foreground">Billed yearly</p>no-deprecated
Flags a deprecated component, prop or import path.
<Button color="blue">Upgrade</Button>
<Button variant="primary">Upgrade</Button>primitive-naming
Flags a primitive named after a page or a variant, such as pricing-card-pro.
export default function PricingCardPro({ children }: Props) {
export default function Card({ children, tier }: Props) {
return <div className="rounded-xl p-4">{children}</div>;
}prefer-shorthand
Flags w-4 h-4, h-screen, an arbitrary z-[n] and template-literal class strings.
<span className="w-4 h-4 rounded-full" />
<span className="size-4 rounded-full" />icon-button-label
Flags an icon-only button with no aria-label.
<Button>
<Button aria-label="Delete">
<TrashIcon />
</Button>no-cross-surface-imports
Flags one part of the product importing a component from another.
import PlanBadge from "@/components/settings/plan-badge";
import PlanBadge from "@/design-system/components/plan-badge";no-reach-in-selectors
Flags a class that styles the inside of a primitive, such as [&_svg]:size-4.
<Button className="[&_svg]:size-4">Delete</Button>
<Button size="sm">Delete</Button>known-tokens
Flags a color step the theme does not define, such as bg-gray-150.
<div className="h-px bg-gray-150" />
<div className="h-px bg-gray-200" />classname-passthrough
Flags a primitive that accepts className and never applies it.
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>;
}no-important
Flags the ! modifier.
<h2 className="!mt-0">Plans</h2>
<h2 className="mt-0">Plans</h2>no-inline-style
Flags a fixed value in a style object.
<div style={{ padding: 12 }} />
<div className="p-3" />single-export-default
Flags a lone component not written as export default function.
export const Card = ({ children }: CardProps) => (
<div className="rounded-xl p-4">{children}</div>
);
export default function Card({ children }: CardProps) {
return <div className="rounded-xl p-4">{children}</div>;
}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.