VSCode配置Eslint保存時候自動格式化


Vscode配置Eslint - wu小強 - 博客園 

https://www.cnblogs.com/cbpm-wuhq/p/12446880.html

方法一:

一:配置vue的校驗以及自動修補補全

1:全局安裝eslint

npm install -g eslint
2: 打開vscode 點擊 “文件”-----》“首選項”----》“設置”,在右側“用戶設置/settings.json”里加入一下配置:

 

 

{
    //eslint 代碼自動檢查相關配置
 
    "eslint.enable": true,
    "eslint.autoFixOnSave": true,
    "eslint.run": "onType",
    "eslint.options": {
        "extensions": [".js",".vue"]
    },
    "eslint.validate": [
        "javascriptreact",
        "vue",
        "javascript", {
            "language": "vue",
            "autoFix": true
        },
        "html", {
          "language": "html",
          "autoFix": true
        }
  ],
}

方法二:安裝插件: ESLint (with `autoFixOnSave: boolean | string[]`)

 

 


免責聲明!

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



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