Open yodaiken opened 7 years ago
I think we should sort type
imports in their own group? Interesting tho that this happens, I don't think the underlying library accounts for this import style.
I think we put import type
statements directly after the matching normal import
statement.
that's also easier impl-wise, probably
what is the matching import? You only use import type
usually if you aren't actually importing from the module right?
Well, where the import would normally go.
Also, sometimes you do – if e.g. you only need something for typing, but not to actually use.
With flow, you have to use import type
to import anything exported as export type
-- regardless of normal import
s and and export
s.
By definition those are only for typing :p
anyone want to PR something to import-sort
? I think we we just want the parser package to expose the AST nodes as well as their other bits and we can do all the stuff we want on our end
fixed upstream, and if we want to add any special rules around type import sorting lets make a proposal in another issue yeah?
or maybe this was that issue :P
anyone with a special request here, i don't care how we sort them, the metadata is in the nodes to sort them, when need to adjust the style.
I just checked. This appears to be stable now.
Current behavior: Transforms:
into:
and:
into:
Expected behavior
Either always place
import type
after or before import of the module.(Will work on PR when I have some time.)