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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
stylelint-prettier
✓ import 'stylelint-prettier' (in plugins array) or use extends: ['stylelint-prettier/recommended']
✗ const sp = require('stylelint-prettier') (not a Node module to require at runtime)
Configure in .stylelintrc; do not import in source code.
prettier/prettier
✓ "plugin": ["stylelint-prettier"] and "rules": { "prettier/prettier": true }
✗ {"rules": {"prettier/prettier": "error"}} (Stylelint uses true/false or severity options, not ESLint-style)
The rule is named 'prettier/prettier' and is enabled via the 'prettier/prettier' key.
stylelint-config-prettier
✓ npm install stylelint-config-prettier --save-dev; extends: [..., 'stylelint-config-prettier']
✗ Extending stylelint-config-prettier without also adding stylelint-prettier (conflicts won't be overridden)
Only needed if you use deprecated stylistic rules from Stylelint <16.
Configures stylelint-prettier with recommended preset and custom Prettier options (single quotes, 2-space tabs).
// .stylelintrc
{
"extends": ["stylelint-prettier/recommended"],
"rules": {
"prettier/prettier": [true, {
"singleQuote": true,
"tabWidth": 2
}]
}
}
Debug
Known issues
deprecatedstylelint-config-prettier is no longer needed for Stylelint v15+ because stylistic rules are deprecated and removed in v16.fixIf using Stylelint >=15, remove stylelint-config-prettier dependency and extends entry.
affects: >=15.0.0
breakingVersion 5.0.0 dropped support for Stylelint <16 and Prettier <3. Existing configs may break after upgrade.fixUpdate Prettier to >=3.0.0 and Stylelint to >=16.0.0. Remove any deprecated stylistic rules.
affects: >=5.0.0 <6.0.0
gotchaPassing options via Stylelint rule overrides .prettierrc for Prettier <1.7.0 but merges for newer versions.fixPrefer configuring in .prettierrc and avoid options in Stylelint config to ensure editor extensions consistency.
affects: >=1.7.0
gotchaThe rule name is 'prettier/prettier', not 'stylelint-prettier/prettier'.fixUse 'prettier/prettier' in the rules object of .stylelintrc.
affects: all
deprecatedStylelint v15 deprecated all stylistic rules that conflict with Prettier. The plugin may still work but expects those rules to be disabled.fixUpgrade to Stylelint v16 where those rules are removed. For v15, use stylelint-config-prettier to disable them.
affects: >=15.0.0 <16.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier'
Prettier is a peer dependency and is not installed automatically.
fixRun 'npm install --save-dev prettier' or ensure version >=3.0.0 is present.
Configuration for rule "prettier/prettier" is invalid: Value false should be an object or boolean.
Stylelint expects array or boolean, but string 'error' is ESLint-style.
fixChange to true or [true, {...}] in your .stylelintrc rules. Unknown rule: prettier/prettier
The plugin is not loaded in the 'plugins' array.
fixAdd 'stylelint-prettier' to the plugins array or extend 'stylelint-prettier/recommended'.
Parsing errors in your CSS file / unexpected token
Prettier cannot parse the file; either invalid CSS or unsupported syntax.
fixCheck the CSS file for syntax errors. Consider adding a .prettierignore for files that Prettier cannot parse.
Audit
Dependencies
prettierrequiredpeer dependency (>=3.0.0) – must be installed separately
stylelintrequiredpeer dependency (>=16.0.0) – must be installed separately