@@ -26,6 +26,16 @@ const parserOptions = {
26
26
const MISSING_PARENS = 'Missing parentheses around multilines JSX' ;
27
27
const PARENS_NEW_LINES = 'Parentheses around JSX should be on separate lines' ;
28
28
29
+ const OPTIONS_ALL_NEW_LINES = {
30
+ declaration : 'parens-new-line' ,
31
+ assignment : 'parens-new-line' ,
32
+ return : 'parens-new-line' ,
33
+ arrow : 'parens-new-line' ,
34
+ condition : 'parens-new-line' ,
35
+ logical : 'parens-new-line' ,
36
+ prop : 'parens-new-line' ,
37
+ } ;
38
+
29
39
const RETURN_SINGLE_LINE = `
30
40
var Hello = createReactClass({
31
41
render: function() {
@@ -550,6 +560,19 @@ const ATTR_PAREN_NEW_LINE_AUTOFIX_FRAGMENT = `
550
560
</div>
551
561
` ;
552
562
563
+ const SFC_NO_PARENS_NO_NEWLINE = `
564
+ export default () =>
565
+ <div>
566
+ with newline without parentheses eslint crashes
567
+ </div>` ;
568
+
569
+ const SFC_NO_PARENS_AUTOFIX = `
570
+ export default () => (
571
+ <div>
572
+ with newline without parentheses eslint crashes
573
+ </div>
574
+ )` ;
575
+
553
576
function addNewLineSymbols ( code ) {
554
577
return code . replace ( / \( < / g, '(\n<' ) . replace ( / > \) / g, '>\n)' ) ;
555
578
}
@@ -1157,5 +1180,11 @@ ruleTester.run('jsx-wrap-multilines', rule, {
1157
1180
output : ATTR_PAREN_NEW_LINE_AUTOFIX_FRAGMENT ,
1158
1181
options : [ { prop : 'parens-new-line' } ] ,
1159
1182
errors : [ { message : MISSING_PARENS } ]
1183
+ } ,
1184
+ {
1185
+ code : SFC_NO_PARENS_NO_NEWLINE ,
1186
+ output : SFC_NO_PARENS_AUTOFIX ,
1187
+ options : [ OPTIONS_ALL_NEW_LINES ] ,
1188
+ errors : [ { message : MISSING_PARENS } ]
1160
1189
} ]
1161
1190
} ) ;
0 commit comments