Skip to main content

no-empty-vitest-bench-exclude

Disallow empty test.benchmark.exclude arrays in Vitest config.

Rule catalog ID: R029

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when benchmark options are used
  • test.benchmark.exclude

What this rule reportsโ€‹

This rule reports test.benchmark.exclude: [].

Why this rule existsโ€‹

An empty benchmark exclude list is usually redundant config noise. Removing ineffective settings keeps benchmark topology easier to reason about.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
benchmark: {
exclude: [],
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
benchmark: {
exclude: ["dist/**"],
},
},
});

Behavior and migration notesโ€‹

  • this rule checks static empty arrays only
  • it does not enforce that an exclude list must exist

ESLint flat config exampleโ€‹

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

export default [vite.configs.strict, vite.configs["vitest-bench"]];

When not to use itโ€‹

Disable this rule only if your workflow intentionally keeps empty benchmark excludes as placeholders.

Package documentationโ€‹

Further readingโ€‹