Registry / testing / eslint-formatter-json-relative

eslint-formatter-json-relative

JSON →
library0.1.0jsnpmunverified

A formatter for ESLint that outputs linting results in JSON format, but replaces all absolute file paths with paths relative to the current working directory. Version 0.1.0 is the latest stable release. This package is a thin wrapper around ESLint's built-in JSON formatter, with no active development or updates expected. It is designed to produce portable output that can be consumed by tools in CI or other environments where absolute paths may differ. Alternatives include using the native JSON formatter with a post-processing step.

testing
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

The package is ESM-only; require() may fail depending on Node.js version and project configuration.

import formatter from 'eslint-formatter-json-relative'

While the package is ESM, it may still be required if the project uses CommonJS, but this is not officially supported.

const formatter = require('eslint-formatter-json-relative')

No types are shipped; you may need to cast or use the ESLint type definitions.

import type { Linter } from 'eslint'; import formatter from 'eslint-formatter-json-relative';

Shows installation, CLI usage, and programmatic usage of the formatter, including how to get relative-path JSON output.

// Install: npm i eslint-formatter-json-relative --save-dev // Use via ESLint CLI: eslint -f json-relative ./src // Or programmatically in an ESLint plugin or script: import formatter from 'eslint-formatter-json-relative'; import { ESLint } from 'eslint'; const eslint = new ESLint(); const results = await eslint.lintFiles(['./src']); const output = formatter(results); console.log(output);
Debug
Known footguns
gotchaThe formatter only replaces absolute paths with relative ones; all other JSON structure is identical to the built-in JSON formatter.
gotchaThe package is ESM-only; using require() may fail in some Node.js versions or configurations.
deprecatedNo updates since initial release; consider using ESLint's built-in JSON formatter and processing paths yourself.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources