Registry / testing / eslint-formatter-junit

eslint-formatter-junit

JSON →
library9.0.1jsnpmunverified

Standalone npm package for ESLint's official JUnit XML formatter. Version 9.0.1 targets Node ^18.18.0 || ^20.9.0 || >=21.1.0 and ships TypeScript types. Released alongside ESLint releases, it extracts the built-in JUnit formatter into a separate module for use in CI/CD pipelines (e.g., Jenkins). No external dependencies. Different from similar packages by being directly sourced from ESLint's official source.

npm install eslint-formatter-junit
INSTALL
IMPORT
SIG · ESLINT-FORMATTER-J
E
eslint-formatter-junit
testingjavascriptv9.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import junitFormatter from 'eslint-formatter-junit'
const { default: junitFormatter } = require('eslint-formatter-junit')
ESM default export. In CommonJS use require('eslint-formatter-junit').default
junitFormatter
import junitFormatter from 'eslint-formatter-junit'
import { junitFormatter } from 'eslint-formatter-junit'
Named export not available; library only exports a default function
ESLint
import { ESLint } from 'eslint'
import { ESLint } from 'eslint-formatter-junit'
The ESLint class is from the 'eslint' package, not this formatter

Runs ESLint on JS files and outputs JUnit XML report using the official formatter.

import { ESLint } from 'eslint'; import junitFormatter from 'eslint-formatter-junit'; const eslint = new ESLint(); const results = await eslint.lintFiles(['**/*.js']); const xml = junitFormatter(results, results); console.log(xml);
Debug
Known issues
breakingESLint v9 drops support for Node <18.18
fix
Upgrade Node to ^18.18.0 || ^20.9.0 || >=21.1.0
affects: >=9.0.0
gotchaDefault import only; no named export exists
fix
Use default import: import f from 'eslint-formatter-junit'
affects: >=0.0.0
deprecatedThe second argument to formatter (results) is no longer used but kept for compatibility
fix
Pass same results array twice: junitFormatter(results, results)
affects: <9.0.0
gotchaRequires ESLint loader/message data — cannot format arbitrary objects
fix
Pass result objects from eslint.lintFiles() or CLIEngine.getResults()
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: junitFormatter is not a function
Incorrect import syntax in CommonJS
fix
Use const junitFormatter = require('eslint-formatter-junit').default
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using require() on an ESM-only package
fix
Use import() dynamic import or set type:"module" in package.json
error:0308010C:digital envelope routines::unsupported
OpenSSL incompatibility on Node 17+
fix
Set NODE_OPTIONS=--openssl-legacy-provider or downgrade to Node 16
Upgrade
Version history
9.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
eslint-formatter-junit — npm install eslint-formatter-junit · libregistry