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,
}
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值