vscode config 代码格式化功能完全交给 Prettier,ESLint 只负责 代码规范检查和自动修复(fix)

4 阅读1分钟
{
  // === Editor Settings ===
  "editor.detectIndentation": false,
  "editor.tabSize": 2,
  "editor.formatOnSave": true,  // 保存时格式化交给Prettier
  "editor.formatOnPaste": true,
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": true
  },
  "editor.suggestOnTriggerCharacters": true,
  "editor.parameterHints.enabled": true,
  "editor.inlineSuggest.triggerCommandOnProviderChange": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode", // 使用Prettier作为默认格式化器
  "editor.fontSize": 14,
  "editor.minimap.enabled": false,
  "editor.renderControlCharacters": true,
  "editor.linkedEditing": true,

  // === Prettier Settings ===
  "prettier.semi": false,
  "prettier.singleQuote": true,
  "prettier.tabWidth": 2,
  "prettier.jsxSingleQuote": true,
  "prettier.useTabs": true,
  "prettier.printWidth": 80,
  "prettier.trailingComma": "none",
  "prettier.bracketSpacing": true,
  "prettier.arrowParens": "avoid",

  // === ESLint Settings ===
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "eslint.codeActionsOnSave.mode": "all",
  "eslint.lintTask.enable": true,
  "eslint.alwaysShowStatus": true,
  // 保存时先用Prettier格式化,再用ESLint修复问题
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },

  // === File Associations ===
  "files.associations": {
    "*.cjson": "jsonc",
    "*.js": "javascriptreact"
  },

  // === Spell Checking ===
  "cSpell.userWords": [
    "appkey",
    "bookname",
    "ctmd",
    "ecahrts",
    "echarts",
    "imgs",
    "jiujue",
    "jiujueismmp",
    "vuex"
  ],
  "cSpell.ignoreWords": [],

  // === Git Settings ===
  "gitlens.views.remotes.branches.layout": "list",
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,

  // === Live Server Settings ===
  "liveServer.settings.donotShowInfoMsg": true,
  "liveServer.settings.donotVerifyTags": true,

  // === Window and Interface Settings ===
  "workbench.colorTheme": "GitHub Dark Colorblind (Beta)",
  "workbench.iconTheme": "vscode-great-icons",
  "workbench.startupEditor": "welcomePage",
  "window.commandCenter": false,
  "chat.commandCenter.enabled": false,

  // === Terminal Settings ===
  "terminal.integrated.defaultProfile.windows": "PowerShell",
  "application.shellEnvironmentResolutionTimeout": 60,

  // === Extensions Auto Update ===
  "extensions.autoUpdate": false,

  // === Bracket Colorization ===
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairs": true,
  "editor.bracketPairColorization.independentColorPoolPerBracketType": true,

  // === Miscellaneous ===
  "diffEditor.ignoreTrimWhitespace": false,
  "editor.accessibilitySupport": "off"
}