Skip to main content

workspace-unique-project-name

Require statically readable inline Vitest project names to be unique.

Rule catalog ID: R009

Targeted pattern scopeโ€‹

  • vitest.workspace.*
  • vitest.config.*
  • vite.config.* when Vitest uses test.projects
  • inline workspace and project definitions

What this rule reportsโ€‹

This rule reports duplicate statically readable project names inside inline defineWorkspace([...]) and test.projects: [...] entries.

Why this rule existsโ€‹

Duplicate project names make workspace output harder to understand and make it easier to run or debug the wrong project.

โŒ Incorrectโ€‹

import { defineWorkspace } from "vitest/config";

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

โœ… Correctโ€‹

import { defineWorkspace } from "vitest/config";

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

Behavior and migration notesโ€‹

  • this rule only checks names it can read statically, including test.name: "unit" and test.name: { label: "unit", color: "green" }
  • dynamic names are ignored because they are harder to validate safely in linting

ESLint flat config exampleโ€‹

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

export default [vite.configs.vitest];

When not to use itโ€‹

Disable this rule only if your workspace generator produces duplicate names intentionally and another tool resolves that ambiguity.

Package documentationโ€‹

Further readingโ€‹