---
title: "Vue"
description: "Install Doctor in a Vue project and run Vue diagnostics through the Vite plugin or CLI surface."
canonical_url: "https://vite-doctor.onmax.me/vue"
---
# Vue

> Install Doctor in a Vue project and run Vue diagnostics through the Vite plugin or CLI surface.

Use the Vite plugin when the Vue app already builds through Vite. Use the CLI when you want an explicit local or CI command.

## Install

Add Vite Doctor to the project:

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

Register the Vite plugin in `vite.config.ts`:

```ts [vite.config.ts]
import vue from "@vitejs/plugin-vue";
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [vue(), doctor({ framework: "vue" })],
});
```

Run Doctor directly when you want a focused scan:

```bash
pnpm vite-doctor . --rules vue
```

## Configure

Plugin options are the Vue project surface. Put rule policy close to the Vite config that owns the build:

```ts [vite.config.ts]
import vue from "@vitejs/plugin-vue";
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    vue(),
    doctor({
      framework: "vue",
      extends: ["vue/recommended"],
      config: {
        rules: {
          "vue/reactivity/no-ref-as-operand": "error",
        },
      },
    }),
  ],
});
```

## Presets

Doctor activates the Recommended Preset for Vue and Nuxt projects. It only includes Rules whose diagnostics point at a specific defect: lost reactivity, watcher and lifecycle leaks, SSR hydration mismatches, browser APIs on the server, and untrusted HTML.

The Strict Preset adds style, naming, and migration Rules, such as `defineModel()` and `useTemplateRef()` migrations, attribute shorthands, type-only props, the `use` prefix for composables, VueUse `useEventListener()`, reason comments on `data-allow-mismatch`, and vue-i18n checks for untranslated text and unused keys:

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

## Pick the right reference

Vue rules focus on reactivity, template, watcher, lifecycle, SSR, and security mistakes in Vue code. Start in [Vue rules](https://vite-doctor.onmax.me/vue/rules) when a diagnostic begins with `vue/`.

If the same project also has Vite runtime or build diagnostics, use [Vite rules](https://vite-doctor.onmax.me/vite/rules) for `vite/...` diagnostics.

## Fix a diagnostic

Open the rule page from the reported rule ID, compare the before/after example to your component, and re-run the same rule:

```bash
pnpm vite-doctor . --framework vue --rules vue/reactivity/no-ref-as-operand
```

Use `--max-warnings 0` in CI when warnings should block a pull request.

---

- [Vue rules](https://vite-doctor.onmax.me/vue/rules)
- [CLI](https://vite-doctor.onmax.me/cli)


## Sitemap

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