推荐
VS Code(1.22.1) + vetur + eslint + stylelint + prettier
安装
npm install -g vue-language-server
npm install -g stylelint
npm install -g eslint
npm install -g prettier prettier-eslint
配置
VS Code 配置
{
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
},
"eslint.autoFixOnSave": true,
"eslint.options": {
"extensions": [
".js",
".vue"
]
},
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"vue",
"vue-html",
{
"language": "vue",
"autoFix": true
},
{
"language": "html",
"autoFix": true
}
],
"stylelint.enable": true,
"css.validate": false,
"scss.validate": false,
"stylelint.additionalDocumentSelectors": [
"vue"
],
"vetur.format.styleInitialIndent": true,
"vetur.format.scriptInitialIndent": true,
"vetur.format.defaultFormatter.html": "js-beautify-html"
}
工程跟目录下配置
- .eslintrc.js
- .stylelintrc
- .prettierrc
截图
自带格式化之后:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。