Install Vetur and ESLint and restart VScode. 2. File > preferences > Settings > open Settings json and paste

{
    // vscode has the option to automatically set tabsize based on the file type enabled by default

    "editor.detectIndentation"false.// Reset tabsize

    "editor.tabSize"4.// # automatic formatting every time you save

    "editor.formatOnSave"true."eslint.validate": [

        "javascript"."javascriptreact"."html"."vue"].// # fix the code in ESLint format every time you save it

    "editor.codeActionsOnSave": {

        "source.fixAll.eslint"true

    },

    // # let Prettier use esLint's code format for validation

    "prettier.eslintIntegration"true.// # remove the semicolon at the end of the code

    "prettier.semi"false.// # use quotes instead of double quotes

    "prettier.singleQuote"true.// # add a space between the function (name) and the following parentheses

    "javascript.format.insertSpaceBeforeFunctionParenthesis"true.// let the js in vue be formatted according to the ts format that comes with the editor

    "vetur.format.defaultFormatter.js""vscode-typescript"."vetur.format.defaultFormatterOptions": {

        "js-beautify-html": {

            "wrap_attributes""force-aligned"

            // #vue component HTML code formatting style

        },

        "prettier": {

            // Format without semicolons

            "semi"false.// Format it into single quotes

            "singleQuote"true.// Format to remove trailing commas

            "trailingComma""none"}},"window.zoomLevel"0."explorer.confirmDelete"false."explorer.confirmDragAndDrop"false."editor.renderControlCharacters"true."editor.renderWhitespace""all"
}
Copy the code