Registry / testing / stylelint-gitlabci-formatter

stylelint-gitlabci-formatter

JSON →
library1.0.1jsnpmunverified

Output JUnit XML reports of stylelint results for GitLab CI. Version 1.0.1 is the latest stable release. This package is a slight adaptation of stylelint-junit-formatter for GitLab CI integration. Key differentiators: specifically designed for GitLab CI's JUnit report artifacts, with a focus on accurate XML formatting for GitLab's test report viewer. It is a lightweight formatter without additional dependencies beyond stylelint.

npm install stylelint-gitlabci-formatter
INSTALL
IMPORT
SIG · STYLELINT-GITLABCI
S
stylelint-gitlabci-formatter
testingjavascriptv1.0.1
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.

stylelint-gitlabci-formatter
import createFormatter from 'stylelint-gitlabci-formatter'; // or using require: const createFormatter = require('stylelint-gitlabci-formatter');
import { stylelintGitlabciFormatter } from 'stylelint-gitlabci-formatter'; // wrong: default export is a function, not named
Package exports a single function as default export. ESM or CJS both work.
stylelint-gitlabci-formatter (as custom formatter via CLI)
stylelint --custom-formatter ./node_modules/stylelint-gitlabci-formatter ...
stylelint --formatter stylelint-gitlabci-formatter ... // wrong: --formatter expects predefined formatters, use --custom-formatter instead
Must use --custom-formatter (or -c) not --formatter when using a custom formatter file path.
stylelint-gitlabci-formatter (output file)
stylelint --output-file stylelint_junit.xml --custom-formatter ./node_modules/stylelint-gitlabci-formatter ...
stylelint --output stylelint_junit.xml ... // wrong: --output is not a valid stylelint option, use --output-file instead
Use --output-file to redirect formatter output to a file. --output is a common mistake.

Installs the formatter with stylelint and a config, then runs stylelint with the custom formatter to output a JUnit XML file for GitLab CI.

npm install stylelint-gitlabci-formatter stylelint stylelint-config-standard --save-dev # .stylelintrc { "extends": "stylelint-config-standard", "ignoreFiles": "node_modules/**/*" } # package.json script "lint": "stylelint '**/*.css' --custom-formatter ./node_modules/stylelint-gitlabci-formatter --output-file stylelint_junit.xml" # Run the linter npm run lint # Output file stylelint_junit.xml will contain JUnit XML results.
Debug
Known issues
gotchaThe formatter must be passed via --custom-formatter, not --formatter. Using --formatter will fail because the formatter is not built into stylelint.
fix
Use --custom-formatter ./node_modules/stylelint-gitlabci-formatter (or absolute path).
affects: all
gotchaThe package exports a function as default export, not an object with named properties. Importing { stylelintGitlabciFormatter } will result in undefined.
fix
Use default import or require: const formatter = require('stylelint-gitlabci-formatter') or import formatter from 'stylelint-gitlabci-formatter'.
affects: >=1.0.0
gotchaThe output file path must be specified via --output-file, not --output. The option --output does not exist in stylelint and will cause an error.
fix
Replace --output with --output-file.
affects: all
Errors
Common errors & fixes
Unknown option: --output Run 'stylelint --help' for usage.
Trying to use --output instead of --output-file.
fix
Use --output-file <filename> to specify the output file.
Cannot find module 'stylelint-gitlabci-formatter'
The module is not installed or the path is incorrect.
fix
Ensure you have run `npm install stylelint-gitlabci-formatter --save-dev` and that the path in --custom-formatter is correct (e.g., `./node_modules/stylelint-gitlabci-formatter`).
TypeError: formatter is not a function
Attempting to use a named import instead of default import for the formatter.
fix
Use default import: `import formatter from 'stylelint-gitlabci-formatter'` or `const formatter = require('stylelint-gitlabci-formatter')`.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
stylelintrequiredpeer dependency required to run the formatter; stylelint is the linting tool that generates results to format.
Agent activity
6 hits · last 30 days
node
6
Resources
stylelint-gitlabci-formatter — npm install stylelint-gitlabci-formatter · libregistry