在VSCode中配置Eslint格式化

在VSCode中配置Eslint 格式化时使代码保持Eslint语法规范

安装Eslint以及prettier美化插件

在VSCode配置设置项中添加如下代码

{
    "workbench.colorTheme": "Material Theme",
    "search.followSymlinks": false,
    "editor.fontSize": 18,
    "workbench.iconTheme": "material-icon-theme",
    "workbench.editor.enablePreview": false,
    "window.zoomLevel": 0,
    "extensions.autoUpdate": false,
    "prettier.singleQuote": true,
    "prettier.semi": false,
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    //配置eslint
    "eslint.autoFixOnSave": true,
    "files.autoSave":"off",
    "eslint.validate": [
       "javascript",
       "javascriptreact",
       "html",
       { "language": "vue", "autoFix": true }
     ],
     "eslint.options": {
        "plugins": ["html"]
     },
     //为了符合eslint的两个空格间隔原则
     "editor.tabSize": 2
}

原文地址:https://www.cnblogs.com/bbc66/p/10558264.html