eslint-formatter-gitlab v5.1.0
ESLint Formatter for GitLab
Show ESLint results directly in the GitLab code quality results.
Table of Contents
Requirements
This package requires at least Node.js 18 and ESLint 5.
Installation
Install eslint and eslint-formatter-gitlab using your package manager.
npm install --save-dev eslint eslint-formatter-gitlabUsage
Define a GitLab job to run eslint.
.gitlab-ci.yml:
eslint:
image: node:20-alpine
script:
- npm ci
- npx eslint --format gitlab .
artifacts:
reports:
codequality: gl-codequality.jsonThe formatter automatically detects a GitLab CI environment. It detects where to output the code quality report based on the GitLab configuration file.
Example
An example of the results can be seen in
Merge Request !1 of
eslint-formatter-gitlab itself.
Configuration
ESLint formatters don’t take any configuration options. eslint-formatter-gitlab uses GitLab’s
predefined environment variables
to configure the output. In addition, the environment variable ESLINT_CODE_QUALITY_REPORT is used
to override the location to store the code quality report.