Registry / devops / prettier-stylelint-formatter

prettier-stylelint-formatter

JSON →
library0.5.1-beta.2jsnpmunverified

A tool that formats CSS/SCSS/Less style files by running Prettier then stylelint --fix in sequence. It auto-generates a Prettier config from a stylelint config and disables conflicting rules. Stable version 0.5.1-beta.2 is a pre-release fork of prettier-stylelint by hugomrdias. It provides both a CLI and API, supports glob patterns, stdin, and respects .gitignore/.prettierignore. Compared to alternatives like prettier-eslint, this package focuses on style files (CSS, SCSS, Less, SSS) and integrates with stylelint.

npm install prettier-stylelint-formatter
INSTALL
IMPORT
SIG · PRETTIER-STYLELINT
P
prettier-stylelint-formatter
devopsjavascriptv0.5.1-beta.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

format
const format = require('prettier-stylelint-formatter')
import format from 'prettier-stylelint-formatter'
The package is CommonJS-only; named export 'format' via module.exports.
PrettierStylelintFormatter (default import type)
import prettierStylelint from 'prettier-stylelint-formatter'
TypeScript users: no @types package; default import is the format function.
CLI usage
npx prettier-stylelint --write "**/*.css"
prettier-stylelint --fix
There is no --fix flag; use --write to edit files in place.

Demonstrates basic usage of the format API to lint and fix a CSS string, and the CLI command to process files.

// Install: npm install prettier-stylelint-formatter --save-dev // API example const format = require('prettier-stylelint-formatter'); const sourceCode = 'a[id="foo"] { content: "x"; }'; const options = { text: sourceCode, // Optional: specify a stylelint config file path // config: '/path/to/.stylelintrc' }; const formatted = format(options); console.log(formatted); // Output: a[id='foo'] { // content: 'x'; // } // CLI: npx prettier-stylelint --write "src/**/*.css"
prettier-stylelint-formatter --version
Debug
Known issues
breakingVersion 0.5.1-beta.2 is a beta release; API and CLI may have breaking changes before stable release.
fix
Pin to a specific version or wait for stable release.
affects: 0.5.1-beta.*
deprecatedThe package is a fork of the deprecated prettier-stylelint; the original is no longer maintained.
fix
Consider using stylelint-prettier or prettier-stylelint-recommended instead.
affects: >=0.5.0
gotchaThe CLI --write flag overwrites files in place; it is recommended to commit changes before running.
fix
Always run `git commit` before using --write, or use --stdin with output redirection.
affects: >=0.5.0
gotchaThe config merge logic may not respect all stylelint config structures (e.g., plugins, processors).
fix
Manually validate the merged config by running stylelint separately.
affects: >=0.5.0
Errors
Common errors & fixes
Cannot find module 'prettier-stylelint-formatter'
Package is not installed or not in node_modules.
fix
Run `npm install prettier-stylelint-formatter --save-dev` or `yarn add prettier-stylelint-formatter -D`.
TypeError: format is not a function
Using ES import syntax on a CommonJS module with a default export that is the function.
fix
Use require: `const format = require('prettier-stylelint-formatter')`.
SyntaxError: Unexpected token '?'
The package may use optional chaining not supported in older Node.js versions.
fix
Upgrade Node.js to >=14.0.0 or use a transpiler.
Upgrade
Version history
0.5.1-beta.2latest on npm
Audit
Dependencies
prettierrequiredCore formatting engine
stylelintrequiredLinting and fixing after Prettier
prettier-stylelintrequiredForked package providing mergeConfigs logic
Agent activity
19 hits · last 30 days
node
18
Amazon
1
Resources
prettier-stylelint-formatter — npm install prettier-stylelint-formatter · libregistry