{"id":19673,"library":"eslint-json","title":"eslint-json","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/sindresorhus/eslint-json","tags":["javascript","eslint","eslint-formatter","formatter","reporter","lint","validate","json","serialize"],"install":[{"cmd":"npm install eslint-json","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-json","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-json","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS only; no default export for ESM. Use require().","wrong":"import eslintJson from 'eslint-json';","symbol":"default","correct":"const eslintJson = require('eslint-json');"},{"note":"Direct call returns formatted JSON string; no .format method.","wrong":"const results = require('eslint-json').format(results, config);","symbol":"results","correct":"const results = require('eslint-json')(results, config);"},{"note":"Must specify full path to module, not just 'json'.","wrong":"eslint --format=json file.js","symbol":"ESLint formatter","correct":"eslint --format=node_modules/eslint-json file.js"}],"quickstart":{"code":"const eslint = require('eslint');\nconst formatter = require('eslint-json');\nconst cli = new eslint.CLIEngine({});\nconst report = cli.executeOnFiles(['index.js']);\nconst jsonOutput = formatter(report.results, report.config);\nconsole.log(jsonOutput);","lang":"javascript","description":"Demonstrates how to programmatically use eslint-json to format ESLint results as JSON."},"warnings":[{"fix":"Use report.results (array) instead of report (object).","message":"Must pass results array as first argument, not the full report object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"const output = JSON.parse(formatter(results, config));","message":"The formatter output is a string, not a JavaScript object. Must JSON.parse before using as object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use absolute path or 'node_modules/eslint-json'.","message":"When 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev eslint-json and use full path: eslint --format=./node_modules/eslint-json file.js","cause":"Module not installed or path incorrect.","error":"Error: Cannot find module 'eslint-json'"},{"fix":"Use require('eslint-json') and call as function: formatter(results, config);","cause":"Using wrong require pattern (e.g., import from ESM).","error":"TypeError: formatter is not a function"},{"fix":"Use report.results (the array) as first argument.","cause":"Passed entire report object instead of results array.","error":"TypeError: results is not iterable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}