{"id":19642,"library":"eslint-formatter-html","title":"eslint-formatter-html","description":"A enhanced ESLint formatter that outputs HTML reports with interactive features built on React and Ant Design. Version 2.7.3 is stable and actively maintained. It supports dark mode, ANSI code display, and file path/line copying. Unlike ESLint's built-in HTML formatter, it uses pako compression for small file sizes and relative file paths for brevity. The package is released irregularly but receives updates.","status":"active","version":"2.7.3","language":"javascript","source_language":"en","source_url":"https://github.com/shuoshubao/eslint-formatter-html","tags":["javascript","eslint","formatter","eslint-formatter","eslint-formatter-html"],"install":[{"cmd":"npm install eslint-formatter-html","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-formatter-html","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-formatter-html","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for compressing the report data into the HTML file","package":"pako","optional":false},{"reason":"Runtime dependency for the HTML report UI","package":"react","optional":false},{"reason":"UI component library used in the report","package":"antd","optional":false}],"imports":[{"note":"This package is CommonJS only. ESM import will not work because it does not export an ES module.","wrong":"import htmlFormatter from 'eslint-formatter-html';","symbol":"default","correct":"const htmlFormatter = require('eslint-formatter-html');"},{"note":"The formatter name passed to -f is just 'html', not the full package name. ESLint resolves it from the package.","wrong":"npx eslint -f eslint-formatter-html -o report.html","symbol":"default","correct":"npx eslint -f html -o report.html"},{"note":"The function expects an array of LintResult objects and returns an HTML string. Can be used programmatically with ESLint's API.","wrong":"","symbol":"default","correct":"const formatter = require('eslint-formatter-html'); const result = formatter(results);"}],"quickstart":{"code":"// Install: npm i -D eslint-formatter-html\n// Generate HTML report:\nconst { ESLint } = require('eslint');\nconst formatter = require('eslint-formatter-html');\n\nasync function main() {\n  const eslint = new ESLint();\n  const results = await eslint.lintFiles(['src/**/*.js']);\n  const html = formatter(results); // results is array of LintResult\n  require('fs').writeFileSync('report.html', html);\n  console.log('Report saved to report.html');\n}\nmain().catch(err => console.error(err));","lang":"javascript","description":"Shows how to use eslint-formatter-html programmatically to generate an HTML report from lint results."},"warnings":[{"fix":"Use `require('eslint-formatter-html')` directly instead of `require('eslint-formatter-html').format`.","message":"The 'format' export is deprecated; use default export instead.","severity":"deprecated","affected_versions":"<=2.0.0"},{"fix":"Ensure you pass the raw results array from ESLint's API.","message":"The formatter expects the LintResult array exactly as returned by ESLint. Modifying the structure may cause errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"No built-in offline support; ensure network access or modify the formatter to inline dependencies.","message":"The output HTML file is self-contained but uses external CDN for React and Ant Design fonts (if not bundled).","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev eslint-formatter-html` and use `-f html` (not the full package name).","cause":"Missing dependency or using wrong formatter name in ESLint config.","error":"Error: Cannot find module 'eslint-formatter-html'"},{"fix":"Use `require('eslint-formatter-html')` (CommonJS) or treat the default export as the function.","cause":"Using default import in ESM context or calling a nonexistent named export.","error":"TypeError: formatter is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}