require-vitest-typecheck-tsconfig
Require explicit test.typecheck.tsconfig when Vitest typecheck execution is enabled.
Rule catalog ID: R019
Targeted pattern scopeโ
vitest.config.*vitest.workspace.*vite.config.*when a Vitesttestblock is used- root and inline project
test.typecheckoption objects
What this rule reportsโ
This rule reports test.typecheck blocks when:
enabled: trueoronly: trueis set- and
tsconfigis missing, empty, or not a static string path
Why this rule existsโ
When Vitest typecheck is enabled, relying on implicit nearest-tsconfig discovery can be fragile in monorepos or multi-project setups.
An explicit test.typecheck.tsconfig path keeps typecheck scope and project resolution deterministic.
This is a Vitest config-authoring best-practice check that generic ESLint plugins do not typically cover.
โ Incorrectโ
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
typecheck: {
enabled: true,
},
},
});
โ Correctโ
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
typecheck: {
enabled: true,
tsconfig: "./tsconfig.vitest-typecheck.json",
},
},
});
Behavior and migration notesโ
- this rule does not require configuring
test.typecheckat all - it only applies once typecheck execution is explicitly enabled (
enabled: trueoronly: true) - provide a static, non-empty
tsconfigstring so review tooling can reason about the configured path
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 project intentionally relies on Vitest's implicit tsconfig discovery for enabled typecheck runs and accepts that this may be less deterministic across package/workspace boundaries.