New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@regru/eslint-junit

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@regru/eslint-junit

A eslint result processor that generates junit xml files

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Downloads Downloads NPM Version Dependencies Dev Dependencies License

eslint-junit

A eslint reporter that creates compatible junit xml files

Installation

yarn add --dev @regru/eslint-junit

Usage

Simply run:

eslint -f ./node_modules/@regru/eslint-junit/index.js

Configuration

@regru/eslint-junit offers four configurations based on environment variables or a eslint-junit key defined in package.json. All configuration values should be strings.

Variable NameDescriptionDefault
ESLINT_SUITE_NAMEname attribute of <testsuites>"eslint tests"
ESLINT_JUNIT_OUTPUTFile path to save the output."./junit.xml"
ESLINT_JUNIT_CLASSNAMETemplate string for the classname attribute of <testcase>."{ruleId}"
ESLINT_JUNIT_TITLETemplate string for the name attribute of <testcase>."{line} : {source}"

Example:

ESLINT_SUITE_NAME="Eslint Style Tests" ESLINT_JUNIT_OUTPUT="./artifacts/eslint-junit.xml" eslint

You can also define a eslint-junit key in your package.json. All are string values.

{
  ...
  "eslint-junit": {
    "suiteName": "eslint tests",
    "output": "./eslint-junit.xml",
    "classNameTemplate": "{ruleId}",
    "titleTemplate": "{line} : {source}"
  }
}

For the following case:

function test (a) {
  a = '1';
}

The default output:

<testsuites name="eslint tests">
  <testsuite errors="1" failures="0" name="/test.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
    <testcase classname="no-param-reassign" name="2 :  a = '1';" time="1">
      <failure>Assignment to function parameter &apos;a&apos;.</failure>
    </testcase>
  </testsuite>
</testsuites>

Changing the classNameTemplate and titleTemplate:

ESLINT_JUNIT_CLASSNAME="{ruleId}" ESLINT_JUNIT_TITLE="{source}" eslint
<testsuites name="eslint tests">
  <testsuite errors="1" failures="0" name="/utils/getOptions.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
    <testcase classname="no-param-reassign" name="    pathToResolve = path.dirname(pathToResolve);" time="1">
      <failure>Assignment to function parameter &apos;pathToResolve&apos;.</failure>
    </testcase>
  </testsuite>
</testsuites>

FAQs

Package last updated on 16 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc