1. vscode下载eslint插件
    vscode开发vue项目保存时自动执行lint进行修复

  2. vscode进行设置
    找到settings.json
    vscode开发vue项目保存时自动执行lint进行修复

在里面写入如下内容进行保存

{
        "eslint.autoFixOnSave": true,
        "eslint.validate": [
            "javascript",
            {
                "language": "vue",
                "autoFix": true
            },
            "html",
            "vue"
        ],
        "editor.codeActionsOnSave": {
            "source.fixAll.eslint": true
        }
}

这样,以后保存文件的时候会根据eslint配置的规则,自动修复一些不合规的代码,不用每次保存完手动运行yarn run link去修复了。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-08
  • 2021-09-24
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2021-12-26
相关资源
相似解决方案