Disallow redundant return statements

Proprietary

Removes return; statements that are in tail position of a function's control flow, where removal cannot change runtime behavior. Returns with a value, returns inside loops or finally blocks, returns in unreachable code, and unbraced statement bodies (if (foo) return;) are left unchanged. Replicates the autofix of the ESLint rule no-useless-return under its default options.

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

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