ESLint plugin for Vitest, providing test-specific linting rules. The latest stable version is 1.6.16, released on npm with type definitions included. This plugin helps enforce best practices in Vitest test suites, including rules for consistent naming, focused tests, and proper assertions. It supports both ESLint v8 (flat config and legacy) and v9. Key differentiators include type-testing support, a comprehensive set of rules (e.g., no-focused-tests, valid-expect), and compatibility with Vitest's chaining API. The plugin is actively maintained, with frequent releases addressing bugs and adding features. It requires ESLint >=8.57.0 and Vitest as peer dependencies.
npm install eslint-plugin-vitestVerified import paths — ran on the pinned version, not inferred.
Flat config setup with recommended rules, preventing focused tests, and enabling typecheck support.
Use import vitest from 'eslint-plugin-vitest' and spread vitest.configs.recommended in flat config.
Check your usage: toThrow/toThrowError alias direction was fixed. Update code if needed.
Install and configure @typescript-eslint/parser and plugin to resolve type-aware rules.
Upgrade ESLint to v8.57.0+ or use v9+ for flat config.
Use 'recommended' instead of 'all' to avoid too many warnings.
Run 'npm install --save-dev eslint-plugin-vitest' and ensure node_modules includes it.
Check rule name spelling; verify plugin version supports the rule (v1.0+ includes core rules).
Use: export default [ ...vitest.configs.recommended ] or spread properly.
Add 'vitest' in the flat config's plugins object: { plugins: { vitest } }