主要是因为vscode lint规则与project lint规则不一致,保存的时候按A规则format,编辑、提交时又按B规则校验,规则不一致则来回format。
vslint lint规则主要是按语言特性如JavaScript、typescript来,项目中通常用eslint、prettier,所以将vscode 的formatter改成项目中使用的即可。
相关链接 stackoverflow.com/questions/3…
At the VS code ,press Ctrl+Shift+P then type Format Document With...
At the end of the list click on Configure Default Formatter...
Now you can choose your favorite beautifier from the list.