← All recipes
Moderne licensed

Use object property shorthand

Recipe IDorg.openrewrite.javascript.cleanup.use-object-property-shorthandArtifact@openrewrite/rewrite

Simplifies object properties where the property name and value/variable name are the same (e.g., { x: x } becomes { x }). Applies to both destructuring patterns and object literals.

Single recipeMSAL

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.javascript.cleanup.use-object-property-shorthand

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/rewrite