vscode 配置 eslint 自动格式化

1、安装插件 eslint

2、文件=》首选项=》设置 setting.json

"eslint.autoFixOnSave": true,
"eslint.options": {
    "extensions": [
        ".js",
        ".vue"
    ]
},
"eslint.validate": [
    "javascript",{
        "language": "vue",
        "autoFix": true
    },"html",
    "vue"
],

 

vue eslint 和vscode 配置eslint 自动保存 缩进冲突

项目根目录 新建文件 .editorconfig

配置

# See http://EditorConfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

vscode 配置(all)

{
  "window.zoomLevel": 0,
  // 编辑器字体加粗   
  "editor.fontWeight": "400",
  // 字体风格
  "editor.fontFamily": "'Menlo','Monaco','Courier New','monospace'",
  // 主题
  "workbench.colorTheme": "Atom One Dark",
  // 导航栏在左   
  "workbench.sideBar.location": "left",
  // 字体大小
  "editor.fontSize": 15,
  "git.ignoreLegacyWarning": true,
  "editor.detectIndentation": false,
  "editor.tabSize": 4,
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "eslint.alwaysShowStatus": true,
  "eslint.autoFixOnSave": true,
  "eslint.options": {
        "extensions": [
            ".js",
            ".vue"
        ]
   },
   "eslint.validate": [
        "javascript",{
            "language": "vue",
            "autoFix": true
        },"html",
        "vue"
   ],
}

 

posted @ 2019-07-15 11:20  riven.lcs  阅读(3627)  评论(0编辑  收藏  举报