Registry / devops / eslint-json

eslint-json

JSON →
library2.0.0jsnpmunverified

JSON reporter for ESLint that outputs lint results as a JSON array. Version 2.0.0, stable, low maintenance. Key differentiator: simplifies piping ESLint output to other tools (e.g., CI, custom scripts) by using standard JSON format. No breaking changes since initial release. Commonly used in build pipelines. Lightweight with zero dependencies.

npm install eslint-json
INSTALL
IMPORT
SIG · ESLINT-JSON
E
eslint-json
devopsjavascriptv2.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ const eslintJson = require('eslint-json');
✗ import eslintJson from 'eslint-json';
Package is CJS only; no default export for ESM. Use require().
results
✓ const results = require('eslint-json')(results, config);
✗ const results = require('eslint-json').format(results, config);
Direct call returns formatted JSON string; no .format method.
ESLint formatter
✓ eslint --format=node_modules/eslint-json file.js
✗ eslint --format=json file.js
Must specify full path to module, not just 'json'.

Demonstrates how to programmatically use eslint-json to format ESLint results as JSON.

const eslint = require('eslint'); const formatter = require('eslint-json'); const cli = new eslint.CLIEngine({}); const report = cli.executeOnFiles(['index.js']); const jsonOutput = formatter(report.results, report.config); console.log(jsonOutput);
eslint-json --version
Debug
Known issues
gotchaMust pass results array as first argument, not the full report object.
fix
Use report.results (array) instead of report (object).
affects: >=1.0.0
gotchaThe formatter output is a string, not a JavaScript object. Must JSON.parse before using as object.
fix
const output = JSON.parse(formatter(results, config));
affects: >=1.0.0
gotchaWhen using ESLint CLI, the format path must be exactly 'node_modules/eslint-json' or full path; relative path may fail if cwd is not project root.
fix
Use absolute path or 'node_modules/eslint-json'.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'eslint-json'
Module not installed or path incorrect.
fix
npm install --save-dev eslint-json and use full path: eslint --format=./node_modules/eslint-json file.js
TypeError: formatter is not a function
Using wrong require pattern (e.g., import from ESM).
fix
Use require('eslint-json') and call as function: formatter(results, config);
TypeError: results is not iterable
Passed entire report object instead of results array.
fix
Use report.results (the array) as first argument.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
eslint-json — npm install eslint-json · libregistry