{"id":22720,"library":"vite-plugin-linter","title":"vite-plugin-linter","description":"Vite plugin that integrates ESLint and TypeScript linting into the Vite dev server and build process, displaying linter output in both the terminal and browser console. Version 4.0.0 is the latest stable release. Key differentiators: uses Vite's configureServer hook for real-time console feedback, supports custom linters, and provides separate serve/build options. Requires Vite and ESLint/TypeScript as peer dependencies.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/unimorphic/vite-plugin-linter","tags":["javascript","eslint","typescript","vite-plugin"],"install":[{"cmd":"npm install vite-plugin-linter","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-linter","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-linter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency; plugin uses Vite-specific hook configureServer","package":"vite","optional":false},{"reason":"Required if using EsLinter","package":"eslint","optional":true},{"reason":"Required if using TypeScriptLinter","package":"typescript","optional":true}],"imports":[{"note":"Named export; default import will not work.","wrong":"import linterPlugin from 'vite-plugin-linter'","symbol":"linterPlugin","correct":"import { linterPlugin } from 'vite-plugin-linter'"},{"note":"Export name is 'EsLinter' (not 'ESLinter').","wrong":"import { ESLinter } from 'vite-plugin-linter'","symbol":"EsLinter","correct":"import { EsLinter } from 'vite-plugin-linter'"},{"note":"All exports are from the main package; no subpath exports.","wrong":"import { TypeScriptLinter } from 'vite-plugin-linter/ts'","symbol":"TypeScriptLinter","correct":"import { TypeScriptLinter } from 'vite-plugin-linter'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport { linterPlugin, EsLinter, TypeScriptLinter } from 'vite-plugin-linter';\n\nexport default defineConfig((configEnv) => ({\n  plugins: [\n    linterPlugin({\n      include: ['./src/**/*.ts', './src/**/*.tsx'],\n      linters: [new EsLinter({ configEnv }), new TypeScriptLinter()],\n    }),\n  ],\n}));","lang":"typescript","description":"Sets up ESLint and TypeScript linting with default options for files in src directory."},"warnings":[{"fix":"Use only with Vite; if migrating to Rollup, consider @rollup/plugin-eslint or similar.","message":"Plugin uses Vite-specific hook configureServer and will not work with Rollup.","severity":"gotcha","affected_versions":"*"},{"fix":"Pass configEnv as shown in documentation; it is required for ESLint configuration resolution.","message":"EsLinter requires configEnv from defineConfig callback; not providing it causes runtime errors.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use the CLI only for pre-commit hooks or small projects; adjust include/exclude patterns if needed.","message":"When running via CLI (vite-plugin-linter command), includeMode always defaults to filesInFolder, which may lint all files and cause performance issues.","severity":"gotcha","affected_versions":"*"},{"fix":"Check CHANGELOG for any deprecated options; migrate to new API.","message":"Options deprecated in previous versions may still work but will be removed in future releases.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Explicitly set include patterns to limit scope.","message":"Default include is undefined, which may lint all processed files; unexpected large linting sets can slow down builds.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure EsLinter is constructed within the defineConfig callback and configEnv is passed: new EsLinter({ configEnv })","cause":"EsLinter instantiated without passing the Vite ConfigEnv object.","error":"Error: configEnv is required"},{"fix":"Set include option as an array of patterns: include: ['./src/**/*.ts', './src/**/*.tsx']","cause":"Plugin options include field is not an array or is undefined.","error":"TypeError: Cannot read properties of undefined (reading 'includes')"},{"fix":"Either create tsconfig.json or specify configFilePath: new TypeScriptLinter({ configFilePath: './otherTsconfig.json' })","cause":"TypeScriptLinter default configFilePath is tsconfig.json but it does not exist in project root.","error":"Error: Could not find tsconfig.json"},{"fix":"Ensure there is at least one source file outside node_modules, or explicitly set injectFile option.","cause":"Plugin injects output into the first file not in node_modules; if no such file exists, injection fails.","error":"Warning: Linter output injected into first non-node_modules file"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}