{"id":41006,"library":"eslint-formatter-json","title":"eslint-formatter-json","description":"Official JSON formatter for ESLint, extracted as a standalone package at version 9.0.1. Released alongside ESLint 9.x, matching its output format. Provides typed JSON output of lint results as an array of file result objects. Published independently to avoid depending on the full ESLint package. Supports Node >=18.18.0. Ships TypeScript definitions.","status":"active","version":"9.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fregante/eslint-formatters","tags":["javascript","lint","ecmascript","typescript"],"install":[{"cmd":"npm install eslint-formatter-json","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-formatter-json","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-formatter-json","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to use the formatter with ESLint","package":"eslint","optional":true}],"imports":[{"note":"Module is ESM-only; CommonJS require will fail.","wrong":"const formatter = require('eslint-formatter-json')","symbol":"default","correct":"import formatter from 'eslint-formatter-json'"},{"note":"Use 'import type' to avoid runtime import of type-only exports.","wrong":"import { LintResult } from 'eslint-formatter-json'","symbol":"LintResult","correct":"import type { LintResult } from 'eslint-formatter-json'"},{"note":"Default export is the formatter function; named export does not exist.","wrong":"import { formatter } from 'eslint-formatter-json'","symbol":"formatter","correct":"import formatter from 'eslint-formatter-json'"}],"quickstart":{"code":"import formatter from 'eslint-formatter-json';\nconst results = [\n  {\n    filePath: 'foo.js',\n    messages: [{ message: 'Unexpected foo.', severity: 2, line: 5, column: 10, ruleId: 'foo' }],\n    errorCount: 1,\n    warningCount: 0,\n    fixableErrorCount: 0,\n    fixableWarningCount: 0\n  }\n];\nconst output = formatter(results);\nconsole.log(output);\n// [{\"filePath\":\"foo.js\",\"messages\":[{\"message\":\"Unexpected foo.\",\"severity\":2,\"line\":5,\"column\":10,\"ruleId\":\"foo\"}],\"errorCount\":1,\"warningCount\":0,\"fixableErrorCount\":0,\"fixableWarningCount\":0}]","lang":"typescript","description":"Formats ESLint LintResult array into a JSON string."},"warnings":[{"fix":"Switch to eslint-formatter-json standalone package.","message":"ESLint's built-in json formatter is deprecated in ESLint 9.x; use standalone package instead","severity":"deprecated","affected_versions":">=9.0.0"},{"fix":"Use dynamic import() or set type: \"module\" in package.json.","message":"Package is ESM-only. CommonJS require() will cause a MODULE_NOT_FOUND error.","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"Pass results with absolute or relative paths as needed.","message":"Output format changed in ESLint 9.x: filePath is no longer relative by default. Use options if needed.","severity":"gotcha","affected_versions":"9.x"},{"fix":"Use ESLint's built-in format('json') or eslint-formatter-json@8.","message":"Package name eslint-formatter-json is for ESLint 9; older versions use eslint's built-in formatter","severity":"deprecated","affected_versions":"<9.0.0"}],"env_vars":null,"search_vec":"'18.18.0':53 '9':21 '9.0.1':17 'alongsid':19 'array':36 'avoid':44 'definit':56 'depend':45 'ecmascript':59 'eslint':2,9,20,49 'eslint-formatter-json':1 'extract':10 'file':38 'format':26 'formatt':3,7 'full':48 'independ':42 'javascript':57 'json':4,6,29 'lint':32,58 'match':23 'node':52 'object':40 'offici':5 'output':25,30 'packag':14,50 'provid':27 'publish':41 'releas':18 'result':33,39 'ship':54 'standalon':13 'support':51 'type':28 'typescript':55,60 'version':16 'x':22","created_at":"2026-06-04T18:50:19.364125+00:00","updated_at":"2026-06-04T18:50:19.364125+00:00","problems":[{"fix":"Use import or dynamic import() instead of require().","cause":"Package is ESM-only but loaded via require()","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-formatter-json/index.js"},{"fix":"Convert your project to ESM (type: \"module\" in package.json) or use dynamic import().","cause":"ESM package loaded in a CommonJS context","error":"Must use import to load ES Module: eslint-formatter-json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/fregante/eslint-formatters/tree/main/packages/eslint-formatter-json","github":"https://github.com/fregante/eslint-formatters","docs":null,"changelog":null,"pypi":null,"npm":"eslint-formatter-json","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}