amatiasq / vsc-sort-imports

Sort ES6 imports automatically.
ISC License
58 stars 24 forks source link

sort imports removes flow type imports #25

Closed macrozone closed 4 years ago

macrozone commented 6 years ago

I have this piece of code:

/* @flow */
import { combineReducers } from 'redux'
import tracking, { type TrackingState } from './tracking'

after saving, sort-imports removes the type import like this:

/* @flow */
import { combineReducers } from 'redux'
import tracking, { TrackingState } from './tracking'
amatiasq commented 6 years ago

I wasn't aware of this flow special imports, totally blew my mind. I don't know how the parser is not plainly crashing for unexpected syntax.

This extension supports different parsers, we use it for typescript support. I don't have much time to research now but probably there is a parser that knows how to handle this.

This would be simple addition, PRs are always welcome.

perich commented 6 years ago

a workaround would be:

import type { TrackingState } from './tracking' //vsc-sort-imports can handle this just fine import tracking from './tracking'

or just consolidate all of your app's types in a single types.js file

amatiasq commented 4 years ago

Solution has been provided, closed due to inactivity