Skip to main content

no-empty-vitest-projects

Disallow empty Vitest project lists.

Rule catalog ID: R024

Targeted pattern scopeโ€‹

  • vitest.workspace.* defineWorkspace([...])
  • test.projects in vitest.config.*
  • test.projects in vite.config.* when Vitest options are present

What this rule reportsโ€‹

This rule reports:

  • defineWorkspace([])
  • test.projects: []

Why this rule existsโ€‹

Empty project lists are usually an accidental misconfiguration that results in no projects/tests being executed. This is a concrete config mistake with strong signal and low false-positive risk.

โŒ Incorrectโ€‹

import { defineWorkspace } from "vitest/config";

export default defineWorkspace([]);

โœ… Correctโ€‹

import { defineWorkspace } from "vitest/config";

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

Behavior and migration notesโ€‹

  • this rule only reports statically empty arrays
  • dynamically computed project arrays are not evaluated

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 workflow intentionally generates project arrays dynamically and you rely on empty arrays as a transient placeholder in committed config.

Package documentationโ€‹

Further readingโ€‹