Skip to content

Commit 3c2dece

Browse files
committed
chore: fix failing tests
1 parent 0dac159 commit 3c2dece

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rules/jsx-no-leaked-render.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNod
6767
return `${getIsCoerceValidNestedLogicalExpression(node) ? '' : '!!'}${nodeText}`;
6868
}).join(' && ');
6969

70-
if (rightNode.parent.type === 'ConditionalExpression' && rightNode.parent.consequent.value === false) {
70+
if (rightNode.parent && rightNode.parent.type === 'ConditionalExpression' && rightNode.parent.consequent.value === false) {
7171
const consequentVal = rightNode.parent.consequent.raw || rightNode.parent.consequent.name;
7272
const alternateVal = rightNode.parent.alternate.raw || rightNode.parent.alternate.name;
73-
if (rightNode.parent.test.type === 'LogicalExpression') {
73+
if (rightNode.parent.test && rightNode.parent.test.type === 'LogicalExpression') {
7474
return fixer.replaceText(reportedNode, `${newText} ? ${consequentVal} : ${alternateVal}`);
7575
}
7676
return fixer.replaceText(reportedNode, `${newText} && ${rightNode.parent.alternate.name}`);

0 commit comments

Comments
 (0)