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.
formatter
✓ eslint -f node_modules/eslint-junit-formatter/reporter.js
✗ eslint -f eslint-junit-formatter
The formatter is a Node.js script; must specify full relative path from node_modules (like reporter.js) or use --format with a module path.
require('eslint-junit-formatter')
✓ require('eslint-junit-formatter')
✗ import { formatter } from 'eslint-junit-formatter'
This package is a CommonJS module; no named exports. Use require() for programmatic use or ESLint config.
ESLint Formatter Function
✓ const formatter = require('eslint-junit-formatter');
✗ const { default: formatter } = require('eslint-junit-formatter');
The module exports a function directly, not as a default property.
Shows CLI usage with ESLint to generate a JUnit XML report, including optional warning suppression.
# Create ESLint config
cat > .eslintrc.json << 'EOF'
{
"env": { "browser": true, "es6": true },
"rules": { "no-unused-vars": "warn" }
}
EOF
# Run ESLint with the JUnit formatter
eslint src/ -f node_modules/eslint-junit-formatter/reporter.js -o eslint-report.xml
# Suppress warnings in output (optional)
eslint src/ -f node_modules/eslint-junit-formatter/reporter.js --quiet -o eslint-report.xml
Errors
Common errors & fixes
Error: Cannot find module 'eslint-junit-formatter'
ESLint cannot resolve the formatter by package name alone.
fixUse full path: eslint -f node_modules/eslint-junit-formatter/reporter.js
ESLint: Configuration for rule "no-unused-vars" is invalid. Value "warn" should be "off", "warn", or "error".
Misconfiguration of rule severity; 'warn' is valid but typo or wrong format.
fixCheck .eslintrc: ensure rule values are string 'warn', 'error', or 'off'.
Audit
Dependencies
eslintoptionalpeer dependency required for formatter integration