---
title: "Classes and styles"
description: "How the design-system class and style Rules read templates, style blocks, stylesheets, and Nuxt UI tokens."
canonical_url: "https://vite-doctor.onmax.me/design-system/classes"
---
# Classes and styles

> How the design-system class and style Rules read templates, style blocks, stylesheets, and Nuxt UI tokens.

The class and style Rules, DS0001 to DS0006, run [@shadcn/lint](https://github.com/shadcn-ui/lint) as their engine. They inspect JSX in JavaScript and TypeScript files and the templates of Vue single-file components: `class`, `:class` arrays and objects, `style`, `:style`, and classes that `:class` reads from `<script setup>`. Each finding points at its position in the `.vue` file.

They keep @shadcn/lint's ESLint names, so `// eslint-disable-next-line shadcn/no-inline-styles` still silences a finding. If you are migrating from the Shadcn Rule Pack, regenerate your baseline after updating the Rule IDs, because existing fingerprints don't match the renamed Rules.

The pack skips:

- OG image templates, which render to an image through Satori or Takumi and only read inline styles: `components/OgImage/` when the Project Inventory shows Nuxt OG Image or `@nuxtjs/seo`, and `app/opengraph-image` and `app/twitter-image` routes when it shows Next.js;
- colors inside an SVG `<mask>`, or in a gradient whose references only set mask luminance, not visible paint.

## Arbitrary values

`no-arbitrary-values` (DS0003) allows `content-[...]` such as `after:content-['']`, custom grid track lists such as `grid-cols-[14rem_minmax(0,1fr)]`, and custom transition properties such as `transition-[margin]` or `transition-[width,color]`. Values with named equivalents still report, and an explicit `allow`, `deny`, or `contracts` policy takes precedence.

DS0003 can name a candidate such as `top-1/2` for `top-[50%]`, or `w-17.5` for `w-[70px]` on the default Tailwind v4 scale. Check it before you apply it: a named utility can use different units, set other properties, or interact differently with other classes. Tailwind v4's `scale-105` sets axis variables that `scale-[1.05]` does not.

On Tailwind v3, Doctor names only steps the declared version has, and assumes a 16px root font size when it compares `rem` spacing steps to pixels. When the Tailwind version is unknown, or `tailwind.config.*` or `nuxt.config.*` appears to override the relevant defaults, Doctor reports the arbitrary value without naming a step. It never runs those configs.

## Inline styles

In a Nuxt UI project, `no-inline-styles` (DS0004) skips a `:style` that binds the style a Nuxt UI composable returns, such as the scroll mask from `useScrollShadow`, because Nuxt UI computes it and the project has no class to replace it with.

For Nuxt auto-imports, including explicit imports from `#imports`, the exemption needs a current Nuxt Doctor manifest whose runtime import registry resolves the composable to Nuxt UI. Without that evidence, or when the style comes from a template-local binding, the exemption doesn't apply. Explicit imports from Nuxt UI don't need the manifest.

## Raw colors

For template colors, `no-raw-colors` (DS0002) still reports a raw palette class whose class string sets the same color utility with and without `dark:`, as in `text-gray-500 dark:text-primary`, but the finding says the color changes for dark mode only through that pair. A color class under `dark:` alone, such as `dark:border-zinc-700` next to a `border` width, is reported as applying only in dark mode.

Doctor suggests `currentColor` only when the SVG paint it can read is monochrome. When the SVG paints more than one color or its paint is uncertain, the fix asks for a matching theme variable for that attribute and lists the other paint attributes set to the same color.

### Vue `<style>` blocks

DS0002 also reads the `<style>` blocks of Vue components, which @shadcn/lint does not. It reports hex colors and color functions with literal arguments, such as `rgb(0 0 0 / 50%)` or `oklch(0.7 0.1 200)`, in plain declarations:

```vue
<style scoped>
.card {
  color: #21201c; /* DS0002 */
  border-color: var(--color-border);
}
</style>
```

It leaves alone what defines or references the theme:

- custom property definitions such as `--accent: #ff0000`, and `@theme` and `@property` blocks;
- rules scoped to one color scheme: `@media (prefers-color-scheme: dark)`, `@variant dark`, and simple selectors such as `.dark &` or `[data-theme="dark"]`. A theme-like name, selector list, or media alternative doesn't count;
- `light-dark()`, and `mask` and `mask-image` gradients, since a mask reads only alpha;
- fully transparent colors such as `rgba(251, 191, 36, 0)`;
- `var()` with its fallbacks, `v-bind()`, `currentColor`, color functions over a variable such as `rgb(var(--ring) / 0.5)`, relative colors such as `rgb(from #000 r g b / 50%)`, and `color-mix()` with a variable or `currentColor` argument;
- Sass and Less interpolation, strings, URLs, comments, and named colors such as `red`.

It reads CSS, PostCSS, SCSS, and Less blocks. It skips Sass indented syntax, Stylus, `<style src>`, and components under a `components/ui/` directory, where the design system defines its own styles. When a block or the component's script cannot be parsed, the report carries an evidence gap for that file instead of a partial result.

The fix asks for a theme variable with the same color at the use site. A source declaration alone doesn't prove that the build emits that variable, that the app loads it, or that the cascade gives it the same value. For a translucent color, the fix keeps the opacity, such as `color-mix(in srgb, var(--color-<name>) 45%, transparent)` for `rgba(251, 191, 36, 0.45)`, and points at other colors of the same rule with the same value, so they stay matched.

## Unknown classes

`no-unknown-classes` (DS0006) checks Tailwind utilities and exact class names in global stylesheets Doctor can trace from source imports or Nuxt's `css` config, including class tests inside `:not()` and resolvable imports from installed CSS packages. Unreferenced stylesheets and CSS Module locals are not evidence for literal class names. A literal DOM selector such as `document.querySelectorAll('.view-transition')`, or a class selector documented in Markdown, also tells Doctor the class is deliberate. When Doctor cannot resolve a name, check whether you meant a utility or a hook for code or CSS that loads at runtime.

When a Nuxt app extends a package layer, directly or through another layer (including an auto-registered `layers/*` layer), Doctor reads that layer's statically registered CSS and follows local stylesheet imports. It recognizes class selectors, `@utility` names, `@theme` color tokens, and `@theme` text sizes. A class those stylesheets declare is not reported as undeclared, but `bg-dimmed` still is when a layer declares `dimmed` only for text. When a package layer is missing, or Doctor cannot read its registration, CSS, or `extends` statically, it reports the classes it could not verify with low confidence and asks you to check the unread layers before you change a class.

## Nuxt UI tokens

Nuxt UI generates its color tokens into a stylesheet at build time, where @shadcn/lint cannot read them. When the Project Inventory shows `@nuxt/ui` in the workspace package or its Nuxt modules, Doctor accepts Nuxt UI's tokens:

- the theme colors `primary`, `secondary`, `success`, `info`, `warning`, `error`, and `neutral`, with their `50` to `950` shades. A `ui.theme.colors` list in `nuxt.config` or `vite.config` replaces the defaults, and `primary` and `neutral` always stay;
- the semantic classes, such as `text-muted`, `bg-elevated`, `bg-default`, and `border-accented`.

Raw palette classes such as `text-red-500`, arbitrary colors, and unknown tokens such as `text-elevated` are still reported. The tokens count only for `no-raw-colors` and `no-unknown-classes`: restyling a component with `bg-primary` is still a `DS0001` finding. The fix for a `<style>` color names Nuxt UI's `--ui-*` variables.

## Component recognition and options

The @shadcn/lint component Rules need to recognize the project's design-system imports. Pass upstream Rule options through Doctor's Rule config. This `doctor.config.ts` recognizes components imported below `@/components/ui/` and allows layout classes on them:

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

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

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

When no contract matches a component and no Rule-wide `allow` or `deny` is set, `no-restyle` allows no layout classes on it, and its findings name that default instead of a Component Contract. For width, height, and padding classes, including logical sizing and padding utilities, the fix points to the component's sizes instead of moving those classes to a parent.

See the [upstream Rule documentation](https://github.com/shadcn-ui/lint/tree/main/docs/rules) for each Rule's options and recognition limits. Its examples show behavior without a resolvable theme: SVG colors can inherit `currentColor`, and unknown classes are checked against a reduced fallback of bundled utilities plus discovered `@utility` names and CSS class selectors. That fallback doesn't validate theme tokens or suggest spellings. Undeclared color-token checks and theme replacement suggestions need a readable theme. Review suggested edits against the design system before you apply them.


## Sitemap

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