Skip to content

JoeStanton/babel-transform-js-to-jsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS to JSX

I don't support/use this anymore! But I hope you find it useful.

Circle CI

Babel 6 plugin to convert from desugared React.DOM CallExpressions -> the equivalent JSX. Currently used to migrate to ES6+ from other compile to JS languages.

It can be used as a plugin:

require("babel-core").transform(code, {
  plugins: ["babel-transform-js-to-jsx", "syntax-jsx"],
}).code

Or from the command line for composition with other tools:

npm install babel-transform-js-to-jsx
cat example.ls | lsc -cb --no-header | js-to-jsx | esformatter -c format.json

###ES6

As this plugin aims to help upgrades to ES6, it also contains the following opt-in transforms:

  • Functions -> Arrow Functions, if this is not used.
  • CommonJS -> ES6 imports
  • Removal of React.createFactory

They can be used like this:

require("babel-core").transform(code, {
  plugins: [
    "babel-transform-js-to-jsx",
    "babel-transform-js-to-jsx/es6/modules",
    "babel-transform-js-to-jsx/es6/arrow-functions",
    "babel-transform-js-to-jsx/es6/remove-dom-shim",
    "babel-transform-js-to-jsx/es6/unhoist-variables",
    "syntax-jsx"
  ]
}).code

About

Babel your way to the future

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published