ESLint HTML Reporter
raw JSON → 0.7.4 verified Sat Apr 25 auth: no javascript
Generates an HTML report from ESLint results with a summary of all linted files and their errors and warnings. Version 0.7.4 is the latest stable release. It provides detailed and "lite" output options, optional TeamCity integration, and a summary of top issues. Unlike using ESLint's built-in formatters, this package produces a standalone HTML page that can be opened in a browser or served, making it easy to share lint results with a team. It has limited recent development but remains functional for most ESLint use cases.
Common errors
error Error: Cannot find module 'eslint-html-reporter' ↓
cause Package not installed or installed in wrong location.
fix
Run 'npm install eslint-html-reporter --save-dev' and ensure it's in 'node_modules'.
error TypeError: reporter is not a function ↓
cause Incorrect import; the package exports a function but it's being used as an object.
fix
Use 'const reporter = require('eslint-html-reporter');' then call 'reporter(results)'.
error Error: No such file or directory: 'report.html' ↓
cause Output path is not writable or does not exist.
fix
Ensure the output directory exists or use an absolute path.
Warnings
gotcha The package uses CommonJS and does not support ESM imports directly. ↓
fix Use require() or configure your bundler to handle CommonJS modules.
deprecated The package relies on deprecated eslint.CLIEngine (removed in ESLint v9). ↓
fix Use ESLint v8 or lower, or update to a newer reporter that supports ESLint's FlatConfig.
gotcha The reporter expects the full ESLint results object; passing only the messages array will fail. ↓
fix Always pass the complete results object from ESLint's executeOnFiles or from gulp-eslint's format callback.
Install
npm install eslint-html-reporter yarn add eslint-html-reporter pnpm add eslint-html-reporter Imports
- default (reporter function) wrong
import reporter from 'eslint-html-reporter';correctconst reporter = require('eslint-html-reporter'); - reporter-lite.js wrong
const reporterLite = require('eslint-html-reporter').lite;correctconst reporterLite = require('eslint-html-reporter/reporter-lite'); - reporter-team-city.js wrong
const reporterTeamCity = require('eslint-html-reporter/teamcity');correctconst reporterTeamCity = require('eslint-html-reporter/reporter-team-city'); - reporter-lite-team-city.js wrong
const reporterLLiteTC = require('eslint-html-reporter/lite-teamcity');correctconst reporterLLiteTC = require('eslint-html-reporter/reporter-lite-team-city');
Quickstart
// Install: npm install eslint-html-reporter
// Then run ESLint with the reporter
// bash:
eslint . -f node_modules/eslint-html-reporter/reporter.js -o report.html
// Using programmatically:
const eslint = require('eslint');
const reporter = require('eslint-html-reporter');
const fs = require('fs');
async function main() {
const engine = new eslint.CLIEngine({});
const report = engine.executeOnFiles(['.']);
const results = reporter(report.results);
fs.writeFileSync('report.html', results);
}
main().catch(console.error);