#12

Remove Unused Imports with TypeScript and VSCode

2019-08-23

TAGS: vscodetypescriptjavascript

When refactoring I'll typically remove some code and have some unused imports sitting at the top of my files. Going in and sniping out each faded word isn't the best use of time, so let's let our IDE take care of it.

VSCode has an Organize Imports feature that allows you to clean up your code with a keystroke.

option+Shift+O for Mac

Alt + Shift + O for Windows

Not only that, but it reorganizes the imports alphabetically, leaving you with clean code that your whole team can agree on.

I'd love to see this kind of thing roped into Prettier so that my code gets cleaned up all in one fell swoop.


Learned this after a search and StackOverflow result.