关于visual-studio-code:vscode-配置eslint保存格式化样式

8次阅读

共计 1042 个字符,预计需要花费 3 分钟才能阅读完成。

1-vscode 中装置 eslint
2- 在 vue 我的项目中开启 esLint 检测,在 vue.config.js 文件中

  lintOnSave: true,

3- 上面是我 vscode 的配置文件 settings.json 文件

{
    // VScode 主题配置
    "editor.tabSize": 2,
    "eslint.autoFixOnSave": true, // 每次保留的时候将代码按 eslint 格局进行修复
    "editor.lineHeight": 24,
    "editor.renderLineHighlight": "none",
    "editor.renderWhitespace": "none",
    "editor.fontFamily": "Consolas",
    "editor.fontSize": 13,
    "editor.cursorBlinking": "smooth",
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnSave": true,
    "editor.quickSuggestions": {
        "other": true,
        "comments": true,
        "strings": false
    },
    "prettier.semi": true, // 去掉代码结尾的分号
    "prettier.singleQuote": false, // 应用单引号代替双引号
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 让函数 (名) 和前面的括号之间加个空格
    "vetur.format.defaultFormatter.html": "js-beautify-html", // 格式化.vue 中 html
    "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {"wrap_attributes": "force-aligned" // 属性强制折行对齐}
    },
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue",
    ],
    "editor.codeActionsOnSave": {"source.fixAll.eslint": true},
  "debug.console.fontSize": 14,
  "git.path": "F:/Program Files/Git/bin/git.exe",  //git 门路的配置
}


正文完
 0