老师你好,Vetur在保存代码的时候自动添加了逗号分号报错怎么办?

来源:4-5 ColumnList 组件编码

coderwm

2021-08-13

图片描述

下面是Vetur的配置文件:

{
    "[c]": {},
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "code-runner.clearPreviousOutput": true,
    "emmet.includeLanguages": {
        "wxml": "html"
    },
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.fontLigatures": false, 
    "editor.mouseWheelZoom": true,
    "java.configuration.checkProjectSettingsExclusions": false,
    "java.semanticHighlighting.enabled": true,
    "cssrem.rootFontSize": 33,
    "C_Cpp.updateChannel": "Insiders",
    "files.associations": {
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript"
    },
    "minapp-vscode.disableAutoConfig": true,
    "workbench.colorTheme": "One Dark Pro Flat",
    "editor.tabSize": 2,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    },
    "workbench.iconTheme": "vscode-great-icons",
    "liveServer.settings.donotShowInfoMsg": true,
    "javascript.validate.enable": false,
    "liveServer.settings.CustomBrowser": "chrome",
    "vetur.validation.template": false,
    "vetur.completion.scaffoldSnippetSources": {

        "workspace": "💼",
        "user": "🗒️",
        "vetur": "✌"
    },
    "vetur.experimental.templateInterpolationService": true,
    "editor.codeActionsOnSave": {},
    "vetur.format.defaultFormatterOptions": {

        "js-beautify-html": {
            "wrap_attributes": "force-expand-multiline"
        },
        "prettyhtml": {
            "printWidth": 100,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
}
写回答

1回答

张轩

2021-08-14

同学你好 这是因为设置了 prettier 自动格式化代码,但是 prettier 和 eslint 格式冲突所造成的。可以这样取消下 prettier 的配置

将 以下这些都删除掉就好了
    "editor.codeActionsOnSave": {},
    "vetur.format.defaultFormatterOptions": {

        "js-beautify-html": {
            "wrap_attributes": "force-expand-multiline"
        },
        "prettyhtml": {
            "printWidth": 100,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }


0
1
coderwm
老师,感谢你的回复,按照你说的方法进行了操作。但是自动保存还是有分号。 我从网上找几个解决方案试了一下。加上下面两条配置。再自动保存的时候就没有分号了。 "vetur.format.defaultFormatter.ts": "vscode-typescript", "vetur.format.defaultFormatter.js": "vscode-typescript"
2021-08-14
共1条回复

Vue3 + TS 仿知乎专栏企业级项目

带你完成前后端分离复杂项目,率先掌握 vue3 造轮子技能

3142 学习 · 2313 问题

查看课程