ESLint formatter that outputs results as GitLab Code Quality reports (gl-codequality.json) and prints issues to the console with merge request links. Version 7.1.0, released under MIT, requires Node.js 20+ and ESLint 9+. Integrates seamlessly with GitLab CI/CD using predefined environment variables, auto-detecting project configuration. Unlike generic formatters, it directly produces the artifact format expected by GitLab's Code Quality feature, enabling inline annotations in merge requests. Maintained by Remco Haszing, with TypeScript type definitions included.
npm install eslint-formatter-gitlabVerified import paths — ran on the pinned version, not inferred.
Shows both GitLab CI job configuration and programmatic usage for generating Code Quality reports.
Use ESM imports or upgrade to Node >= 20. For CJS, pin to v6.
Upgrade to ESLint 9 or use eslint-formatter-gitlab@6.
Use Node.js >= 20.
Set CI_CONFIG_PATH if your CI config is at a non-default location.
Ensure the job in .gitlab-ci.yml has 'artifacts: reports: codequality: ...' set.
Set CI_PROJECT_DIR environment variable in CI jobs to the project root.
Switch to import or dynamic import(). If using CJS, use eslint-formatter-gitlab@6.
Use 'npx eslint --format gitlab' instead of '--format eslint-formatter-gitlab'.
Install eslint types: npm i -D @types/eslint. Ensure tsconfig has 'moduleResolution': 'node16' or 'bundler'.
Run inside a GitLab CI job, or set CI_JOB_NAME manually for local testing (not recommended).