Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ const htmlFormatter = require('eslint-formatter-html');
✗ import htmlFormatter from 'eslint-formatter-html';
This package is CommonJS only. ESM import will not work because it does not export an ES module.
default
✓ npx eslint -f html -o report.html
✗ npx eslint -f eslint-formatter-html -o report.html
The formatter name passed to -f is just 'html', not the full package name. ESLint resolves it from the package.
default
✓ const formatter = require('eslint-formatter-html'); const result = formatter(results);
The function expects an array of LintResult objects and returns an HTML string. Can be used programmatically with ESLint's API.
Shows how to use eslint-formatter-html programmatically to generate an HTML report from lint results.
// Install: npm i -D eslint-formatter-html
// Generate HTML report:
const { ESLint } = require('eslint');
const formatter = require('eslint-formatter-html');
async function main() {
const eslint = new ESLint();
const results = await eslint.lintFiles(['src/**/*.js']);
const html = formatter(results); // results is array of LintResult
require('fs').writeFileSync('report.html', html);
console.log('Report saved to report.html');
}
main().catch(err => console.error(err));
Errors
Common errors & fixes
Error: Cannot find module 'eslint-formatter-html'
Missing dependency or using wrong formatter name in ESLint config.
fixRun `npm install --save-dev eslint-formatter-html` and use `-f html` (not the full package name).
TypeError: formatter is not a function
Using default import in ESM context or calling a nonexistent named export.
fixUse `require('eslint-formatter-html')` (CommonJS) or treat the default export as the function. Audit
Dependencies
pakorequiredUsed for compressing the report data into the HTML file
reactrequiredRuntime dependency for the HTML report UI
antdrequiredUI component library used in the report