eslint-formatter-summary

raw JSON →
2.0.2 verified Sat Apr 25 auth: no javascript

ESLint formatter that aggregates linting results by rule, showing total errors and warnings per rule instead of per-file output. Current stable version is 2.0.2 (April 2025), with regular releases. Key differentiator: helps introduce ESLint to large codebases by summarizing rule failures, making it easier to suppress or prioritize fixes. Supports sorting by rule name, error count, or warning count via environment variables. Written in TypeScript, requires Node.js >=20.

error Error: Cannot find module 'eslint-formatter-summary'
cause Package not installed or ESLint cannot locate the formatter.
fix
Run 'npm install -D eslint-formatter-summary' and ensure node_modules is present.
error Invalid formatter 'summary'
cause Using a formatter name that ESLint does not recognize.
fix
Use '-f summary' (the shorthand) after installing eslint-formatter-summary.
error Error: Requires node >=20
cause Node.js version is below 20 when using v2.
fix
Upgrade Node.js to v20 or later, or use v1 (npm install eslint-formatter-summary@1).
breaking v2.0.0 drops support for Node.js versions below 20. Requires Node.js >=20.
fix Upgrade Node.js to v20 or later.
breaking v2.0.0 rewrites the formatter in TypeScript and updates dependencies. Output format may have slight changes.
fix Review output format for any changes in aggregation behavior.
deprecated v1.x configuration via environment variables SORT_BY and DESC remain supported but may be removed in future.
fix Migrate to v2 and continue using env vars; no breaking change in usage.
gotcha The formatter expects ESLint to be installed as a peer dependency. It may not work if ESLint is missing.
fix Ensure ESLint is installed in the project (npm i -D eslint).
npm install eslint-formatter-summary
yarn add eslint-formatter-summary
pnpm add eslint-formatter-summary

Installs the package and runs ESLint with the summary formatter, demonstrating basic usage and sorting via environment variables.

npm install -D eslint-formatter-summary
# Create a test file with lint errors
echo 'const x = 1;' > test.js
# Run ESLint with the summary formatter (ensure ESLint is installed)
eslint -f summary test.js
# Output shows aggregated errors/warnings per rule
# To sort by rule (ascending):
SORT_BY=rule eslint -f summary test.js
# To sort by errors descending:
SORT_BY=errors DESC=true eslint -f summary test.js