vscode格式化不符合预期 Posted on 2021-02-03 | In IDE , vscode | 0 comments | Visitors: vscode 的 setting.json 1234567891011121314151617181920{ "workbench.colorTheme": "Dracula Soft", "editor.formatOnSave": true,//保存时使用VSCode 自身格式化程序格式化 "javascript.format.enable": false,//关闭编辑器对 js 文件的格式化,交给 ESLint 来做格式化,否则会格式化两次,解决editor.formatOnSave的兼容问题 "editor.codeActionsOnSave": { "source.fixAll": true, // For ESLint "source.fixAll.eslint": true, // For TSLint "source.fixAll.tslint": true, // For Stylelint "source.fixAll.stylelint": true }, "eslint.probe": [ "javascript", "javascriptreact", "typescript", "typescriptreact" ],} .editorconfig 12345678910111213# http://editorconfig.orgroot = true[*]indent_style = spaceindent_size = 2 # 用两个空格代替制表符;end_of_line = lf # win用cr lf,linux/unix用lf,mac用cr。统一window和maccharset = utf-8trim_trailing_whitespace = true# 在保存时删除尾部的空白字符;insert_final_newline = true# 在文件结尾添加一个空白行;max_line_length = 160# 每行代码最大宽度 160[*.md]trim_trailing_whitespace = false