No need to add commands anymore. For those who are new to Visual Studio Code and searching for an easy way to format code on saving, kindly follow the below steps.
Open Settings by pressing [Cmd+,] in Mac or using the below screenshot.
Type 'format' in the search box and enable the option 'Format On Save'.