xxxxxxxxxx
The above method should remove all the empty line however, if it didn’t then follow these steps:
Open your code in Visual Studio Code
From Edit Menu, select Replace or use a short cut key (command + Option + F on Mac or Ctrl + H on Windows)
In the find box type ^(\s)*$\n
Leave the replace box empty
Make sure the 'Use Regular Expression' is selected
Select 'Replace All' button
ref: https://www.trainingdragon.co.uk/blog/how-to-remove-empty-lines-in-visual-studio-code