Skip to content

Commit 2a37d8c

Browse files
committed
indent first line of branch with \t
1 parent a749734 commit 2a37d8c

File tree

2 files changed

+502
-503
lines changed

2 files changed

+502
-503
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function printTernaryOld(path, options, print) {
277277
/*
278278
This does not mean to indent, but make the doc aligned with the first character after `? ` or `: `,
279279
so we use `2` instead of `options.tabWidth` here.
280-
280+
281281
```js
282282
test
283283
? {
@@ -287,7 +287,7 @@ function printTernaryOld(path, options, print) {
287287
```
288288
289289
instead of
290-
290+
291291
```js
292292
test
293293
? {
@@ -300,15 +300,18 @@ function printTernaryOld(path, options, print) {
300300
options.useTabs
301301
? indent(print(nodePropertyName))
302302
: align(2, print(nodePropertyName));
303+
const fillTab = options.useTabs ? "\t" : " ";
303304
// normal mode
304305
const part = [
305306
line,
306-
"? ",
307+
"?",
308+
fillTab,
307309
consequentNode.type === node.type ? ifBreak("", "(") : "",
308310
printBranch(consequentNodePropertyName),
309311
consequentNode.type === node.type ? ifBreak("", ")") : "",
310312
line,
311-
": ",
313+
":",
314+
fillTab,
312315
printBranch(alternateNodePropertyName),
313316
];
314317
parts.push(

0 commit comments

Comments
 (0)