@putout/printer 18.34.0 → 18.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +5 -0
- package/lib/tokenize/comments/comments-printer/comments-printer.js +8 -6
- package/lib/tokenize/expressions/assignment-expression/assignment-expression.js +3 -4
- package/lib/tokenize/maybe/maybe-parens.js +2 -1
- package/lib/tokenize/statements/expression-statement/comments.js +3 -2
- package/package.json +1 -1
- /package/lib/tokenize/expressions/assignment-expression/{assignment-expression-comments.js → comments.js} +0 -0
package/ChangeLog
CHANGED
|
@@ -96,11 +96,13 @@ export const printTrailingComments = (path, printer, semantics, {currentTraverse
|
|
|
96
96
|
continue;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
isCommentBlock(comment)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
if (isCommentBlock(comment))
|
|
100
|
+
printTrailingCommentBlock?.(path, printer, semantics, {
|
|
101
|
+
index,
|
|
102
|
+
printComment: createPrintCommentBlock(print, value),
|
|
103
|
+
isLast: index === n,
|
|
104
|
+
isSameLine: isSameLine(path, loc),
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
};
|
|
108
|
+
|
|
@@ -10,10 +10,12 @@ import {
|
|
|
10
10
|
maybeInsideReturnWithCommentEnd,
|
|
11
11
|
maybeInsideReturnWithCommentStart,
|
|
12
12
|
printLeadingCommentBlock,
|
|
13
|
-
} from './
|
|
13
|
+
} from './comments.js';
|
|
14
14
|
|
|
15
15
|
export const AssignmentExpression = maybeParens({
|
|
16
16
|
checkParens: false,
|
|
17
|
+
printLeadingCommentLine,
|
|
18
|
+
printLeadingCommentBlock,
|
|
17
19
|
condition,
|
|
18
20
|
print(path, printer) {
|
|
19
21
|
const {print} = printer;
|
|
@@ -35,6 +37,3 @@ export const AssignmentExpression = maybeParens({
|
|
|
35
37
|
maybeInsideReturnWithCommentEnd(path, printer);
|
|
36
38
|
},
|
|
37
39
|
});
|
|
38
|
-
|
|
39
|
-
AssignmentExpression.printLeadingCommentLine = printLeadingCommentLine;
|
|
40
|
-
AssignmentExpression.printLeadingCommentBlock = printLeadingCommentBlock;
|
|
@@ -20,8 +20,9 @@ const maybeParensPrint = (print) => ({
|
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const maybeParensCondition = ({print, condition, checkParens = true}) => ({
|
|
23
|
+
const maybeParensCondition = ({print, condition, checkParens = true, ...rest}) => ({
|
|
24
24
|
...maybeParensPrint(print),
|
|
25
|
+
...rest,
|
|
25
26
|
condition: (path, print, semantics) => {
|
|
26
27
|
const is = condition?.(path, print, semantics);
|
|
27
28
|
|
|
@@ -67,11 +67,12 @@ export const printLeadingCommentBlock = (path, printer, semantics, {printComment
|
|
|
67
67
|
printComment();
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const printTrailingCommentBlock = (path, printer, semantics, {printComment}) => {
|
|
71
|
-
const {print} = printer;
|
|
70
|
+
export const printTrailingCommentBlock = (path, printer, semantics, {printComment, isSameLine}) => {
|
|
71
|
+
const {maybe, print} = printer;
|
|
72
72
|
|
|
73
73
|
if (isNext(path))
|
|
74
74
|
print.breakline();
|
|
75
75
|
|
|
76
|
+
maybe.print.space(isSameLine);
|
|
76
77
|
printComment();
|
|
77
78
|
};
|
package/package.json
CHANGED
|
File without changes
|