Require let or const instead of var

Proprietary

Replaces var declarations with let when the conversion provably preserves semantics, leaving unsafe cases (redeclarations, uses outside the would-be block scope, uses before declaration, closure captures in loops, top-level var in files that are not modules, and similar) unchanged. Replicates the autofix of the ESLint rule no-var under its default options.

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

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