Disallow unnecessary calls to .bind()

Proprietary

Removes the .bind(...) suffix from arrow functions (whose this can never be rebound) and from function expressions whose body does not reference this. The call is only removed when it has exactly one non-spread, side-effect-free argument and no comments would be lost. Replicates the autofix of the ESLint rule no-extra-bind under its default options.

org.openrewrite.javascript.cleanup.NoExtraBind
mod run . --recipe=org.openrewrite.javascript.cleanup.NoExtraBind

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.