---
title: "Configuration"
description: "Configure Rules, presets, per-path overrides, files, and suppressions."
canonical_url: "https://vite-doctor.onmax.me/cli/configuration"
---
# Configuration

> Configure Rules, presets, per-path overrides, files, and suppressions.

Doctor needs no config file. It activates Rule Packs from the project's dependencies, so `vite-doctor .` works on its own. Add config only to change Rules, per-path overrides, suppressions, include or exclude globs, or presets.

Doctor reads two config sources without running project code: `doctor.config.json` and the `doctor` key of `vite.config.*`. Define config in only one of them. When Doctor discovers both, it stops with a config error instead of picking one.

```json [doctor.config.json]
{
  "rules": {
    "vite/define/no-secret-define": "error"
  }
}
```

An automatically discovered `doctor.config.json` that only repeats the defaults gets an info-level `DOC0038` Diagnostic, because the run is the same without it. Delete the file unless a script or CI job passes it with `--config`. Doctor doesn't suggest deleting an explicit `--config` file or one that replaces non-default host settings.

## Rules

A Rule entry is `"off"`, a severity (`"blocker"`, `"error"`, `"warn"`, `"info"`), or a `[severity, options]` tuple. A severity also turns on a Rule that no selected preset includes, so `"vue/props/no-unused-props": "warn"` runs that strict-only Rule without the rest of `vue/strict`. With `"extends": []`, a config runs exactly the Rules it names.

The Diagnostics Doctor reports about its own inputs take `"off"` or a severity, in `rules` and in overrides, and no options:

| Rule ID | Code |
| --- | --- |
| `doctor/inventory/unresolved-runtime` | `DOC0022` |
| `doctor/config/unused-suppression` | `DOC0031` |
| `doctor/baseline/stale-fingerprint-scheme` | `DOC0032` |
| `doctor/inventory/empty-sfc` | `DOC0033` |
| `doctor/inline/unused-suppression` | `DOC0036` |
| `doctor/inline/unknown-suppression-rule` | `DOC0037` |
| `doctor/config/default-config-file` | `DOC0038` |
| `doctor/baseline/resolved-entries` | `DOC0039` |
| `doctor/runtime/framework-diagnostic` | `DOC0040` |

So `"doctor/inline/unused-suppression": "error"` fails the run on a stale directive, and `"off"` keeps `--fix` from removing its unused Rule IDs. Any other `doctor/` Rule ID stops the run with `DOC0020`.

Configure `DOC0038` through an inherited source such as a Nuxt manifest: a setting in `doctor.config.json` makes that file non-default, so the Diagnostic no longer applies. `DOC0039` still needs a full run that includes `info` findings, even if you raise its severity, because otherwise Doctor cannot tell a resolved baseline entry from a filtered one.

## Files

By default Doctor analyzes `.vue`, `.ts`, `.tsx`, `.js`, and `.jsx` files and their module variants, plus `content/` Markdown when the project uses Nuxt Content.

It skips `node_modules`, `dist`, `.nuxt`, `.next`, `.output`, `coverage`, `test-results`, `playwright-report`, `public`, and `generated` folders, `*.generated.*` and minified files, `fixtures`, `__snapshots__`, type-test folders (`test-d`, `dts-test`, `type-tests` and similar), `doctor.config.*`, files `.gitignore` excludes, and files whose header says they are generated.

Test code is skipped too: files in `test`, `tests`, `__tests__`, and `test-utils` folders, and `*.test.*` and `*.spec.*` files. Only a Rule that declares [`meta.includeTestFiles`](https://vite-doctor.onmax.me/extending/testing#test-files) checks test code. `scope.files` in the report counts test files only when such a Rule checked them.

`include` replaces the default file globs. `exclude` adds to the skipped paths, so an excluded path is never analyzed, test code included.

## Overrides

`overrides` configures Rules for some paths only, such as library code against playgrounds and docs. Each override has `files`, a list of globs relative to the project root, and optional `rules` and `extends`. Overrides apply in order after the top-level config, so a later match wins:

```json [doctor.config.json]
{
  "extends": ["vite-doctor/typescript/recommended"],
  "overrides": [
    {
      "files": ["packages/*/src/**"],
      "rules": { "typescript/boundaries/no-cross-realm-web-instanceof": "error" }
    },
    {
      "files": ["playground/**", "docs/**"],
      "rules": { "typescript/evidence/no-chained-type-assertions": "off" }
    }
  ]
}
```

In an override, `extends` enables a preset's Rules, including Rules turned off earlier. The same override's `rules` win over its `extends`: `"off"` turns a Rule off, and a severity turns it on or changes it. Earlier Rule options stay unless a new tuple supplies options.

When `"auto"` activates a Rule Pack for only some workspace packages, overrides cannot widen that scope. A top-level `rules` entry that enables a Rule no selected preset includes, an explicit top-level preset, and Rules with workspace-wide activation are not limited this way.

Overrides apply to the file a Diagnostic is located in, including Diagnostics from manifest and workspace Rules. Rule options in override tuples apply only to file Rules. Set options for other Rules in top-level `rules`; an override tuple with options for them fails with `DOC0035`, as does a malformed override. Use `exclude` when a path should not be analyzed at all. The Vite plugin and the Nuxt module take the same `overrides`.

## Presets

By default `extends` is `auto`: the recommended preset of every Rule Pack the project activates. `strict` selects each activated Rule Pack's strict preset instead, and keeps the recommended preset of packs without one. Strict presets add noisier, opinionated, and migration-oriented Rules, but not opt-in policy Rules such as `typescript/strict/no-comments`, which only a `rules` entry turns on.

`--strict` is short for `--extends strict`. In `doctor.config.json`:

```json [doctor.config.json]
{
  "extends": "strict"
}
```

An explicit `extends` list selects exactly the presets it names and replaces the activated defaults. `--extends vite-doctor/typescript/strict` runs only the TypeScript strict preset, without the Vite, Vue, Nitro, or Nuxt presets the project activated. Add `auto` or `strict` to keep them: `--extends auto,vite-doctor/typescript/strict`. `--strict` with `--extends` adds `strict` to the list. The CLI, the Vite plugin, and the Nuxt module treat `extends` the same way.

The JSON and agent reports list each Rule Pack once under `rulePacks`, as `{ name, selected, activatedBy }`. `selected` says whether `extends` selected its presets, and `activatedBy` lists the roots of the workspace packages that activate it (`.` is the root). Selected doesn't mean every Rule ran: `--rules`, `--analyses`, and Rule options can narrow the run. The text report names activated Rule Packs that `extends` left out.

Selectors use `pack/preset`, with the Rule Pack's full name, such as `vendor/vite/recommended`, or its short name when that is unique. When several installed packs share a short name, Doctor reports an ambiguity (`DOC0024`) instead of choosing by registration order; use the full name. Duplicate full names fail at registration with `DOC0023`. An exact full name wins over another pack's short alias.

## Suppressions

Inline `doctor-disable` directives apply only to Diagnostics with a source range. `doctor-disable-next-line <rule> -- <reason>` applies to the next line that contains code, so comments such as `// SAFETY:` notes and blank lines can sit in between.

To suppress a Diagnostic without a source range, add a `suppressions` entry with its `ruleId`, an optional `file`, and a `reason`.

Doctor reports suppressions that no longer match:

- `DOC0031`: a `suppressions` entry that a full run of its Rule matched nothing. Runs with `--changed`, `--since`, `--rules`, or `--analyses` never report it. An entry whose `file` was excluded or failed to parse is reported only when that path no longer exists, and an entry without a `ruleId` only when the run uses `auto` or `strict` and turns no Rule off.
- `DOC0036`: an inline directive whose file Rule ran on that file and reported nothing it covers. Rules without confirmed file coverage, such as workspace and manifest Rules, never make a directive stale. `--changed` and `--since` runs report only directives inside the change.
- `DOC0037`: a directive that names an unknown Rule ID in a loaded Rule Pack's namespace, or a Diagnostic Code instead of a Rule ID.

`vite-doctor . --fix` removes either kind of stale ID when the edit is safe. When removal could change how another directive applies, Doctor offers a suggestion instead.

## `vite.config.*`

The `doctor` key of `vite.config.*` keeps Doctor config next to the rest of a Vite or Vite+ toolchain:

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

export default defineConfig({
  doctor: defineDoctorConfig({
    rules: {
      "vite/define/no-secret-define": "error",
    },
  }),
});
```

Doctor parses `vite.config.*` in the checked directory instead of running it, and doesn't follow imports, so it ignores a `doctor` key that only an imported base config supplies. A discovered `doctor.config.json` still applies, and the CLI uses defaults only when no Doctor config applies. The `doctor()` Vite plugin reads the same key when its own `config` option is not set. See [Run Doctor with Vite+](https://vite-doctor.onmax.me/vite#run-doctor-with-vite) for running Doctor through `vp`.

Doctor accepts an exported object, or a function that directly returns one, optionally wrapped in `defineConfig()` from `vite`, `vite-plus`, or `vitest/config`. A block-bodied function must end in a direct return, with only variable declarations or expression statements before it. Export it with `export default`, a top-level `const` used only as the default export or as the `defineConfig()` argument, or one top-level `module.exports` assignment.

The `doctor` value must be a literal: strings, numbers, booleans, `null`, arrays, and objects, optionally wrapped in `defineDoctorConfig()` from `vite-doctor` or `vite-doctor/config`.

When Doctor cannot tell whether the file exports a `doctor` key or what its value is, it reports a config error with the line number. A non-static export with a `doctor` key at any depth, a `.doctor` read or write, a destructured `{ doctor }`, or `defineDoctorConfig()` is an error. Without those references, exports that use `mergeConfig()`, spreads, conditional returns, or the `doctor()` plugin generally don't block a CLI run. Doctor checks unresolved computed keys only when it resolves the export to one config object, and doesn't follow conditional returns to find them. For a dynamic config, pass `--config doctor.config.json` (use `{}` for defaults) or use the `doctor()` Vite plugin.

## `doctor.config.ts`

Use `doctor.config.ts` only when configuration needs code. Loading it runs project code, so the CLI loads it only with `--config`:

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

export default defineDoctorConfig({
  rules: {
    "vite/define/no-secret-define": "error",
  },
});
```

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

## Plugin Surfaces

When Doctor runs through a host integration, pass the same config to the plugin:

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

export default {
  plugins: [
    doctor({
      config: {
        include: ["src/**", "vite.config.ts"],
        rules: {
          "vite/define/no-secret-define": "error",
        },
      },
    }),
  ],
};
```

The same `doctor()` plugin covers Vite, Vue, and Nitro projects and picks the matching Diagnostics. Set `framework: "nitro"` only when Doctor cannot identify the framework:

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

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

Nuxt projects put the same config under the `doctor` key of `nuxt.config.ts`. See [Nuxt](https://vite-doctor.onmax.me/nuxt).


## Sitemap

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