bugsnag / depercolator

Tool for converting coffeescript to idiomatic javascript and JSX
99 stars 12 forks source link

Optionally pass other react codemods #12

Closed nickdima closed 7 years ago

nickdima commented 7 years ago

Since it already calls jscodeshift with the createElement codemod it could be nice to have the possibility of running other codemods as well. In my case I want to run the ES6 class codemod. What do you think? Should I try a PR for it or do you see it out of scope?

foxyblocks commented 7 years ago

I'm actually leaning toward swapping out jscodshift for a babel transform https://www.npmjs.com/package/babel-plugin-transform-react-createelement-to-jsx

I have a branch with it working here: https://github.com/bugsnag/depercolator/compare/tooling-changes-and-jest?expand=1

It would have some benefits like fixing #4. Also jscodeshift has the limitation of only being able to work on saved files which makes it harder to fit into the middle of toolchain. By using the babel transform it opens up some other opportunities such as being able to pipe code into and out of depercolator and into other cli tools if one were so inclined.

Another thing this branch does is use https://github.com/prettier/prettier-eslint which ideally will solve #11 (but I'm still testing this). Right now it just needs more testing before releasing it.

I would be willing to look at re-integrating jscodeshift but it might not be worth it. It may be better to keep that as a separate step, after depercolator has run.

nickdima commented 7 years ago

OK, sounds good. I'll keep an eye on the updates.