Require const declarations for variables that are never reassigned after declared
ProprietaryReplaces let with const for declarations whose bindings are never reassigned, e.g. let a = 3; becomes const a = 3;, including for-in/for-of loop variables and fully constant destructuring patterns. A top-level let in a file that is not a module is left unchanged, as other scripts may reassign it. Replicates the autofix of the ESLint rule prefer-const under its default options.
org. openrewrite. javascript. cleanup. PreferConstmod run . --recipe= org. openrewrite. javascript. cleanup. PreferConstInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.