Revert "Ternary Operators in JSX Expression Containers (#4731)" (#4736)

This reverts commit 12046cd01b.
This commit is contained in:
Suchipi authored and GitHub committed 2018-06-22 10:32:38 -06:00
1 parent 12046cd01b
commit cb5e1db4a5
3 files changed
+1 -32

No files matched your search

+1 -2
View File
@@ -243,8 +243,7 @@ function formatTernaryOperator(path, options, print, operatorOptions) {
(operatorOpts.shouldCheckJsx && isJSXNode(n[operatorOpts.testNode])) ||
isJSXNode(n[operatorOpts.consequentNode]) ||
isJSXNode(n[operatorOpts.alternateNode]) ||
conditionalExpressionChainContainsJSX(lastConditionalParent) ||
firstNonConditionalParent.type === "JSXExpressionContainer"
conditionalExpressionChainContainsJSX(lastConditionalParent)
) {
jsxMode = true;
forceNoIndent = true;
@@ -240,16 +240,6 @@ cable ? (
)
) : null}
</div>;
// This ConditionalExpression prints in JSX mode because the first
// non-conditional parent is a JSX expression container.
<div>
{data.length > 1 ? (
"This is a really long non-jsx element inside of a ternary-operator that in turn is inside of a JSX expression container."
) : (
"This is string however, is not as long as the previous one."
)}
</div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// There are two ways to print ConditionalExpressions: "normal mode" and
// "JSX mode". This is normal mode (when breaking):
@@ -395,16 +385,6 @@ cable ? (
) : null}
</div>;
// This ConditionalExpression prints in JSX mode because the first
// non-conditional parent is a JSX expression container.
<div>
{data.length > 1 ? (
"This is a really long non-jsx element inside of a ternary-operator that in turn is inside of a JSX expression container."
) : (
"This is string however, is not as long as the previous one."
)}
</div>;
`;
exports[`expression.js 1`] = `
-10
View File
@@ -129,13 +129,3 @@ cable ? (
)
) : null}
</div>;
// This ConditionalExpression prints in JSX mode because the first
// non-conditional parent is a JSX expression container.
<div>
{data.length > 1 ? (
"This is a really long non-jsx element inside of a ternary-operator that in turn is inside of a JSX expression container."
) : (
"This is string however, is not as long as the previous one."
)}
</div>