Require const declarations for variables that are never reassigned after declared

Proprietary

Replaces 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.PreferConst
mod run . --recipe=org.openrewrite.javascript.cleanup.PreferConst

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