vscode配置eslint自動(dòng)格式化

{
    "workbench.editor.enablePreview": false, //打開(kāi)文件不覆蓋
    "search.followSymlinks": false, //關(guān)閉rg.exe進(jìn)程
    "editor.minimap.enabled": false, //關(guān)閉快速預(yù)覽
    "liveServer.settings.donotShowInfoMsg": true, //關(guān)閉liveserver提示
    "files.autoSave": "afterDelay", //打開(kāi)自動(dòng)保存
    "editor.fontSize": 16, //設(shè)置文字大小
    "editor.lineHeight": 24, //設(shè)置文字行高
    "editor.lineNumbers": "on", //開(kāi)啟行數(shù)提示
    "editor.quickSuggestions": { //開(kāi)啟自動(dòng)顯示建議
        "other": true,
        "comments": true,
        "strings": true
    },
    "workbench.colorTheme": "Darcula Theme from IntelliJ", //指定工作臺(tái)中使用的顏色主題
    "window.zoomLevel": 0, // 調(diào)整窗口的縮放級(jí)別
    "editor.tabSize": 2, //制表符符號(hào)eslint
    "editor.formatOnSave": true, //每次保存自動(dòng)格式化
    "eslint.autoFixOnSave": true, // 每次保存的時(shí)候?qū)⒋a按eslint格式進(jìn)行修復(fù)
    "prettier.eslintIntegration": true, //讓prettier使用eslint的代碼格式進(jìn)行校驗(yàn)
    "prettier.semi": false, //去掉代碼結(jié)尾的分號(hào)
    "prettier.singleQuote": true, //使用帶引號(hào)替代雙引號(hào)
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //讓函數(shù)(名)和后面的括號(hào)之間加個(gè)空格
    "vetur.format.defaultFormatter.html": "js-beautify-html", //格式化.vue中html
    "vetur.format.defaultFormatter.js": "vscode-typescript", //讓vue中的js按編輯器自帶的ts格式進(jìn)行格式化
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned" //屬性強(qiáng)制折行對(duì)齊
        }
    },
    "eslint.validate": [ //開(kāi)啟對(duì).vue文件中錯(cuò)誤的檢查
        "javascript",
        "javascriptreact",
        {
            "language": "html",
            "autoFix": true
        },
        {
            "language": "vue",
            "autoFix": true
        }
    ],
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
}


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容