---
title: "shadcn"
description: "Diagnose design-system classes and styles with the Shadcn Rule Pack."
canonical_url: "https://vite-doctor.onmax.me/shadcn"
---
# shadcn

> Diagnose design-system classes and styles with the Shadcn Rule Pack.

The Shadcn Rule Pack adapts [@shadcn/lint](https://github.com/shadcn-ui/lint) findings into Doctor Diagnostics. Its Rules inspect JSX in JavaScript and TypeScript files. Vue single-file components are skipped.

## Install and run

Install Vite Doctor in the project:

```bash
pnpm add -D vite-doctor
```

Doctor activates the Recommended Preset when Project Inventory contains `tailwindcss`. It includes raw colors, arbitrary values, and inline styles:

```bash
pnpm vite-doctor .
```

The Strict Preset includes all six Rules, adding component restyling, unreadable class values, and unknown classes:

```bash
pnpm vite-doctor . --extends auto,shadcn/strict
```

To diagnose one Rule:

```bash
pnpm vite-doctor . --extends shadcn/strict --rules shadcn/no-inline-styles
```

## Component recognition and options

Component-specific Rules need to recognize the project's design-system imports. Pass upstream Rule options through Doctor's rule configuration. For example, this `doctor.config.ts` recognizes components imported below `@/components/ui/` and allows layout classes on those components:

```ts
import { defineDoctorConfig } from "vite-doctor/config";

export default defineDoctorConfig({
  extends: ["auto", "shadcn/strict"],
  rules: {
    "shadcn/no-restyle": ["warn", { componentImports: ["^@/components/ui/"], allow: ["layout"] }],
    "shadcn/require-static-classes": ["warn", { componentImports: ["^@/components/ui/"] }],
  },
});
```

Load executable configuration explicitly:

```bash
pnpm vite-doctor . --config doctor.config.ts
```

Use the [upstream Rule documentation](https://github.com/shadcn-ui/lint/tree/main/docs/rules) for each Rule's options and recognition limits. The examples demonstrate behavior without a resolvable theme: SVG colors can inherit `currentColor`, and unknown classes are checked against a reduced fallback that includes bundled utilities plus discovered `@utility` names and CSS class selectors. This fallback does not validate theme tokens or provide spelling suggestions. Undeclared color-token checks and theme replacement suggestions require a readable theme. Review suggested edits against the design system before applying them.

---

- [shadcn rules](https://vite-doctor.onmax.me/shadcn/rules)
- [Upstream rule documentation](https://github.com/shadcn-ui/lint/tree/main/docs/rules)


## Sitemap

See the full [sitemap](https://vite-doctor.onmax.me/sitemap.md) for all pages.
