Catalog npm
Back to packageRELEASE DETAILS

1.1.2

npm

5to6-codemod

A collection of codemods that allow you to transform your js code from ES5 to ES6.

Published20 Sept 2016
Direct dependencies4
Transitive dependenciesNot calculated

README

Current package documentation

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:

  • esprima
  • inputSourceMap
  • lineTerminator
  • quote
  • range
  • reuseWhitespace
  • sourceFileName
  • sourceMapName
  • sourceRoot
  • tabWidth
  • tolerant
  • trailingComma
  • useTabs
  • wrapColumn

Transforms

  • amd - Transforms AMD style modules to ES6 import/export
  • cjs - Transforms CommonJS style require() calls to ES6 import statements
    • This transformation accepts the following option flags:
      • hoist: Enables hoisting require statements to the top
  • no-strict - Removes "use strict" statements
  • exports - Move CommonJS style module.exports statements to ES6 export statements
  • named-export-generation - Adds named exports corresponding to default export object keys. Only valid for ES6 modules exporting an object as the default export.
  • let - Replace all var calls to use let
  • simple-arrow - Replace all function expressions with a body of a sole return statement into arrow functions

Known issues

  • Can't automagically figure out when you want to use import * as varName.
  • End-of-line comments also missing in many situations
  • simple-arrow loses comments in the function expression body

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
jscodeshift
Environment
{
  "local_name": "jscodeshift",
  "alias": false,
  "peer_metadata": null
}
^0.3.28runtime
recast
Environment
{
  "local_name": "recast",
  "alias": false,
  "peer_metadata": null
}
^0.11.14runtime
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^1.0.0development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^2.3.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "d3b3f8b613bef871fec55ae3ab110f5e206836eb",
  "tarball": "https://registry.npmjs.org/5to6-codemod/-/5to6-codemod-1.1.2.tgz",
  "integrity": "sha512-vM5BQxjeNjGZUzQmlJetWA3on3Q1tEiusRk+4C2mh80rfwrRI7fZI0ZDOoHBTz/V+w7H6xQdx/fGql3vMyzGXQ==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIDiiCXsHjyWK+YbrwYSbEZxdesLAoF2xqH14n24tuwhWAiEAxP2uxK9s7qEwyvh7pQYWo9M8NRrg2Aa8Qoq1tRnppCE="
    }
  ]
}

Repository

PENDING
5to6/codemod

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:40 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:da7cf9847d443e0c3977a6bfbecd00827c905680deed925b669b9be2c337d6c5

Other collected versions

1.8.01 Apr1.7.116 Jun1.6.022 May1.5.017 Mar1.4.08 Mar1.3.07 MarView all collected versions →