Hi, thank you, for such a useful codemod :).
I just added support of jscodeshift to a pluggable code transformer putout, and used your codemod for tests.
Putout does something similar to eslint but with more transforms, and it's better then jscodeshift because it supports plugins, and can be used in a day-to-day basis.
Your codemod can be integrated to any project with:
npm i https://github.com/sgilroy/async-await-codemod.git
And updating .putout.json with:
{
"jscodeshiftPlugins": [
"async-await-codemod/async-await"
]
}
(such a long path, because you don't use main entry of package.json)
Also user can provide custom message with help of such modifications of .putout.json:
{
"jscodeshiftPlugins": [
["async-await-codemod/async-await", "async-await should be used instead of Promises"]
]
}
And then just run putout lib test or putout lib test --fix for fixing.
async-await-codemod already works good, but would be great if you publish it to npm and add main section. And will be amazing if you convert your codemod to putout plugin 😉 (it will have ability to report problem parts, and to use a rich babel infrastructure).
Anyways even without converting your codemod already can be used with putout in more pleasant way then with jscodeshift, and here is why:
- no need to clone the whole repo
- integrating with eslint and all the
IDE that has eslint extensions
- ability to use in a day-to-day basis, as an addition to lint
Here is how it looks like for such code:
function promise() {
return hello().then(world);
}
$ putout jscodeshift.js
/home/coderaiser/putout/packages/putout/jscodeshift.js
2:0 error async-await should be used instead of Promises jscodeshift/async-await-codemod/async-await
✖ 1 errors in 1 files
fixable with the `--fix` option
By the way, async-await-codemod is in the list of recommended jscodeshift codemods that is recommended to be used with putout 🙂.
Hi, thank you, for such a useful codemod :).
I just added support of jscodeshift to a
pluggable code transformerputout, and used yourcodemodfor tests.Putoutdoes something similar toeslintbut with more transforms, and it's better thenjscodeshiftbecause it supports plugins, and can be used in a day-to-day basis.Your
codemodcan be integrated to any project with:And updating
.putout.jsonwith:{ "jscodeshiftPlugins": [ "async-await-codemod/async-await" ] }(such a long path, because you don't use
mainentry ofpackage.json)Also user can provide custom message with help of such modifications of
.putout.json:{ "jscodeshiftPlugins": [ ["async-await-codemod/async-await", "async-await should be used instead of Promises"] ] }And then just run
putout lib testorputout lib test --fixfor fixing.async-await-codemodalready works good, but would be great if you publish it tonpmand addmainsection. And will be amazing if you convert yourcodemodto putout plugin 😉 (it will have ability to report problem parts, and to use a rich babel infrastructure).Anyways even without converting your
codemodalready can be used withputoutin more pleasant way then withjscodeshift, and here is why:IDEthat haseslintextensionsHere is how it looks like for such code:
By the way,
async-await-codemodis in the list of recommendedjscodeshiftcodemods that is recommended to be used withputout🙂.