-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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.gitAnd 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
IDEthat haseslintextensions - 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` optionBy the way, async-await-codemod is in the list of recommended jscodeshift codemods that is recommended to be used with putout π.