Require using arrow functions for callbacks
ProprietaryConverts function expressions passed as call arguments into arrow functions, keeping the parameter list and block body as written. For example, foo(function(a) { return a; }) becomes foo((a) => { return a; }), and foo(function() { return this.a; }.bind(this)) becomes foo(() => { return this.a; }). Callbacks that use this without .bind(this), arguments, new.target, or their own name recursively are left unchanged. Replicates the autofix of the ESLint rule prefer-arrow-callback under its default options.
org. openrewrite. javascript. cleanup. PreferArrowCallbackmod run . --recipe= org. openrewrite. javascript. cleanup. PreferArrowCallbackInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.