shadcn lint
Aura @shadcn/lint policy (no arbitrary values, no raw colors, no-restyle). Installs Cursor rule + eslint.aura-shadcn.mjs. Add with shadcn as @aura/rule-shadcn-lint or @aura/eslint-shadcn-lint.
Aura + @shadcn/lint
Installation
pnpm dlx shadcn@latest add @aura/rule-shadcn-lint@shadcn/lint is the machine-checkable layer for Aura Tailwind policy. Cursor rules and DESIGN.md guide agents; lint errors tell them how to fix UI.
MUST
- MUST: After UI changes, run the project
lintscript and fix@shadcn/lintfindings before finishing. - MUST: Prefer theme tokens (
accent-*,gray-*, semantic) over raw palette colors (bg-pink-500, hex). - MUST: Prefer the Aura 13px spacing scale over arbitrary values (
p-[16px]). - MUST: Do not restyle design-system components with padding, colors, or typography via
className— use variants/sizes, or layout/width only. - MUST: Form controls (
Input,Textarea,SelectTrigger,MaskInput,SegmentedInput) own their padding. Use layout/width only. If the design needs different padding, add a size/variant on the component — do not override padding at the call site. - MUST: Never put
text-sm/text-xson editable form controls (Aura floor is 17px). - MUST: Never add a horizontal margin to an icon inside
ButtonorBadge— the control owns the icon/label gap, andaura/no-icon-marginreports it (auto-fixable). Space your own icon rows withgap-0.5on the container.
Rules shipped by eslint.aura-shadcn.mjs
| Rule | What it catches |
|---|---|
shadcn/no-arbitrary-values | Values off the 13px scale (p-[16px]). |
shadcn/no-raw-colors | Raw palette colors instead of accent-* / gray-* / semantic tokens. |
shadcn/no-restyle | Restyling design-system components through className. |
aura/no-icon-margin | ml-* / mr-* / mx-* / ms-* / me-* on an icon inside a control that already has a gap. ml-auto / mr-auto stay allowed. |
Setup (if missing)
- Ensure ESLint ≥ 9.30 and Node ≥ 20.19.
- Install:
pnpm add -D @shadcn/lint(in the app that ownseslint.config.*). - Install the Aura snippet:
pnpm dlx shadcn@latest add @aura/eslint-shadcn-lint(writeseslint.aura-shadcn.mjs+ this rule). - Merge the exported config into the app’s
eslint.config.mjs(see snippet file header). - Set
settings.shadcn.uito the project’s UI alias (default@/components/ui). - Keep
no-restyle/no-arbitrary-valuesoff undercomponents/ui/**(components own appearance). - Start rules at
warn; promote toerroras debt clears.
SHOULD
- SHOULD: Point
settings.shadcn.noteatDESIGN.mdand.cursor/rules. - SHOULD: Allow
layout+spacingon Form shells (Form,FormField, …) when pages set gap around fields. - SHOULD: Document intentional exceptions with
eslint-disable-next-line shadcn/… -- reason.
Upstream: shadcn-ui/lint.