vue vscode 保存时自动验证eslint规则格式化代码

19 篇文章 0 订阅
3 篇文章 0 订阅

在vscode setting.json中添加如下配置

希望大家快乐开发,另外vscode的git扩展功能也是不错的哦,改天再给大家分享

 "eslint.autoFixOnSave": true,
"eslint.validate": [
        "javascript",
        "javascriptreact",
        {
        "language": "html",
        "autoFix": true
        },
        {
        "language": "vue",
        "autoFix": true
        }
    ],
    "eslint.options": {
    //这里为你项目中配置的.eslintrc.js文件,这样保存时效验的规则就和项目一致了,只需轻轻一按  ctrl+s  完美格式化,麻麻再也不用担心我的格式了
        "configFile": "E:/sixi-pro/DJL/OA/OAUI3/.eslintrc.js"
    }

旧版的如果失效的话报错信息为

The setting is deprecated. Use editor.codeActionsOnSave instead with a source.fixAll.eslint member.

可更新配置为

{
  "editor.tabSize": 2,
  "editor.detectIndentation": false,
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "vetur.validation.template": false,
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "auto"
    },
    "prettyhtml": {
      "printWidth": 120,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    }
  },
  "html.format.wrapAttributes": "auto",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "files.autoSave": "afterDelay",
  "gitlens.advanced.messages": {
    "suppressCommitHasNoPreviousCommitWarning": false,
    "suppressCommitNotFoundWarning": false,
    "suppressFileNotUnderSourceControlWarning": false,
    "suppressGitVersionWarning": false,
    "suppressLineUncommittedWarning": false,
    "suppressNoRepositoryWarning": false,
    "suppressResultsExplorerNotice": false,
    "suppressShowKeyBindingsNotice": true
  },
  "git.confirmSync": false,
  "git.enableSmartCommit": true,
  "gitlens.historyExplorer.enabled": true,
  "files.autoSaveDelay": 3000,
  "workbench.startupEditor": "newUntitledFile",
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "dark-plus-syntax",
  "terminal.integrated.rendererType": "dom",
  "search.followSymlinks": false,
  "explorer.confirmDelete": false,
  "gitlens.views.fileHistory.enabled": true,
  "gitlens.views.lineHistory.enabled": true,
  "backgroundCover.imagePath": "c:\\Users\\ifugle\\Downloads\\img\\e649343cf9e7267c89c0b7d3a5e9024e.jpg",
  "backgroundCover.randomImageFolder": "c:\\Users\\ifugle\\Downloads\\img",
  "backgroundCover.opacity": 0.6,
  "backgroundCover.autoStatus": true,
  "sync.autoDownload": true,
  "sync.autoUpload": true,
  "sync.forceDownload": false,
  "sync.forceUpload": false,
  "sync.quietSync": true,
  "sync.gist": "f70df4488ac2ee79373df2e6e18bb70d",
  "diffEditor.ignoreTrimWhitespace": true,
  "files.associations": {
    "*.cjson": "jsonc",
    "*.wxss": "css",
    "*.wxs": "javascript"
  },
  "emmet.includeLanguages": {
    "wxml": "html"
  },
  "minapp-vscode.disableAutoConfig": true,
}

完整的配置文件请移步这里

https://blog.csdn.net/qq_39517820/article/details/81253961

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晴天有点孤单

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值