GitXplorerGitXplorer
s

react-reboot

public
62 stars
7 forks
1 issues

Commits

List of commits on branch master.
Verified
980bf2fc05eb310f5bfc7d530cd48659b7dc098f

Update README.md

sslorber committed 6 years ago
Verified
e7b7c7415bcf068732e8fed3c05937c6d1302579

Update README.md

sslorber committed 6 years ago
Unverified
dc363cecca9d8c427bc1a56d87148de6f194987c

display contributors

sslorber committed 7 years ago
Unverified
04da22c24ce2c101503278a68aaf4fad51a0c493

display contributors

sslorber committed 7 years ago
Unverified
08b07995992b2843eff7fabf8e4a8778b684b2e1

display contributors

sslorber committed 7 years ago
Unverified
582a1d6f382b1fada8f7b2607e40a15549d4f785

Add @slorber as a contributor

sslorber committed 7 years ago

README

The README file for this repository.

react-reboot

All Contributors

Not maintained

The online playground is put offline due to low project traction and paid hosting. Many people have already migrated to modern ES6 syntax so this is not so useful anymore.

Intro

The easiest way to refresh your React components with up-to-date syntax.

The Playground is available to transform your react components online.

This is for now a very basic and unflexible MVP, so don't be angry if it does not work well and come back later :)

Coming soon: Node API and CLI

Before

var React = require('react');
var PureRenderMixin = require("react-addons-pure-render-mixin");

var HelloWorld = React.createClass({
  mixins: [PureRenderMixin],
  propTypes: {
    input: React.PropTypes.string.isRequired,
    bool: React.PropTypes.bool.isRequired
  },
  handleClick:    function(arg) {
    console.debug("debug " + arg,React.findDOMNode(this));
  },
  render() {
    var x = 2, y = 3, z = (!!x ? true : false);
    var {hey, ...rest} = {hey: "hello"}
    let newVar = Object.assign({hey},{x,y},rest);
    var myString = "[" + newVar.hey + newVar.x + "]" + " ---- " + someFn();
    debugger;
    return (
      <div
        onClick={this.handleClick}
        onMouseDown={function(e) {
          console.debug("test");
        }.bind(this)}
      >
        {myString}
      </div>
    )
  },
});

After

import PropTypes from "prop-types";
import React from "react";
import ReactDOM from "react-dom";

class HelloWorld extends React.PureComponent {
  static propTypes = {
    input: PropTypes.string.isRequired,
    bool: PropTypes.bool.isRequired,
  };

  handleClick = arg => {
    console.debug(`debug ${arg}`, ReactDOM.findDOMNode(this));
  };

  render() {
    const x = 2;
    const y = 3;
    const z = !!x;
    const { hey, ...rest } = { hey: "hello" };
    const newVar = {
      hey,
      x,
      y,
      ...rest,
    };
    const myString = `[${newVar.hey}${newVar.x}] ---- ${someFn()}`;

    return (
      <div
        onClick={this.handleClick}
        onMouseDown={e => {
          console.debug("test");
        }}
      >
        {myString}
      </div>
    );
  }
}

How it works

It simply runs in a row these 4 tools in a Node server, with an opiniated default configuration:

  • JSCodeshift codemods
  • ESLint rules with --fix
  • Babel transforms (coming soon!)
  • Prettier --write

Problems

  • Currently, no single tool solve every transform problem, and setting up and integrating all the available tools together is time consuming.

  • Not all transforms available are bugfree, and figuring out which to run in which order

  • Some teams might prefer to update components gradually to avoid git conflicts. This tool focus on transforming completely files one by one, while other tools like JSCodeShift runner are focusing on running transforms one by one efficiently against a very large codebase like Facebook.

TODO

  • Better error handling in case of unparsable input
  • Diplay transform log in playground
  • Support other parsers (Flow...)
  • Fine-tune transformation rules and order
  • Publish Node API and CLI (without embedding codemods? licensing problem)
  • Provide options (api + playground)
  • Tests
  • Help me :)

Dev

Works with these versions:

  "engines": {
    "node": ">=6.9.0",
    "npm": ">=3.10.10",
    "yarn": ">=1.2.1"
  },

Run local website / playground:

yarn install
yarn dev

Contributors

Thanks to all project contributors (all-contributors specification)


Sébastien Lorber

💻

Sutterlity Laurent

💻

Contributions of any kind welcome!

Thanks to Babel, Jscodeshift, ESlint, Prettier, and Carbon for some design/layout/code inspiration.

Hire a freelance expert

Looking for a React/ReactNative freelance expert with more than 5 years production experience? Contact me from my website or with Twitter.