daidodo/format-imports

Improve importType support (`import type` vs`import { type }`)

Open

#78 geöffnet am 29. Okt. 2025

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (4 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (51 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

VSCode auto-import does not reliably put import types in a separate import tag, ie. depending on what's pre-existing, it may do different style :

import type { A } from '.foo1'
import { type B } from '.foo2'
import { type C, bar } from '.foo3'
import { type D, type E, baz, qux } from '.foo4'

It would be great if format-imports could fix it by formatting them like this:

import type { A } from '.foo1'
import type { B } from '.foo2'
import type { C } from '.foo3'
import { bar } from '.foo3'
import type { D, E } from '.foo4'
import { baz, qux } from '.foo4'

For now, we have importType that will properly groups import type, but won't do anything when type is inside the bracket.

Thanks!

Contributor Guide