Skip to content

Commit 2fb1d37

Browse files
author
Yannick Croissant
committed
Fix jsx-indent on multiline ternary
1 parent e60921c commit 2fb1d37

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/rules/jsx-indent.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ module.exports = {
227227
// Use the parent in a list or an array
228228
if (prevToken.type === 'JSXText' || prevToken.type === 'Punctuator' && prevToken.value === ',') {
229229
prevToken = sourceCode.getNodeByRangeIndex(prevToken.start).parent;
230+
// Use the first non-punctuator token in a conditional expression
231+
} else if (prevToken.type === 'Punctuator' && prevToken.value === ':') {
232+
do {
233+
prevToken = sourceCode.getTokenBefore(prevToken);
234+
} while (prevToken.type === 'Punctuator');
230235
}
231236
var parentElementIndent = getNodeIndent(prevToken);
232237
var indent = (

0 commit comments

Comments
 (0)