reactjs / react-codemod

React codemod scripts
MIT License
4.2k stars 288 forks source link

Feature request: npx react-codemod ./path/to/local/codemod #282

Open threepointone opened 3 years ago

threepointone commented 3 years ago

The cli experience of react-codemod is quite nice, and has made running codemods on react codebases very pleasant/accessible. Occasionally this repo will get a request to add a new type of codemod (or I'll hear about it on twitter), and the suggestion is that they use jscodeshift directly for their requirements. Which is fine, but means they have to rediscover some of the cli args that we pass to jscodeshift by default, and other niceties.

My proposal is that we allow react-codemod to accept a local path alongside the known codemods. So running npx react-codemod ./path/to/local/codemod should "just work".

Submitting this RFC because it came to mind, not sure when I'll work on it myself; others are free to try it if they'd like, and I'd be happy to review a PR.