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[]`)

 

 

posted @ 2020-06-29 09:40  跟着阿笨一起玩.NET  阅读(2453)  评论(0编辑  收藏  举报