Skip to main content

no-vitest-watch-in-config

Disallow committed test.watch: true in Vitest config.

Rule catalog ID: R036

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest test.watch is configured

What this rule reportsโ€‹

This rule reports explicit test.watch: true assignments.

Why this rule existsโ€‹

Watch mode is typically a local-development behavior. Committing it into shared config can create CI/developer-environment drift and surprising execution behavior.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
watch: true,
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
watch: false,
},
});

Behavior and migration notesโ€‹

  • this rule reports only explicit true
  • local watch workflows should prefer CLI flags or local-only overrides

ESLint flat config exampleโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.strict, vite.configs.vitest];

When not to use itโ€‹

Disable this rule only if your team intentionally commits watch mode in shared config and accepts environment-specific behavior.

Package documentationโ€‹

Further readingโ€‹