您可以在github上检查这个问题的答案,我早些时候在那儿做了票:
https://github.com/prettier/prettier-vscode/issues/1051
我现在有了在VSCode中使用stylelint的更好的解决方案:
我有一个更好的选择来使用stylelint,因为stylelint所有者已经创建了官方VSCode插件!
https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
该插件开箱即用几乎。您需要做的就是设置。您只能在VSCode中使用settings.json。小例子:
"stylelint.config": {
"rules": {
"at-rule-name-case": "lower","at-rule-name-space-after": "always-single-line","at-rule-semicolon-newline-after": "always",}
}
您是否需要立即可用的配置?
没问题-您必须检查一下
是否需要格式化选项(Shift + Alt + F)?
没问题。您可以为选项Fix all auto-fixable problems
定义键绑定。例如:
{
"key": "alt+shift+f","command": "stylelint.executeAutofix","when": "editorTextFocus && editorLangId == 'css'"
},{
"key": "alt+shift+f","when": "editorTextFocus && editorLangId == 'scss'"
},"when": "editorTextFocus && editorLangId == 'less'"
}
请记住,并非所有stylelint选项都可用于自动修复(但大多数都是)
本文链接:https://www.f2er.com/3110319.html