This might help someone in future,
adding this in your settings.json
will fix the code as well as organises the imports on save.
{
//...
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
}