[Need help] Use Prettier 3 with stylelint
See original GitHub issueCan someone show me how it works or how should I install it? To be honest, I donāt understand the documentation or I miss something. It drives me crazy š
Steps that i did:
- Installed VSCode
- Installed Prettier Vs Code plugin
- Opened simply project with couple files (html, css)
- Installed stylelint with
npm install --save-dev stylelint
- Installed stylelint-prettier with
npm install --save-dev stylelint-prettier prettier
- Created .stylelintrc with content:
{
"plugins": ["stylelint-prettier"],
"rules": {
"prettier/prettier": true,
"comment-empty-line-before": "always",
}
}
And what now? Prettier in VSCode didnāt fix anything in css files Or maybe I do it completely wrong? I donāt understand this
Sorry, i know, itās repository, not a help page, but please help me if you can
Iām working on Windows 10 machine
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to integrate Prettier with ESLint and stylelint
Install prettier-eslint, which is a tool that formats your JavaScript using Prettier followed by eslint --fix . The --fix is an ESLint featureĀ ......
Read more >Integrating with Linters - Prettier
Most stylistic rules are unnecessary when using Prettier, but worse ā they might conflict with Prettier! Use Prettier for code formatting concerns, and...
Read more >How to use VSCode Prettier 3 formatting with stylelint
Installed VSCode; Installed Prettier plugin; Opened simply project with couple files (html, css); Installed stylelint with npm install --save-Ā ...
Read more >stylelint-config-prettier - npm
stylelint -config-prettier is shipped with a little CLI tool to help you check if your configuration contains any rules that are in conflict...
Read more >prettier-stylelint | Yarn - Package Manager
prettier -stylelint attempts to create a prettier config based on the stylelint config, then format with prettier followed by stylelint --fix.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For the sake of sanity and memorializing hours lost to this, some confusion about this is justified.
Additionally, like prettier-vscode, stylelint-prettier is a Prettier project and relatively active, while prettier-stylelint is independent and hasnāt been updated since September 2017. (I could quibble about the names too, Prettierās project name start with āstylelintā?)
All that aside, prettier-stylelint (the independent one) works as described.
Here is a simplified, working example. (vscode
1.40.2
, prettier-vscode3.11.0
, macOS10.15.1
)Note: You might need to reload the VS Code window to get this working.
package.json
Ugly input css
Resulting CSS after running Format Document (alt-shift-f):
As was mentioned above, you need to install
prettier-stylelint
.stylelint-prettier
is a completely different thing.