Disallow else blocks after return statements in if statements
ProprietaryRemoves the unnecessary else when every branch of the preceding if/else if chain ends in a return, unwrapping the else body into the enclosing statement list. For example, if (x) { return y; } else { return z; } becomes if (x) { return y; } return z;. Replicates the autofix of the ESLint rule no-else-return under its default options.
org. openrewrite. javascript. cleanup. NoElseReturnmod run . --recipe= org. openrewrite. javascript. cleanup. NoElseReturnInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.