Skip to content

Commit b6ac636

Browse files
committed
Remove unused shouldBreak check
1 parent fd69335 commit b6ac636

1 file changed

Lines changed: 1 addition & 29 deletions

File tree

src/language-js/print/ternary-old.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import {
22
align,
3-
breakParent,
43
dedent,
54
group,
65
ifBreak,
76
indent,
87
line,
98
softline,
109
} from "../../document/index.js";
11-
import hasNewlineInRange from "../../utils/has-newline-in-range.js";
12-
import { locEnd, locStart } from "../loc.js";
1310
import {
14-
hasComment,
1511
isBinaryCastExpression,
1612
isCallExpression,
1713
isJsxElement,
1814
isMemberExpression,
1915
} from "../utils/index.js";
20-
import isBlockComment from "../utils/is-block-comment.js";
2116

2217
/**
2318
* @import {Doc} from "../../document/index.js"
@@ -323,31 +318,8 @@ function printTernaryOld(path, options, print) {
323318
);
324319
}
325320

326-
// We want a whole chain of ConditionalExpressions to all
327-
// break if any of them break. That means we should only group around the
328-
// outer-most ConditionalExpression.
329-
const shouldBreak = [
330-
consequentNodePropertyName,
331-
alternateNodePropertyName,
332-
...testNodePropertyNames,
333-
].some((property) =>
334-
hasComment(
335-
node[property],
336-
(comment) =>
337-
isBlockComment(comment) &&
338-
hasNewlineInRange(
339-
options.originalText,
340-
locStart(comment),
341-
locEnd(comment),
342-
),
343-
),
344-
);
345321
const maybeGroup = (doc) =>
346-
parent === firstNonConditionalParent
347-
? group(doc, { shouldBreak })
348-
: shouldBreak
349-
? [doc, breakParent]
350-
: doc;
322+
parent === firstNonConditionalParent ? group(doc) : doc;
351323

352324
// Break the closing paren to keep the chain right after it:
353325
// (a

0 commit comments

Comments
 (0)