In the file & gt; > > > Preferences Settings> > > > > Search for eslint
* in Settings. Json and add the following code to the outer braces.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"eslint.autoFixOnSave" : true,
},
After the file is saved, you can fix the code automatically.