Skip to main content

no-disabled-vitest-typecheck

Disallow Vitest test.typecheck options that disable or hide static typecheck failures.

Rule catalog ID: R016

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when a Vitest test block is used
  • root test.typecheck options
  • inline project test.typecheck options inside defineWorkspace([...])
  • inline project test.typecheck options inside test.projects: [...]

What this rule reportsโ€‹

This rule reports unsafe test.typecheck settings:

  • test.typecheck.enabled: false
  • test.typecheck.ignoreSourceErrors: true

Why this rule existsโ€‹

Vitest exposes typecheck as an optional test-time static safety pass. Disabling it explicitly, or ignoring non-test source errors, can hide regressions that only appear in CI or production builds.

This plugin targets configuration correctness for Vite/Vitest projects, so enforcing safer typecheck defaults at config-authoring time fits its scope better than generic JavaScript style rules.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
typecheck: {
enabled: false,
ignoreSourceErrors: true,
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
typecheck: {
enabled: true,
ignoreSourceErrors: false,
tsconfig: "./tsconfig.vitest-typecheck.json",
},
},
});

Behavior and migration notesโ€‹

  • this rule does not require enabling typecheck when test.typecheck is absent
  • it only reports explicit unsafe toggles that disable or suppress errors
  • if a repository must temporarily suppress source errors during migrations, scope-disable this rule with a comment and track removal explicitly

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 relies on typecheck.enabled: false or typecheck.ignoreSourceErrors: true for temporary migration workflows and accepts the reduced static safety signal.

Package documentationโ€‹

Further readingโ€‹