Vscode保存代碼自動按照ESlint規範保存

  • 首先在打開VScode在應用商店下載 ESlint應用
    在這裏插入圖片描述
  • 第二步 打開設置 找到setting文件
    在這裏插入圖片描述
  • 第三步 清空setting文件中原有的配置,將如下配置粘貼進去,保存。
{
    "workbench.colorTheme": "Atom One Dark",
    "sync.gist": "8626d23745117be1a468437821b8485a",
    "sync.removeExtensions": false,
    "files.autoSaveDelay": 5000,
    "editor.tabSize": 2,
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.renderWhitespace": "all",
    "editor.foldingStrategy": "indentation",
    "eslint.autoFixOnSave": true,
    "editor.mouseWheelZoom": true,
    "editor.renderControlCharacters": true,
    "editor.parameterHints.cycle": true,
    "editor.smoothScrolling": true,
    "editor.tabCompletion": "onlySnippets",
    "editor.cursorSmoothCaretAnimation": true,
    "editor.formatOnPaste": true,
    "editor.formatOnSave": false,
    "editor.formatOnType": true,
    "editor.quickSuggestions": {
        "strings": true
    },
    "files.autoGuessEncoding": true,
    "workbench.list.multiSelectModifier": "alt",
    "workbench.iconTheme": "vscode-icons",
    "workbench.view.alwaysShowHeaderActions": true,
    "workbench.editor.labelFormat": "short",
    "workbench.settings.openDefaultKeybindings": true,
    "zenMode.restore": true,
    "window.restoreFullscreen": true,
    "window.openFilesInNewWindow": "on",
    "window.openFoldersInNewWindow": "on",
    "search.smartCase": true,
    "files.associations": {
        "*.vue": "vue"
    },
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_line_length": 120,
            "wrap_attributes": "auto",
            "end_with_newline": false
        },
        "prettyhtml": {
            "printWidth": 300,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "search.showLineNumbers": true,
    "eslint.options": {
        "extensions": [
            ".js",
            ".vue"
        ]
    },
    "eslint.validate": [
        // "javascript",
        {
            "language": "vue",
            "autoFix": true
        },
        "html",
        "vue"
    ],
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "update.enableWindowsBackgroundUpdates": false,
    "emmet.syntaxProfiles": {
        "javascript": "jsx",
        "vue": "html",
        "vue-html": "html"
    },
    "workbench.list.horizontalScrolling": true,
    "sync.forceDownload": true,
    "git.confirmSync": false,
    "local-history.treeLocation": "localHistory",
    "local-history.absolute": true,
    "workbench.sideBar.location": "left",
    "window.zoomLevel": 0,
    "editor.renderIndentGuides": false,
    "gitlens.gitCommands.closeOnFocusOut": true,
    "terminal.integrated.rendererType": "dom",
    "vsicons.dontShowNewVersionMessage": true,
    "git.autofetch": true,
    "prettier.semi": false,
    "prettier.singleQuote": true,
    "prettier.jsxBracketSameLine": true,
    "prettier.jsxSingleQuote": true,
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "editor.fontSize": 18,
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章