vitest/consistent-vitest-vi
March 1, 2026 ยท View on GitHub
๐ Enforce using vitest or vi but not both.
โ ๏ธ This rule warns in the ๐ all config.
๐ง This rule is automatically fixable by the --fix CLI option.
Rule Details
Examples of incorrect code for this rule:
vitest.mock('./src/calculator.ts', { spy: true })
vi.stubEnv('NODE_ENV', 'production')
Examples of correct code for this rule:
vi.mock('./src/calculator.ts', { spy: true })
vi.stubEnv('NODE_ENV', 'production')
vitest.mock('./src/calculator.ts', { spy: true })
vitest.stubEnv('NODE_ENV', 'production')
Options
| Name | Description | Type | Choices |
|---|---|---|---|
fn | Preferred utility keyword to enforce. | String | vi, vitest |
{
"type": "object",
"properties": {
"fn": {
"enum": ["vi", "vitest"]
}
},
"additionalProperties": false
}
fn
Decides whether to prefer vitest or vi.
The default configuration is top level vi.