eslint常用配置

185 阅读1分钟

json配置规则:

// 当保存的时候,eslint自动帮我们修复错误
"editor.codeActionsOnSave": {
    "source.fixAll": true
  },
// 保存代码,不自动格式化
"editor.formatOnSave": true

vscode带的格式化工具需要全部禁用,setting配置

{
  "editor.fontSize": 20, //编辑器字体大小
  "workbench.iconTheme": "vscode-icons", //vscode文件图标主题
  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", //默认终端shell
  "editor.insertSpaces": false,
  "editor.lineNumbers": "on", //开启行数提示
  "editor.quickSuggestions": {
    //开启自动显示建议
    "other": true,
    "comments": true,
    "strings": true
  },
  "editor.tabSize": 2, //制表符符号eslint
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "settingsSync.ignoredExtensions": [],
  "path-intellisense.mappings": {
    "@": "${workspaceRoot}/src"
  },
  "git.enableSmartCommit": true,
  "vsicons.dontShowNewVersionMessage": true,
  "window.zoomLevel": 2,
  "workbench.editor.untitled.hint": "hidden",
}

以上仅作参考。