Beautify on save in VS code?

Solution 1:

For Windows click on 'File' -> Preferences -> Settings. Then search for editor.formatOnSave, and put "true" instead of "false"

For Mac click on 'Code' (top left of screen, to the left of 'File', 'Edit', and 'View') -> Preferences -> Settings -> enter the term 'editor.formatOnSave' in the search settings box at the top of the page. Click on the tick to mark it as true.

enter image description here

Solution 2:

Go to file--> preferences --> settings

In search type formatter and in default formatter select : prettier code formatter as shown in below screenshot.

enter image description here

Solution 3:

I visited this question because my beautify was not working in VS code And Adding the above mentioned setting fixed my issue but if you want your beautify to solve linting issue as well then you gonna have to added the below setting along with the above like this : (Hope this helps anyone)

{
  "editor.formatOnSave": true,
  "tslint.autoFixOnSave": true
  }