Closed clabough closed 2 years ago
Hey @clabough, thanks for suggesting!
It sounds like what you need would rather be a "codemod". A way to refactor code from an old pattern to a new one. With a codemod, you can do that at scale on your codebase. Also, it's quite specific to RxJS, so I would look with these keywords.
Here is an example I could find: https://github.com/sergi/rxjs-codemod
It seems to be an old one, but it's a good example of what you could craft yourself, if there is no such codemod already. It's using JS CodeShift, which is a great tool to do such scripts.
That being said, it's too specific to RxJS to be part of Abracadabra. Writing a dedicated codemod would be the best approach IMO.
Here is another example of a codemod for RxJS: https://gist.github.com/Timebutt/9ddf4b28b8ec986ab8cab7e79713ddf9
Please add the ability to refactor multiple subscribe arguments into one argument object. I have many existing observables using multiple arguments, but that has been deprecated. It would be very nice if there was an automated refactor for this conversion.
See https://rxjs.dev/deprecations/subscribe-arguments
Most often people just have this format in their code.
of([1,2,3]).subscribe((success) => {...}, (error) => {...} );
which would convert to
of([1,2,3]).subscribe({ next: (success) => {...}, error: (error) => {...}} );