Registry / devops / stylelint-formatter-codeclimate

stylelint-formatter-codeclimate

JSON →
library1.1.0jsnpmunverified

A CodeClimate-compatible formatter for Stylelint that outputs lint results in the CodeClimate issue format, compatible with GitLab Code Quality reports. Current stable version is 1.1.0, released with support for Stylelint 16 and Node.js 18+. It is maintained as a dedicated tool for GitLab CI integration, differentiating from other Stylelint formatters by producing the exact JSON schema required for GitLab's Code Quality artifact reports.

npm install stylelint-formatter-codeclimate
INSTALL
IMPORT
SIG · STYLELINT-FORMATTE
S
stylelint-formatter-codeclimate
devopsjavascriptv1.1.0
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
import formatter from 'stylelint-formatter-codeclimate'
const formatter = require('stylelint-formatter-codeclimate')
The package is ESM-only since v1.0.0; CommonJS require() will fail.
Formatter
import type { Formatter } from 'stylelint-formatter-codeclimate'
import { Formatter } from 'stylelint-formatter-codeclimate'
TypeScript users must use 'import type' as Formatter is only a type, not a runtime export.
CLI usage
npx stylelint "*.css" --custom-formatter=node_modules/stylelint-formatter-codeclimate
npx stylelint "*.css" --formatter=codeclimate
The package is not a built-in formatter; you must use --custom-formatter and provide the full path.

Install Stylelint and the formatter, then run stylelint with the custom formatter and output to a file for GitLab Code Quality.

npm install --save-dev stylelint stylelint-formatter-codeclimate npx stylelint "*.css" --custom-formatter=node_modules/stylelint-formatter-codeclimate --output-file=gl-code-quality-report.json
Debug
Known issues
breakingversion 1.0.0 dropped CommonJS support; require() will throw an error.
fix
Use ESM imports (import) or upgrade to Node.js 18+ with type: 'module' in package.json.
affects: >=1.0.0
breakingversion 0.x used a different output format incompatible with GitLab Code Quality reports.
fix
Upgrade to 1.0.0+ and adjust your CI pipeline.
affects: <1.0.0
gotchaWhen using --custom-formatter, the path must be absolute or relative to the current working directory; simple module name resolution may fail.
fix
Use full path: node_modules/stylelint-formatter-codeclimate or use --custom-formatter ../../node_modules/stylelint-formatter-codeclimate if inside a subdirectory.
affects: >=0.0.0
gotchaThe formatter requires Stylelint 16+; older Stylelint versions will silently produce empty output or errors.
fix
Ensure Stylelint is at version 16 or later.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Attempting to use CommonJS require() on the ESM-only package.
fix
Switch to import or use dynamic import().
TypeError: formatter is not a function
Incorrect formatter path or outdated Stylelint version.
fix
Use --custom-formatter with correct path and ensure Stylelint >=16.
GitLab Code Quality report not appearing in merge request
Output file path mismatch or formatter not producing valid JSON.
fix
Check that the output file is in the correct format and referenced correctly in artifacts:reports:codeclimate.
Cannot find module 'stylelint-formatter-codeclimate'
Package not installed or path incorrect.
fix
Run npm install --save-dev stylelint-formatter-codeclimate and verify node_modules.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
stylelintrequiredPeer dependency - the formatter is designed to work with Stylelint's custom formatter API.
Agent activity
8 hits · last 30 days
node
7
Resources
stylelint-formatter-codeclimate — npm install stylelint-formatter-codeclimate · libregistry