Show ESLint results directly in the GitLab code quality results
MIT License
Show ESLint results directly in the GitLab code quality results.
Install eslint
and eslint-formatter-gitlab
using your package manager.
npm install --save-dev eslint eslint-formatter-gitlab
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.json
The formatter automatically detects a GitLab CI environment. It detects where to output the code quality report based on the GitLab configuration file.
An example of the results can be seen in
Merge Request !1 of
eslint-formatter-gitlab
itself.
ESLint formatters dont take any configuration options. eslint-formatter-gitlab
uses GitLabs
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.
This package is compatible with Node.js 18 or greater and ESLint 5 or greater.