eslint-junit

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript maintenance

An ESLint result processor that generates JUnit XML files for integration with CI systems like Jenkins. Current version 1.0.1, last released in 2017 with no recent updates (low maintenance). It works by running ESLint with a custom formatter and producing XML output configurable via environment variables or package.json. Similar to 'eslint-junit-formatter' but simpler and older. It has minimal dependencies and supports Node >=6.0.0.

error Error: Cannot find module 'eslint-junit'
cause ESLint is looking for formatter in unexpected location.
fix
Use full path: eslint -f ./node_modules/eslint-junit/index.js
error Cannot read property 'replace' of undefined
cause Missing or malformed template variables in configuration.
fix
Ensure ESLINT_JUNIT_CLASSNAME or ESLINT_JUNIT_TITLE use valid placeholders like {ruleId}, {line}, {source}.
gotcha Package is very old (2017). May not work with newer ESLint versions (>=7) due to formatter API changes.
fix Switch to maintained alternatives like 'eslint-junit-formatter' or 'eslint-formatter-junit'.
gotcha The formatter does not support ESLint's --output-file flag; output must be configured via environment variable or package.json.
fix Set ESLINT_JUNIT_OUTPUT environment variable or use package.json config.
gotcha Configuration via package.json requires a 'eslint-junit' key with string values. Boolean or numeric values may cause errors.
fix Ensure all values in the config object are strings.
npm install eslint-junit
yarn add eslint-junit
pnpm add eslint-junit

Installs eslint-junit as a dev dependency and runs ESLint with it, exporting JUnit XML to ./test-results/eslint-junit.xml.

npm install --save-dev eslint-junit
# Run ESLint with eslint-junit formatter
ESLINT_SUITE_NAME="My ESLint Tests" ESLINT_JUNIT_OUTPUT="./test-results/eslint-junit.xml" npx eslint -f ./node_modules/eslint-junit/index.js src/