VS Code - automatically organize TypeScript imports

· Tech · No AI

VS Code has an option to remove any unused imports, sort existing imports by file paths, and sort named imports.

VS Code - automatically organize TypeScript imports

Open the settings (⇧⌘P or Ctrl+Shift+P), find Preferences: Configure Language Specific Settings... and then find the TypeScript. It will open the settings.json file. Now add the configuration.

"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[typescriptreact]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}

That’s all. Whenever you save the *.ts or *.tsx file, the VS Code will automatically organize imports.

uptime
8,215 days · since 2004
posts
294 · busiest 2026 (64)
words
~143,065 · ~10 h read
topics
tech 239 · personal 55
langs
en 229 · pl 65
written
211 by hand · 83 AI-assisted
projects
3
build
ca50768 · 2026-06-30