You can check the answer to this problem on github, where I made a ticket some time ago:
https://github.com/prettier/prettier-vscode/issues/1051
I now have a better solution for using stylelint in VSCode:
I have a better option to use the stylelint, because the stylelint owner have created the official VSCode plugin!
https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
The plugin works almost out of the box. What you need to do is set up. You can use just settings.json in VSCode. Small example:
"stylelint.config": {
"rules": {
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-semicolon-newline-after": "always",
}
}
Do you need a ready-to-use configuration?
No problem - you have to check this
Do you need Formatting option (Shift + Alt + F)?
No problem. You can define keybinding for option Fix all auto-fixable problems
. For example:
{
"key": "alt+shift+f",
"command": "stylelint.executeAutofix",
"when": "editorTextFocus && editorLangId == 'css'"
},
{
"key": "alt+shift+f",
"command": "stylelint.executeAutofix",
"when": "editorTextFocus && editorLangId == 'scss'"
},
{
"key": "alt+shift+f",
"command": "stylelint.executeAutofix",
"when": "editorTextFocus && editorLangId == 'less'"
}
Remember that not all stylelint options are available for autofixing (but most are)
.css
and not.scss
and I couldn't understand the stylelint docs. – Padgett