5to6 / 5to6-codemod

A collection of codemods that allow you to transform your js code from ES5 to ES6.
https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb
302 stars 36 forks source link

Build Status GitHub version NPM version Downloads

5to6-codemod

A collection of codemods that allow you to transform your JavaScript code from ES5 to ES6 using jscodeshift.

Usage

  1. npm install -g jscodeshift
  2. npm install 5to6-codemod
  3. jscodeshift -t node_modules/5to6-codemod/transforms/[transform].js [files]
  4. Review changes via git diff. Keep what you want, throw it out if you don't. Magic!

Option flags

When executing codemods, you can configure options like so:

jscodeshift -t node_modules/5to6-codemod/transforms/[transform].js [files] --key=value

Recast options

Our transforms will automatically distinguish and pass through Recast config keys via jscodeshift. Official documentation for Recast's configuration can be found here. We currently support the following Recast keys:

Transforms

Known issues