VSCode配置Vue自动格式化ESlint格式


  1. 安装插件Vetur,ESlint。
  2. 打开用户设置setting.json,将下面内容复制粘贴。
{
   // tab 大小为2个空格
   "editor.tabSize"2,
   // 编辑器换行
   "editor.wordWrap""off",
   // 保存时格式化
   "editor.formatOnSave"true,
   // 开启 vscode 文件路径导航
   "breadcrumbs.enabled"true,
   // prettier 设置语句末尾不加分号
   "prettier.semi"false,
   // prettier 设置强制单引号
   "prettier.singleQuote"true,
   // 选择 vue 文件中 template 的格式化工具
   "vetur.format.defaultFormatter.html""js-beautify-html",
   // vetur 的自定义设置
   "vetur.format.defaultFormatterOptions": {
     "js-beautify-html": {
       "wrap_attributes""aligned-multiple"
    },
     "prettier": {
       "singleQuote"true,
       "semi"false,
       "printWidth"100,
       "wrapAttributes"false,
       "sortAttributes"false
    }
  }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM