@putout/printer 18.29.0 → 18.30.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
CHANGED
|
@@ -36,10 +36,8 @@ export const printTrailingCommentLine = (path, printer, semantics, {isSameLine,
|
|
|
36
36
|
|
|
37
37
|
if (isSameLine)
|
|
38
38
|
print.space();
|
|
39
|
-
else if (!isNext(path) || isNextNotSimple(path))
|
|
40
|
-
print.breakline();
|
|
41
39
|
else
|
|
42
|
-
print.
|
|
40
|
+
print.breakline();
|
|
43
41
|
|
|
44
42
|
printComment();
|
|
45
43
|
|
|
@@ -54,9 +52,7 @@ const isSimple = createTypeChecker([
|
|
|
54
52
|
'+: node.expression -> BooleanLiteral',
|
|
55
53
|
]);
|
|
56
54
|
|
|
57
|
-
const
|
|
58
|
-
['+: -> !', callWithNext(isSimple)],
|
|
59
|
-
]);
|
|
55
|
+
export const isNextSimple = callWithNext(isSimple);
|
|
60
56
|
|
|
61
57
|
export const printLeadingCommentBlock = (path, printer, semantics, {printComment}) => {
|
|
62
58
|
const {indent} = printer;
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
printLeadingCommentBlock,
|
|
17
17
|
printTrailingCommentLine,
|
|
18
18
|
printTrailingCommentBlock,
|
|
19
|
+
isNextSimple,
|
|
19
20
|
} from './comments.js';
|
|
20
21
|
|
|
21
22
|
const {isIfStatement} = types;
|
|
@@ -29,7 +30,16 @@ const isNextToAssignmentCall = createTypeChecker([
|
|
|
29
30
|
['+', callWithNext(isCallInsideExpression)],
|
|
30
31
|
]);
|
|
31
32
|
|
|
33
|
+
const hasTrailingCommentOnTheSameLine = createTypeChecker([
|
|
34
|
+
['-: node.trailingComments.length -> -'],
|
|
35
|
+
['-: -> !', hasLeadingComment],
|
|
36
|
+
['+', isSameLine],
|
|
37
|
+
]);
|
|
38
|
+
|
|
32
39
|
const isBreakline = createTypeChecker([
|
|
40
|
+
['+: node.expression -> ArrayExpression'],
|
|
41
|
+
['-', callWithNext(hasTrailingCommentOnTheSameLine)],
|
|
42
|
+
['-', isNextSimple],
|
|
33
43
|
['+', isNewlineBetweenSiblings],
|
|
34
44
|
['+', callWithNext(isIfStatement)],
|
|
35
45
|
]);
|
|
@@ -97,4 +107,3 @@ export const ExpressionStatement = {
|
|
|
97
107
|
export const isNewlineAfter = createTypeChecker([
|
|
98
108
|
['+: -> !', hasTrailingComment],
|
|
99
109
|
]);
|
|
100
|
-
|
package/package.json
CHANGED