eslint-stats

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript deprecated

Custom ESLint formatters that aggregate errors by rule rather than by file. Currently at version 1.0.1 (stable, last released 2016). It helps when introducing ESLint to a large codebase by showing which rules cause the most violations. Differentiates from default formatters by providing aggregated views: byError, byWarning, byErrorAndWarning, byErrorAndWarningStacked, and byFolder. No active maintenance; works with ESLint < 8.x due to API changes.

error Error: Cannot find module 'eslint-stats/byError.js'
cause Incorrect file path when using with ESLint CLI; the module is not at that path in newer Node resolutions.
fix
Use eslint --format node_modules/eslint-stats/byError.js or better: --format eslint-stats/byError (if module resolves).
error TypeError: formatter is not a function
cause ESLint >= 8 expects formatters to be functions; eslint-stats exports objects.
fix
Use an older version of ESLint (<=7.x) or manually wrap the formatter.
error Warning: Rule 'no-console' not found
cause The package does not include actual ESLint rules; this error occurs if you misconfigure ESLint.
fix
Ensure you have the necessary plugins and rules installed separately.
breaking eslint-stats is not compatible with ESLint >= 8.0.0 due to formatter API changes.
fix Use built-in formatter or migrate to a maintained alternative.
deprecated The package has not been updated since 2016 and is effectively abandoned.
fix Consider using eslint-formatter-stats or other maintained forks.
gotcha The reporters only display rules with errors (or warnings) and ignore others; byError will not show warnings, byWarning will not show errors.
fix Use byErrorAndWarning if you want both.
npm install eslint-stats
yarn add eslint-stats
pnpm add eslint-stats

Shows how to use eslint-stats byError reporter programmatically with ESLint.

import { byError } from 'eslint-stats';

// Use with ESLint programmatic API
import { ESLint } from 'eslint';

const eslint = new ESLint();
const results = await eslint.lintFiles(['src/**/*.js']);
const formatter = await eslint.loadFormatter(byError);
const output = formatter.format(results);
console.log(output);