Enable react/wrap-multilines eslint rule
Multiline jsx literals in a return should be paren-wrapped.
Benjamin Woodruff committed
Jun 2, 2015 at 10:43 UTC
c04a9e632ce85033945e3eef164911d332abf8d0
5 files changed
+53
-39
.eslintrc
+1
-1
@@ -93,7 +93,7 @@ rules:
93
react/self-closing-comp: 2
94
# We don't care to do this
95
react/sort-comp: 0
96
- #react/wrap-multilines: 2
96
+ react/wrap-multilines: [2, {declaration: false, assignment: false}]
97
98
# CUSTOM RULES
99
# the second argument of warning/invariant should be a literal string
package.json
+1
-1
@@ -40,7 +40,7 @@
40
"envify": "^3.0.0",
41
"es5-shim": "^4.0.0",
42
"eslint": "^0.21.2",
43
- "eslint-plugin-react": "^2.3.0",
43
+ "eslint-plugin-react": "^2.5.0",
44
"eslint-tester": "^0.7.0",
45
"grunt": "~0.4.2",
46
"grunt-cli": "^0.1.13",
src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+18
-12
@@ -429,10 +429,12 @@ describe('ReactCompositeComponent', function() {
429
430
var Component = React.createClass({
431
render: function() {
432
- return <div>
433
- <Inner />
434
- Text
435
- </div>;
432
+ return (
433
+ <div>
434
+ <Inner />
435
+ Text
436
+ </div>
437
+ );
438
},
439
});
440
var Inner = React.createClass({
@@ -774,15 +776,19 @@ describe('ReactCompositeComponent', function() {
776
var Component = React.createClass({
777
render: function() {
778
if (this.props.flipped) {
777
- return <div>
778
- <Static ref="static0" key="B">B (ignored)</Static>
779
- <Static ref="static1" key="A">A (ignored)</Static>
780
- </div>;
779
+ return (
780
+ <div>
781
+ <Static ref="static0" key="B">B (ignored)</Static>
782
+ <Static ref="static1" key="A">A (ignored)</Static>
783
+ </div>
784
+ );
785
} else {
782
- return <div>
783
- <Static ref="static0" key="A">A</Static>
784
- <Static ref="static1" key="B">B</Static>
785
- </div>;
786
+ return (
787
+ <div>
788
+ <Static ref="static0" key="A">A</Static>
789
+ <Static ref="static1" key="B">B</Static>
790
+ </div>
791
+ );
792
}
793
},
794
});
src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js
+23
-19
@@ -38,11 +38,13 @@ describe('ReactCompositeComponentNestedState-state', function() {
38
39
render: function() {
40
this.props.logger('parent-render', this.state.color);
41
- return <ChildComponent
42
- logger={this.props.logger}
43
- color={this.state.color}
44
- onSelectColor={this.handleColor}
45
- />;
41
+ return (
42
+ <ChildComponent
43
+ logger={this.props.logger}
44
+ color={this.state.color}
45
+ onSelectColor={this.handleColor}
46
+ />
47
+ );
48
},
49
});
50
@@ -66,20 +68,22 @@ describe('ReactCompositeComponentNestedState-state', function() {
68
69
render: function() {
70
this.props.logger('render', this.state.hue, this.props.color);
69
- return <div>
70
- <button onClick={this.handleHue.bind(this, 'dark', 'blue')}>
71
- Dark Blue
72
- </button>
73
- <button onClick={this.handleHue.bind(this, 'light', 'blue')}>
74
- Light Blue
75
- </button>
76
- <button onClick={this.handleHue.bind(this, 'dark', 'green')}>
77
- Dark Green
78
- </button>
79
- <button onClick={this.handleHue.bind(this, 'light', 'green')}>
80
- Light Green
81
- </button>
82
- </div>;
71
+ return (
72
+ <div>
73
+ <button onClick={this.handleHue.bind(this, 'dark', 'blue')}>
74
+ Dark Blue
75
+ </button>
76
+ <button onClick={this.handleHue.bind(this, 'light', 'blue')}>
77
+ Light Blue
78
+ </button>
79
+ <button onClick={this.handleHue.bind(this, 'dark', 'green')}>
80
+ Dark Green
81
+ </button>
82
+ <button onClick={this.handleHue.bind(this, 'light', 'green')}>
83
+ Light Green
84
+ </button>
85
+ </div>
86
+ );
87
},
88
});
89
src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
+10
-6
@@ -675,9 +675,11 @@ describe('ReactUpdates', function() {
675
},
676
render: function() {
677
if (this.state.s === 0) {
678
- return <div>
679
- <span>0</span>
680
- </div>;
678
+ return (
679
+ <div>
680
+ <span>0</span>
681
+ </div>
682
+ );
683
} else {
684
return <div>1</div>;
685
}
@@ -691,9 +693,11 @@ describe('ReactUpdates', function() {
693
694
var Y = React.createClass({
695
render: function() {
694
- return <div>
695
- <Z />
696
- </div>;
696
+ return (
697
+ <div>
698
+ <Z />
699
+ </div>
700
+ );
701
},
702
});
703