Use default
Prettier vscode save code auto format plug-in used by vscode
select formatonsave in vscode settings or modify it in setting.json
"editor.formatOnSave": true,
Use eslint for automatic formatting
Sometimes your front-end project uses eslint, which has automatic formatting configuration. We want to use the project’s own eslint configuration. We can use the format of eslint when saving automatically.
Let’s install the eslint plug-in first
Then set it in vscode
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
Add this configuration. In this way, the eslint configuration of the project itself will be used when saving.