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 usestest.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"andtest.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.