Reputation: 1992
I'm tasked with cleaning our AngularJS project to remove unused imports and variables. I use VS Code and through TypeScript Hero extension I can do what I want to do one file at a time. However, is there a way to fix all typescript files in project?
Upvotes: 7
Views: 3516
Reputation: 4865
For visual studio code, you can simply open your preference settings and add the following to your settings.json
:
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
You can also enable/disable on save per language using following setting.json
:
"editor.formatOnSave": true,
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
This new feature has been released since April last year in 2018. Hopefully this can be helpful!
Upvotes: 7