Catalog npm
Back to packageRELEASE DETAILS

1.7.1

npm

5to6-codemod

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

Published16 Jun 2017
Direct dependencies5
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 5

Native requirements
5 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
jscodeshift
Environment
{
  "local_name": "jscodeshift",
  "alias": false,
  "peer_metadata": null
}
^0.3.28runtime
lodash
Environment
{
  "local_name": "lodash",
  "alias": false,
  "peer_metadata": null
}
^4.17.4runtime
recast
Environment
{
  "local_name": "recast",
  "alias": false,
  "peer_metadata": null
}
^0.12.1runtime
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
{
  "integrity": "sha512-Nako5nAiihHQbnto9sIfD8OD2NLCEeciQph5y3DxrhbNpzUCdidEDRp/9XoczYPEO0hroAK/oQrikOY64/sBzw==",
  "shasum": "61866c336f2c6ef5505eb9b7a12d825ef44aeb99",
  "tarball": "https://registry.npmjs.org/5to6-codemod/-/5to6-codemod-1.7.1.tgz",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIBGZ/6ufuYR/sjPd+pwrYe/SAbYCOR6IerXzoucxzZgsAiBc6z2HdAREoIxhtvUemrZ/hcpim27HPbwwvGPFpqPKeQ=="
    }
  ]
}

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:afa075e519f1c8916eb68994a7ea7be0bb86d1069ec0d8014b60a1adcc10509d

Other collected versions

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