Remove whitespace generation (#5833)

* Remove whitespace generation and rely on default printing

Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines

* Fix a few more fixtures
This commit is contained in:
Daniel Tschinder
2017-06-27 19:57:02 -07:00
committed by Brian Ng
parent bc29145465
commit b3372a572d
379 changed files with 1974 additions and 1109 deletions

View File

@@ -13,4 +13,5 @@ export default class App extends React.Component {
render() {
return _ref2;
}
}
}

View File

@@ -7,6 +7,7 @@ var _ref3 = <p>Parent</p>;
render() {
return _ref;
}
}
const AppItem = () => {

View File

@@ -16,5 +16,6 @@ var _ref3 = <p>Parent</p>;
render() {
return _ref2;
}
}
});
});

View File

@@ -2,6 +2,7 @@ export default class App extends React.Component {
render() {
return _ref;
}
}
var _ref2 = <div>child</div>;

View File

@@ -3,11 +3,10 @@ function _asyncToGenerator(fn) { return function () { return new Promise((resolv
export default {
function(name) {
return _asyncToGenerator(function* () {
const uppercasedName = name.upperCase();
// awaits depending on uppercasedName go here
const uppercasedName = name.upperCase(); // awaits depending on uppercasedName go here
return <Foo name={uppercasedName} />;
})();
}
};

View File

@@ -1,6 +1,4 @@
import React from 'react';
// Regression test for https://github.com/babel/babel/issues/5552
import React from 'react'; // Regression test for https://github.com/babel/babel/issues/5552
var _ref = <div />;
@@ -8,9 +6,13 @@ class BugReport extends React.Component {
constructor(...args) {
var _temp;
return _temp = super(...args), this.thisWontWork = ({ color }) => data => {
return _temp = super(...args), this.thisWontWork = ({
color
}) => data => {
return <div color={color}>does not reference data</div>;
}, this.thisWorks = ({ color }) => data => {
}, this.thisWorks = ({
color
}) => data => {
return <div color={color}>{data}</div>;
}, _temp;
}
@@ -18,4 +20,5 @@ class BugReport extends React.Component {
render() {
return _ref;
}
}

View File

@@ -10,4 +10,5 @@ class AnchorLink extends Component {
return <Link>{children}</Link>;
}
}
}

View File

@@ -11,6 +11,7 @@ var _ref2 = <div className="child">
</div>;
let Child = () => _ref2;
Child = HOC(Child);
var _ref = <div className="parent">

View File

@@ -1,11 +1,9 @@
function render(flag) {
if (flag) {
var bar = "bar";
[].map(() => bar);
return <foo bar={bar} />;
}
return null;
}
}

View File

@@ -1,7 +1,6 @@
function fn(Component, obj) {
var data = obj.data,
_ref = <Component prop={data} />;
return () => _ref;
}
}

View File

@@ -1,5 +1,7 @@
// https://github.com/facebook/react/issues/3226
// Not safe to reuse because it is mutable
function render() {
return <div style={{ width: 100 }} />;
}
return <div style={{
width: 100
}} />;
}

View File

@@ -2,6 +2,7 @@ class A {
render() {
return _ref;
}
}
export default class B {}

View File

@@ -2,6 +2,7 @@ class A {
render() {
return _ref;
}
}
export class B {}

View File

@@ -1,7 +1,6 @@
function fn(Component) {
var data = "prop",
_ref = <Component prop={data} />;
return () => _ref;
}
}