Galooshi / atom-import-js

Atom plugin for ImportJS
MIT License
36 stars 3 forks source link

Doesn't work with ES6 rest spread operators #9

Closed lupewalken closed 7 years ago

lupewalken commented 7 years ago

Doesn't work on files where I use destructuring assignment operators. Throws a parse error when I do "fix imports".

example code let { name, surname, ...other } = this.props;

trotzig commented 7 years ago

Thanks for the report. I have a fix coming up. In the meantime, can you check if you are using any other es7 syntax that we should support? I want to avoid adding ones that aren't necessary (they might slow things down).

https://github.com/babel/babylon#plugins

We might want to switch to reading .babelrc, but I'm unsure of the complexities involved with doing that.

trotzig commented 7 years ago

I ended up adding two more plugins that I think made sense: decorators & classProperties.

trotzig commented 7 years ago

I just pushed version 0.4.3 with this fix. Will you update and verify that things are working?

lencioni commented 7 years ago

Decorators and class properties proposals have not yet hit stage 3. We should probably make them opt-in.

On Tue, Jan 3, 2017, 4:53 AM Henric Trotzig notifications@github.com wrote:

I just pushed version 0.4.3 with this fix. Will you update and verify that things are working?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Galooshi/atom-import-js/issues/9#issuecomment-270108198, or mute the thread https://github.com/notifications/unsubscribe-auth/AAL7zr3z1LhDLDCESPxaW86iq9A_KoK5ks5rOkTKgaJpZM4LZhwn .

trotzig commented 7 years ago

I can't see any harm allowing them to be parsed though, can you? 🙂

lupewalken commented 7 years ago

Many thanks for quick fix! I don't use any other es7 syntax, but this one is a very useful one when working with React props etc.

(tested and works perfect..)