no-vitest-default-cache-dir-in-monorepo
Disallow default or missing Vitest cache directories in likely monorepos.
Rule catalog ID: R068
Targeted pattern scopeโ
cacheDirtest.cacheDirtest.cache.dir
What this rule reportsโ
This rule reports likely monorepo config when cache dir is missing or set to a default-style path like node_modules/.vitest.
Why this rule existsโ
Shared default cache locations in monorepos can cause cross-package cache collisions and hard-to-reproduce failures.
โ Incorrectโ
export default {
test: {
cacheDir: "node_modules/.vitest",
},
};
โ Correctโ
export default {
test: {
cacheDir: ".cache/vitest/app",
},
};
Behavior and migration notesโ
- Detects likely monorepo contexts via workspace config kind or common monorepo path segments.
- Accepts dynamic non-literal cache-dir expressions as explicit configuration.
ESLint flat config exampleโ
import vite from "@typpi/eslint-plugin-vite";
export default [vite.configs.vitest];
When not to use itโ
Disable if you intentionally standardize on default cache location and accept cross-project sharing.