Skip to main content

no-empty-vitest-project-exclude

Disallow empty project-level test.exclude arrays in workspace/project entries.

Rule catalog ID: R033

Targeted pattern scopeโ€‹

  • vitest.workspace.*
  • inline project entries in test.projects
  • nested project test.exclude values only

What this rule reportsโ€‹

This rule reports empty project-level test.exclude: [] arrays.

Why this rule existsโ€‹

Project-level empty excludes are often leftover placeholders that imply filtering but do nothing. Keeping these entries explicit and non-empty improves project topology clarity.

โŒ Incorrectโ€‹

import { defineWorkspace } from "vitest/config";

export default defineWorkspace([
{
test: {
name: "unit",
exclude: [],
},
},
]);

โœ… Correctโ€‹

import { defineWorkspace } from "vitest/config";

export default defineWorkspace([
{
test: {
name: "unit",
exclude: ["dist/**"],
},
},
]);

Behavior and migration notesโ€‹

  • this rule checks nested project excludes only
  • use no-empty-vitest-exclude for root-level test.exclude

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 generator intentionally emits empty nested exclude arrays as templates.

Package documentationโ€‹

Further readingโ€‹