ember-codemods / ember-test-helpers-codemod

Codemod to transform your Ember tests to use @ember/test-helpers
MIT License
29 stars 14 forks source link

TypeScript support #27

Closed chriskrycho closed 5 years ago

chriskrycho commented 6 years ago

It would be awesome if this operated on TypeScript! (Read: I'm about to start hacking on it, I just wanted this here in case someone else had the idea and was wondering about the status of it.)

simonihmig commented 6 years ago

@chriskrycho absolutely, would love that!

Idk if there is so much to do here, I guess the difficult part is to make jscodeshift correctly parse (and emit) TS? See...

chriskrycho commented 6 years ago

Actually, @rwjblue already did all the hard work, and recast latest supports it. I may ping you on something I got stuck on, but making progress.

rwjblue commented 6 years ago

Should be able to do:

let parser = require('recast/parsers/typescript');
let j = api.jscodeshift.withParser(parser);

In places like:

https://github.com/simonihmig/ember-test-helpers-codemod/blob/dd2d75bcde0964345df1d1866cbd107a659ca99b/lib/transforms/find.js#L14

rwjblue commented 6 years ago

But I really would like to find the time to migrate this repo to codemod-cli (assuming @simonihmig is ok with that), which exposes a getParser() helper method and manages the recast / @babel/parser / jscodeshift deps with the right versions...

simonihmig commented 6 years ago

But I really would like to find the time to migrate this repo to codemod-cli

I could give this a try as well. @rwjblue I guess https://github.com/rwjblue/ember-qunit-codemod/pull/114/files would be a good starting point to see what's needed?

rwjblue commented 6 years ago

Ya, that was the roadmap I was gonna follow...

simonihmig commented 6 years ago

Here we go: #28

simonihmig commented 6 years ago

@chriskrycho I merged #28, hope that does not give you too many merge conflicts (in case you already forked). Feel free to ping me if I can be of any help!

chriskrycho commented 6 years ago

I'll just test that – from what I saw of codemod-cli, I literally won't have anything else to do! 😍