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"
   ],
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM