Upgrade ECMAScript 5 to ECMAScript 6

Proprietary

Upgrades 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.ModernizeToES6
mod run . --recipe=org.openrewrite.javascript.migrate.es6.ModernizeToES6

Install 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.

  1. Require let or const instead of var
  2. Require const declarations for variables that are never reassigned after declared
  3. Require object literal shorthand syntax
  4. Require using arrow functions for callbacks
  5. Modernize octal literals
  6. Modernize octal escape sequences
  7. Require template literals instead of string concatenation
  8. Remove redundant 'use strict' directives from ES modules