In Visual Studio Code, how do you automatically format your source code when the file is saved?
Go to settings -> settings.json file and paste below code
{ "explorer.confirmDelete": false, "editor.formatOnSave": true, "terminal.integrated.rendererType": "dom" }
It will format your code on save.