Skip to content

Commit

Permalink
Enable react/wrap-multilines eslint rule
Browse files Browse the repository at this point in the history
Multiline jsx literals in a return should be paren-wrapped.
  • Loading branch information
bgw committed Jun 4, 2015
1 parent 17a1577 commit 99a28f2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ rules:
react/self-closing-comp: 2
# We don't care to do this
react/sort-comp: 0
#react/wrap-multilines: 2
react/wrap-multilines: [2, {declaration: false, assignment: false}]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"envify": "^3.0.0",
"es5-shim": "^4.0.0",
"eslint": "^0.21.2",
"eslint-plugin-react": "^2.3.0",
"eslint-plugin-react": "^2.5.0",
"grunt": "~0.4.2",
"grunt-cli": "^0.1.13",
"grunt-compare-size": "~0.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,12 @@ describe('ReactCompositeComponent', function() {

var Component = React.createClass({
render: function() {
return <div>
<Inner />
Text
</div>;
return (
<div>
<Inner />
Text
</div>
);
},
});
var Inner = React.createClass({
Expand Down Expand Up @@ -774,15 +776,19 @@ describe('ReactCompositeComponent', function() {
var Component = React.createClass({
render: function() {
if (this.props.flipped) {
return <div>
<Static ref="static0" key="B">B (ignored)</Static>
<Static ref="static1" key="A">A (ignored)</Static>
</div>;
return (
<div>
<Static ref="static0" key="B">B (ignored)</Static>
<Static ref="static1" key="A">A (ignored)</Static>
</div>
);
} else {
return <div>
<Static ref="static0" key="A">A</Static>
<Static ref="static1" key="B">B</Static>
</div>;
return (
<div>
<Static ref="static0" key="A">A</Static>
<Static ref="static1" key="B">B</Static>
</div>
);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ describe('ReactCompositeComponentNestedState-state', function() {

render: function() {
this.props.logger('parent-render', this.state.color);
return <ChildComponent
logger={this.props.logger}
color={this.state.color}
onSelectColor={this.handleColor}
/>;
return (
<ChildComponent
logger={this.props.logger}
color={this.state.color}
onSelectColor={this.handleColor}
/>
);
},
});

Expand All @@ -66,20 +68,22 @@ describe('ReactCompositeComponentNestedState-state', function() {

render: function() {
this.props.logger('render', this.state.hue, this.props.color);
return <div>
<button onClick={this.handleHue.bind(this, 'dark', 'blue')}>
Dark Blue
</button>
<button onClick={this.handleHue.bind(this, 'light', 'blue')}>
Light Blue
</button>
<button onClick={this.handleHue.bind(this, 'dark', 'green')}>
Dark Green
</button>
<button onClick={this.handleHue.bind(this, 'light', 'green')}>
Light Green
</button>
</div>;
return (
<div>
<button onClick={this.handleHue.bind(this, 'dark', 'blue')}>
Dark Blue
</button>
<button onClick={this.handleHue.bind(this, 'light', 'blue')}>
Light Blue
</button>
<button onClick={this.handleHue.bind(this, 'dark', 'green')}>
Dark Green
</button>
<button onClick={this.handleHue.bind(this, 'light', 'green')}>
Light Green
</button>
</div>
);
},
});

Expand Down
16 changes: 10 additions & 6 deletions src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,11 @@ describe('ReactUpdates', function() {
},
render: function() {
if (this.state.s === 0) {
return <div>
<span>0</span>
</div>;
return (
<div>
<span>0</span>
</div>
);
} else {
return <div>1</div>;
}
Expand All @@ -691,9 +693,11 @@ describe('ReactUpdates', function() {

var Y = React.createClass({
render: function() {
return <div>
<Z />
</div>;
return (
<div>
<Z />
</div>
);
},
});

Expand Down

0 comments on commit 99a28f2

Please sign in to comment.