Registry / testing / vite-plugin-eslint2

vite-plugin-eslint2

JSON →
library5.1.0jsnpmunverified

ESLint plugin for Vite that integrates ESLint linting into the Vite dev server and build process. Current stable version is v5.1.0, released December 2024. Releases are frequent, approximately monthly. Key differentiators: supports a wide range of Vite versions (v2–v8) and ESLint versions (v7–v10), works as a standard Vite plugin, uses worker threads for performance, and includes TypeScript definitions. Unlike alternatives like vite-plugin-eslint (deprecated) or eslint-webpack-plugin, this plugin is specifically designed for Vite's architecture and actively maintained.

npm install vite-plugin-eslint2
INSTALL
IMPORT
SIG · VITE-PLUGIN-ESLINT
V
vite-plugin-eslint2
testingjavascriptv5.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import eslint from 'vite-plugin-eslint2'
const eslint = require('vite-plugin-eslint2')
ESM-only. The package does not export a CommonJS version.
pluginOptions (type)
import type { Options } from 'vite-plugin-eslint2'
import { Options } from 'vite-plugin-eslint2'
Options is a type, not a runtime value. Use `import type` in TypeScript.
eslint (function)
import eslint from 'vite-plugin-eslint2'
import { eslint } from 'vite-plugin-eslint2'
The only export is a default function. Named import `{ eslint }` will fail.

Basic setup of vite-plugin-eslint2 in a Vite config with common options.

// vite.config.ts import { defineConfig } from 'vite'; import eslint from 'vite-plugin-eslint2'; export default defineConfig({ plugins: [ eslint({ exclude: ['node_modules', 'dist'], lintOnStart: true, cache: true }) ] });
Debug
Known issues
breakingIn v5.0.0, the `chokidar` option was removed. If you were relying on it for file watching, you must use Vite's built-in file watching instead.
fix
Remove the `chokidar` option from plugin options.
affects: >=5.0.0
breakingESLint v9+ uses flat config by default. If you upgrade from v8 to v9, your `.eslintrc` config might not work; you need to migrate to `eslint.config.js`.
fix
Create an `eslint.config.js` file with flat config, or set `ESLINT_USE_FLAT_CONFIG=false` temporarily.
affects: >=4.0.0 (ESLint v9 support)
deprecatedESLint v7 and v8 are deprecated. The plugin still supports them but they are not receiving updates.
fix
Upgrade to ESLint v9 or later.
affects: >=0.0.0
gotchaThe plugin uses a worker thread for linting. If you use a custom `eslint` instance that is not serializable, the worker might fail.
fix
Ensure the `eslint` option passed to the plugin is a function that returns a new instance, not an already-created instance.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './eslint' is not defined by "exports"
Using an outdated import like `import eslint from 'vite-plugin-eslint2/eslint'` (assuming a subpath export).
fix
Use `import eslint from 'vite-plugin-eslint2'` instead.
Cannot find module 'eslint/use-at-your-own-risk'
Trying to use a deprecated internal ESLint API (e.g., `ESLint` class from `use-at-your-own-risk`).
fix
Use `import { ESLint } from 'eslint'` and pass it as a factory function in plugin options.
TypeError: eslint is not a function
Importing the module as a named export (`import { eslint } from 'vite-plugin-eslint2'`) instead of default.
fix
Use `import eslint from 'vite-plugin-eslint2'` (default import).
Upgrade
Version history
5.1.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency; required to perform linting.
viterequiredPeer dependency; the plugin is designed to work as a Vite plugin.
Agent activity
14 hits · last 30 days
node
10
Resources
vite-plugin-eslint2 — npm install vite-plugin-eslint2 · libregistry