vscode设置保存⾃动格式化vue代码配置 ESLint (需安装 Prettier - Code formatter 插件)
command + shift + p  打开⽤户设置
// vscode默认启⽤了根据⽂件类型⾃动设置tabsize的选项
"editor.detectIndentation": false,
// 重新设定tabsize
"editor.tabSize": 2,
// #每次保存的时候⾃动格式化
"editor.formatOnSave": true,
// #每次保存的时候将代码按eslint格式进⾏修复
"eslint.autoFixOnSave": true,
// 添加 vue ⽀持
"eslint.validate": [
"javascript",
"javascriptreact",html文件格式化
{
"language": "vue",
"autoFix": true
}
],
//  #让prettier使⽤eslint的代码格式进⾏校验
"prettier.eslintIntegration": true,
//  #去掉代码结尾的分号
"prettier.semi": false,
//  #使⽤带引号替代双引号
"prettier.singleQuote": true,
//  #让函数(名)和后⾯的括号之间加个空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
// #这个按⽤户⾃⾝习惯选择
"vetur.format.defaultFormatter.html": "js-beautify-html",
// #让vue中的js按编辑器⾃带的ts格式进⾏格式化
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-aligned"
// #vue组件中html代码格式化样式
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。