{"id":20667,"library":"vite-plugin-eslint2","title":"vite-plugin-eslint2","description":"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.","status":"active","version":"5.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/ModyQyW/vite-plugin-eslint2","tags":["javascript","eslint","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-eslint2","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-eslint2","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-eslint2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to perform linting.","package":"eslint","optional":false},{"reason":"Peer dependency; the plugin is designed to work as a Vite plugin.","package":"vite","optional":false}],"imports":[{"note":"ESM-only. The package does not export a CommonJS version.","wrong":"const eslint = require('vite-plugin-eslint2')","symbol":"default","correct":"import eslint from 'vite-plugin-eslint2'"},{"note":"Options is a type, not a runtime value. Use `import type` in TypeScript.","wrong":"import { Options } from 'vite-plugin-eslint2'","symbol":"pluginOptions (type)","correct":"import type { Options } from 'vite-plugin-eslint2'"},{"note":"The only export is a default function. Named import `{ eslint }` will fail.","wrong":"import { eslint } from 'vite-plugin-eslint2'","symbol":"eslint (function)","correct":"import eslint from 'vite-plugin-eslint2'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport eslint from 'vite-plugin-eslint2';\n\nexport default defineConfig({\n  plugins: [\n    eslint({\n      exclude: ['node_modules', 'dist'],\n      lintOnStart: true,\n      cache: true\n    })\n  ]\n});","lang":"typescript","note":"","description":"Basic setup of vite-plugin-eslint2 in a Vite config with common options."},"warnings":[{"fix":"Remove the `chokidar` option from plugin options.","message":"In 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.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Create an `eslint.config.js` file with flat config, or set `ESLINT_USE_FLAT_CONFIG=false` temporarily.","message":"ESLint 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`.","severity":"breaking","affected_versions":">=4.0.0 (ESLint v9 support)"},{"fix":"Upgrade to ESLint v9 or later.","message":"ESLint v7 and v8 are deprecated. The plugin still supports them but they are not receiving updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure the `eslint` option passed to the plugin is a function that returns a new instance, not an already-created instance.","message":"The plugin uses a worker thread for linting. If you use a custom `eslint` instance that is not serializable, the worker might fail.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use `import eslint from 'vite-plugin-eslint2'` instead.","cause":"Using an outdated import like `import eslint from 'vite-plugin-eslint2/eslint'` (assuming a subpath export).","error":"ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './eslint' is not defined by \"exports\""},{"fix":"Use `import { ESLint } from 'eslint'` and pass it as a factory function in plugin options.","cause":"Trying to use a deprecated internal ESLint API (e.g., `ESLint` class from `use-at-your-own-risk`).","error":"Cannot find module 'eslint/use-at-your-own-risk'"},{"fix":"Use `import eslint from 'vite-plugin-eslint2'` (default import).","cause":"Importing the module as a named export (`import { eslint } from 'vite-plugin-eslint2'`) instead of default.","error":"TypeError: eslint is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}