Disallow unnecessary computed property keys in objects and classes

Proprietary

Removes the square brackets around computed property keys that are plain string or number literals, keeping the literal's raw text verbatim. For example, { ['x']: 0 } becomes { 'x': 0 }. Semantically meaningful computed keys such as ['__proto__'] on object properties and ['constructor']/['prototype'] on class members are left unchanged. Replicates the autofix of the ESLint rule no-useless-computed-key under its default options.

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

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