Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Remove Unused ImportsNew to Visual Studio Code? Get it now.
Remove Unused Imports

Remove Unused Imports

Kus Cámara

|
56,871 installs
| (3) | Free
Removes unused ES6 imports in JavaScript and TypeScript files without changing the order
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Remove Unused Imports

Description

VS Code extension to remove unused ES6 imports inside JavaScript and TypeScript files (.js, .jsx, .ts and .tsx extensions) without changing the current order, as opposed to the built-in VS Code "Organize Imports" functionality.

Remove Unused Imports screenshot

Usage

  • Open the Command Palette (Ctrl/Cmd + Shift + P)
  • Search for Remove Unused Imports

Run on save

The command can be executed every time a file is saved via Code Actions. To enable it, set source.removeUnusedImports to true inside editor.codeActionsOnSave in your VSCode settings:

"editor.codeActionsOnSave": {
  "source.removeUnusedImports": true
}

Preserve specified import identifiers

The extension also supports preserving specified import identifiers, even if they are not used. To enable it, set removeUnusedImports.preserve to an array of import identifiers in your VSCode settings:

"removeUnusedImports.preserve": ["React", "ReactDOM"]

Keybinding

This extension does not provide any keybinding for the command. You can assign your own custom keybinding for it by pressing the cog icon that appears to the right of the command name in the Command Palette.

Known issues

The format of the document may change after running this command. For instance, final semicolons are added to the modified imports.

Acknowledgments

This extension is inspired by vsc-sort-imports.

Support me

License

This project is licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft