Upgrade ECMAScript 5 to ECMAScript 6
ProprietaryUpgrades ECMAScript 5 code to ECMAScript 6 syntax: let/const instead of var, object literal shorthand, arrow function callbacks, template literals, modern octal literals and escape sequences, and no redundant 'use strict' in ES modules. Only changes code where the conversion keeps its semantics, so some var declarations and function expressions may stay. Vendored, bundled and build-output files are left unchanged.
org. openrewrite. javascript. migrate. es6. ModernizeToES6mod run . --recipe= org. openrewrite. javascript. migrate. es6. ModernizeToES6Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Require
letorconstinstead ofvar - Require
constdeclarations for variables that are never reassigned after declared - Require object literal shorthand syntax
- Require using arrow functions for callbacks
- Modernize octal literals
- Modernize octal escape sequences
- Require template literals instead of string concatenation
- Remove redundant
'use strict'directives from ES modules