Require destructuring from arrays and/or objects

Proprietary

Rewrites variable declarations that copy a property into a same-named variable to use object destructuring, e.g. const foo = object.foo; becomes const {foo} = object;. Replicates the autofix of the ESLint rule prefer-destructuring under its default options.

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

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