vite-plugin-eslint-report

raw JSON →
1.0.1 verified Mon Apr 27 auth: no javascript

A Vite plugin that runs ESLint checks during build and dev, integrating ESLint reports into the Vite dev server overlay and terminal output. Current stable version is 1.0.1. Release cadence is irregular; the plugin is part of the Alibaba ice framework monorepo but published separately. Key differentiators: lightweight integration with Vite's HMR and build pipeline, supports ESLint caching, custom formatters, and file filtering via include/exclude patterns. Requires ESLint >7.0.0 as a peer dependency. Compared to alternatives like vite-plugin-eslint, it offers a report overlay for dev mode and is maintained under the ice monorepo.

error Error: Cannot find module 'eslint'
cause ESLint is not installed or not listed as a dependency.
fix
npm install eslint --save-dev
error TypeError: eslint is not a function
cause Incorrect import pattern for CommonJS (using require incorrectly).
fix
const eslint = require('vite-plugin-eslint-report').default;
error Error: No ESLint configuration found
cause Missing .eslintrc.* file or configFile option points to a non-existent file.
fix
Create an ESLint config file or set the configFile option to the correct path.
gotcha Plugin might not work correctly with ESLint flat config (eslint.config.js) in newer ESLint versions. Ensure you use legacy .eslintrc.* or an alternative.
fix Use .eslintrc.* config file or check plugin compatibility with flat config.
gotcha In dev mode, ESLint errors may cause HMR updates to be delayed or suppressed. Overlay might not show all errors if HMR is fast.
fix Set ignoreInitial: true for incremental checks, or rely on terminal output instead of overlay.
gotcha The plugin may not lint files outside the project root. Ensure include paths are relative to project root.
fix Use 'src/**/*.js' style paths relative to project root.
npm install vite-plugin-eslint-report
yarn add vite-plugin-eslint-report
pnpm add vite-plugin-eslint-report

Basic setup of vite-plugin-eslint-report with common options: caching, file patterns, and custom config.

// vite.config.js
import eslint from 'vite-plugin-eslint-report';

export default {
  plugins: [
    eslint({
      ignoreInitial: false,
      cache: true,
      include: ['src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx'],
      exclude: ['node_modules'],
      formatter: 'stylish',
      configFile: '.eslintrc.js'
    })
  ]
};