A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/eslint-formatter-gitlab below:

eslint-formatter-gitlab - npm

ESLint Formatter for GitLab

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:22-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. It also prints ESLint issues to the GitLab job console with links.

The formatter can be used programmatically using ESLint.

import { ESLint } from 'eslint'

const eslint = new ESLint()
const formatter = await eslint.loadFormatter('gitlab')
const results = await eslint.lintFiles([])
const formatted = await formatter.format(results)

An example of the results can be seen in Merge Request !1 of eslint-formatter-gitlab itself.

ESLint formatters don’t take any configuration options. eslint-formatter-gitlab uses GitLab’s predefined environment variables to configure the output. The following predefined environment variables are used:

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 20 or greater and ESLint 9 or greater.

MIT © Remco Haszing


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4