Registry / devops / stylelint-formatter-gitlab

stylelint-formatter-gitlab

JSON →
library1.0.2jsnpmunverified

A custom formatter for Stylelint that outputs results in GitLab Code Quality report format, enabling inline annotations in merge requests. This package is specifically designed for GitLab CI/CD pipelines, automatically detecting the environment and generating a gl-codequality.json artifact. Version 1.0.2 is stable but has limited recent activity; it supports Stylelint >=9 and requires GitLab Starter 11.5+. Key differentiator: it bridges Stylelint linting with GitLab's native code quality feature, avoiding manual report parsing.

npm install stylelint-formatter-gitlab
INSTALL
IMPORT
SIG · STYLELINT-FORMATTE
S
stylelint-formatter-gitlab
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
No import in code; used via --custom-formatter
const formatter = require('stylelint-formatter-gitlab')
This is not a programmatic API. It is used as a CLI custom formatter only.

Installs the formatter and configures a GitLab CI job to run Stylelint with the custom formatter, generating a code quality report artifact.

npm install --save-dev stylelint stylelint-formatter-gitlab # or: yarn add --dev stylelint stylelint-formatter-gitlab # In .gitlab-ci.yml: stylelint: image: node:10-alpine script: - npm ci - npx stylelint --custom-formatter=node_modules/stylelint-formatter-gitlab . artifacts: reports: codequality: gl-codequality.json
Debug
Known issues
gotchaThe formatter writes to a file (gl-codequality.json) by default; ensure the working directory is writable.
fix
Run the stylelint command from a directory where you have write permissions.
affects: >=1.0.0
gotchaThe formatter expects to run in a GitLab CI context to detect the artifact path; it may not work outside of GitLab CI.
fix
Set STYLELINT_CODE_QUALITY_REPORT environment variable to a specific path when running locally.
affects: >=1.0.0
deprecatedThe GitLab CI configuration example uses 'codequality' artifact, which was renamed to 'code_quality' in later GitLab versions.
fix
Update artifact key to 'code_quality' for GitLab >=13.5.
affects: >=1.0.0
gotchaThe formatter does not output anything to stdout by default; use STYLELINT_FORMATTER env var for console output.
fix
Set environment variable STYLELINT_FORMATTER to a Stylelint formatter name (e.g., 'string') to see results in terminal.
affects: >=1.0.0
Errors
Common errors & fixes
Error: No code quality report path found. Make sure you are inside GitLab CI with a codequality artifact defined.
The formatter cannot automatically detect the GitLab CI artifact path; this error occurs when not running in GitLab CI or when the artifact is not configured.
fix
Set the STYLELINT_CODE_QUALITY_REPORT environment variable to a desired file path, e.g., export STYLELINT_CODE_QUALITY_REPORT=gl-codequality.json
Cannot find module 'stylelint-formatter-gitlab'
The formatter is not installed or not in node_modules when using npx with --custom-formatter.
fix
Ensure stylelint-formatter-gitlab is installed as a devDependency. Use node_modules/.bin/stylelint or --custom-formatter=./node_modules/stylelint-formatter-gitlab
Error: Invalid formatter 'stylelint-formatter-gitlab'
The formatter module does not export a proper formatter function (e.g., using require instead of import) or is malformed.
fix
Reinstall the package: npm install stylelint-formatter-gitlab
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
stylelintrequiredpeer dependency >=9; the formatter is a plugin for Stylelint
Agent activity
2 hits · last 30 days
node
2
Resources
stylelint-formatter-gitlab — npm install stylelint-formatter-gitlab · libregistry