Skip to content

voidberg/eslint-bamboo-formatter

Repository files navigation

eslint-bamboo-formatter

Latest release on NPM npm module downloads per month Build states MIT License

A reporter for eslint which produces a report compatible with Atlassian Bamboo Mocha Test Parser.

What it does

Bamboo's Mocha Test Parser reads test results from a Mocha-style JSON file. This formatter writes ESLint results in that format, with one entry per linted file, so lint failures show up as test results in your Bamboo build report.

Installation

npm install --save-dev eslint-bamboo-formatter

Requires Node.js 20.19 or newer.

Usage

Run ESLint with the formatter from the CLI:

eslint file.js -f node_modules/eslint-bamboo-formatter/reporter.js

The formatter only reads ESLint's results, so it works the same whether your project uses the flat config (eslint.config.js) or the legacy .eslintrc.

Configuration

Two environment variables control the output:

  • ESLINT_FILE: path of the JSON file to write (default eslint.json).
  • ESLINT_WARNING_AS_ERROR: when set, warnings are counted as failures. Warnings are ignored by default.

Example output

Linting one file with an error and one clean file produces:

{
  "stats": {
    "tests": 2,
    "passes": 1,
    "failures": 1,
    "duration": 0,
    "start": "2026-06-25T12:00:00.000Z",
    "end": "2026-06-25T12:00:00.000Z"
  },
  "failures": [
    {
      "title": "bad.js",
      "fullTitle": "/src/bad.js",
      "duration": 0,
      "errorCount": 1,
      "error": "1 Failure: 1. line 2, column 5: Unexpected var, use let or const instead."
    }
  ],
  "passes": [
    {
      "title": "good.js",
      "fullTitle": "/src/good.js",
      "duration": 0,
      "errorCount": 0
    }
  ],
  "skipped": []
}

Development

The formatter is written in TypeScript under src/ and built with tsup to dual ESM/CJS with type declarations. The published reporter.js is a thin CommonJS entry that re-exports the build.

npm install
npm run build      # bundle to dist/ (ESM + CJS + .d.ts)
npm test           # run the vitest suite
npm run lint       # eslint flat config
npm run typecheck  # tsc --noEmit
npm run format     # prettier --write

The Bamboo report format is pinned by snapshot tests, which generate realistic results through ESLint's Node API. Keep them green when touching the output.

License

MIT

About

A reporter for eslint which produces a report compatible with Atlassian Bamboo Mocha Test Parser.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors