1. Set the global settings.json file

Command + p searches for settings.json. The configuration and comments are as follows

"workbench.iconTheme": "vscode-icons-mac", "editor.renderIndentGuides": false, "cSpell.ignoreWords": ["antd"], // Editor automatically saves updated file "files.autoSave": "onFocusChange", "workbench.colorTheme": "Monokai", "git.confirmsync ": false, "window.title": "${activeEditorLong}${separator}${rootName}", "window.zoomLevel": 0, "editor.fontSize": 14, // to comply with eslint's two-space rule "editor.tabSize": 2, // fileheader comment "fileheader.author ": "Niuchunling", "fileheader. LastModifiedBy" : "niuchunling", / / close the editor default code inspection, in order not to conflict with eslint configuration "editor. FormatOnSave" : False, "javascript.format.enable": false, //eslint formatting plugin, save "eslint. AutoFixOnSave "after automatic formatting using esLint rules: True, "prettier. EslintIntegration" : true, / / remove code ending semicolon "prettier. Semi" : false, "git. Path" : "/usr/bin/git", "editor.fontFamily": "Microsoft YaHei, Menlo, Monaco, 'Courier New', Monospace ", "editor.fontWeight": "bold", "javascript.updateImportsOnFileMove.enabled": "never", "explorer.confirmDragAndDrop": false }Copy the code

2. Set your own rules for the project

Create a.vscode folder in the project root directory and create settings.json in the folder to overwrite the global setings.json file

Tips: All of this is based on several premises

  • Prettier-code Formatter plug-in installed and enabled in the editor
  • The project is configured to use ESLint
  • Fileheader is configured with the Document This plugin installed