话不多说直接上配置:

    "editor.formatOnSave": true,
    "eslint.run": "onSave", // 点击保存自动修复
    "eslint.codeAction.showDocumentation": {
        "enable": true
    },
    "eslint.validate": [
        "javascript",
        "typescript",
        "javascriptreact",
        "typescriptreact",
        "html",
        "vue"
    ],
    "javascript.validate.enable": false,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    }

这一段放到vscode的setting中重启vscode即可ctrl+s自动格式化了

更多推荐