Skip to content

Commit 41a29c6

Browse files
committed
[jsx-wrap-multilines] Fix tests. Check conditions by default
1 parent dc729fa commit 41a29c6

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

docs/rules/jsx-wrap-multilines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Wrapping multiline JSX in parentheses can improve readability and/or convenience
66

77
## Rule Details
88

9-
This rule optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, all the syntax listed below will be checked except the conditional expressions, logical expressions and JSX attributes, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
9+
This rule optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, all the syntax listed below will be checked except the logical expressions and JSX attributes, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
1010

1111
There are the possible syntax available:
1212

1313
* `declaration`
1414
* `assignment`
1515
* `return`
1616
* `arrow`
17-
* `condition` (not enabled by default)
17+
* `condition`
1818
* `logical` (not enabled by default)
1919
* `attr` (not enabled by default)
2020

lib/rules/jsx-wrap-multilines.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const DEFAULTS = {
1515
assignment: true,
1616
return: true,
1717
arrow: true,
18-
condition: false,
18+
condition: true,
1919
logical: false,
2020
attr: false
2121
};
@@ -119,11 +119,6 @@ module.exports = {
119119
if (!isEnabled('assignment')) {
120120
return;
121121
}
122-
if (node.right.type === 'ConditionalExpression') {
123-
check(node.right.consequent);
124-
check(node.right.alternate);
125-
return;
126-
}
127122
check(node.right);
128123
},
129124

tests/lib/rules/jsx-wrap-multilines.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,14 @@ ruleTester.run('jsx-wrap-multilines', rule, {
217217
code: DECLARATION_TERNARY_PAREN
218218
}, {
219219
code: DECLARATION_TERNARY_NO_PAREN,
220-
options: [{declaration: false}]
220+
options: [{condition: false}]
221221
}, {
222222
code: ASSIGNMENT_TERNARY_SINGLE_LINE
223223
}, {
224224
code: ASSIGNMENT_TERNARY_PAREN
225225
}, {
226226
code: ASSIGNMENT_TERNARY_NO_PAREN,
227-
options: [{assignment: false}]
227+
options: [{condition: false}]
228228
}, {
229229
code: DECLARATION_SINGLE_LINE
230230
}, {
@@ -252,10 +252,10 @@ ruleTester.run('jsx-wrap-multilines', rule, {
252252
}, {
253253
code: CONDITION_SINGLE_LINE
254254
}, {
255-
code: CONDITION_NO_PAREN
255+
code: CONDITION_NO_PAREN,
256+
options: [{condition: false}]
256257
}, {
257-
code: CONDITION_PAREN,
258-
options: [{condition: true}]
258+
code: CONDITION_PAREN
259259
}, {
260260
code: LOGICAL_SINGLE_LINE
261261
}, {
@@ -323,7 +323,6 @@ ruleTester.run('jsx-wrap-multilines', rule, {
323323
}, {
324324
code: CONDITION_NO_PAREN,
325325
output: CONDITION_PAREN,
326-
options: [{condition: true}],
327326
errors: [{message: 'Missing parentheses around multilines JSX'}]
328327
}, {
329328
code: LOGICAL_NO_PAREN,

0 commit comments

Comments
 (0)