eslint-formatter-rdjson

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

An ESLint formatter that outputs results in the Reviewdog Diagnostic Format (RDFormat), enabling seamless integration with Reviewdog for automated code review in CI pipelines. Version 1.0.6 is the latest stable release. It is maintained as part of the action-eslint project by Reviewdog. Key differentiators: produces machine-parseable RDJSON output optimized for Reviewdog's diagnostic reporting, supports GitHub Actions, and works with any CI that can parse JSON.

error Error: Cannot find module 'eslint-formatter-rdjson'
cause Missing or incorrect installation / CommonJS require instead of ESM import.
fix
Run npm install eslint-formatter-rdjson --save-dev and use import syntax.
error TypeError: formatter is not a function
cause Incorrect import style; default export used as named export.
fix
Change to import formatter from 'eslint-formatter-rdjson'.
error ESLint configuration error: Invalid formatter 'rdjson'
cause Formatter not found because the package is not installed or misconfigured.
fix
Ensure eslint-formatter-rdjson is in devDependencies and run npx eslint --format rdjson.
breaking ESLint 9+ breaking changes: eslint-formatter-rdjson 1.0.6 may not work with flat config without explicit formatter support.
fix Ensure compatibility by testing with ESLint 9 and use eslint.config.js with format: 'rdjson'.
gotcha Formatter output is RDJSON, not standard ESLint JSON; cannot be piped directly to other tools that expect JSON.
fix Pipe output to Reviewdog or parse RDJSON format accordingly.
deprecated The package is bundled with reviewdog/action-eslint; standalone usage is discouraged if you are using the action.
fix Use the official GitHub Action reviewdog/action-eslint instead of manual formatter setup.
npm install eslint-formatter-rdjson
yarn add eslint-formatter-rdjson
pnpm add eslint-formatter-rdjson

Shows how to use the rdjson formatter programmatically and via CLI to output Reviewdog-compatible JSON.

// Run ESLint with the rdjson formatter
import { ESLint } from 'eslint';
const eslint = new ESLint({ overrideConfig: { format: 'rdjson' } });
const results = await eslint.lintFiles(['src/**/*.js']);
const formatter = await eslint.loadFormatter('eslint-formatter-rdjson');
const resultText = await formatter.format(results);
console.log(resultText);

// Or via CLI:
// npx eslint --format rdjson src/