@putout/printer 1.109.1 → 1.111.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
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2023.05.24, v1.111.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- c806c40 @putout/printer: ExpressionStatement inside IfStatement consequent when alternate exists: add "\n"
|
|
5
|
+
|
|
6
|
+
2023.05.23, v1.110.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 347e957 @putout/printer: ForStatement: spaces
|
|
10
|
+
|
|
1
11
|
2023.05.23, v1.109.1
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -12,8 +12,18 @@ const {
|
|
|
12
12
|
isCoupleLines,
|
|
13
13
|
} = require('../is');
|
|
14
14
|
|
|
15
|
+
const isBeforeElse = (path) => {
|
|
16
|
+
if (!path.parentPath.isIfStatement())
|
|
17
|
+
return false;
|
|
18
|
+
|
|
19
|
+
if (path !== path.parentPath.get('consequent'))
|
|
20
|
+
return false;
|
|
21
|
+
|
|
22
|
+
return Boolean(path.parentPath.node.alternate);
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
const satisfyAfter = satisfy([
|
|
16
|
-
|
|
26
|
+
isNotLastOrParentLast,
|
|
17
27
|
isParentBlock,
|
|
18
28
|
isNext,
|
|
19
29
|
isNextUp,
|
|
@@ -44,6 +54,9 @@ module.exports.ExpressionStatement = {
|
|
|
44
54
|
if (hasTrailingComment(path) && isLast(path))
|
|
45
55
|
return true;
|
|
46
56
|
|
|
57
|
+
if (isBeforeElse(path))
|
|
58
|
+
return true;
|
|
59
|
+
|
|
47
60
|
return false;
|
|
48
61
|
},
|
|
49
62
|
after(path, {print, maybe, store}) {
|
|
@@ -70,8 +83,8 @@ function isNotLastBody(path) {
|
|
|
70
83
|
return path.parentPath.get('body') === path;
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
function
|
|
74
|
-
return
|
|
86
|
+
function isNotLastOrParentLast(path) {
|
|
87
|
+
return !(isLast(path) || isParentLast(path));
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
function isNextUp(path) {
|
|
@@ -13,18 +13,21 @@ module.exports.ForStatement = {
|
|
|
13
13
|
} = path.node;
|
|
14
14
|
|
|
15
15
|
indent();
|
|
16
|
-
print('for
|
|
16
|
+
print('for');
|
|
17
|
+
print.space();
|
|
18
|
+
print('(');
|
|
17
19
|
print('__init');
|
|
18
20
|
print(';');
|
|
19
|
-
maybe.print(test
|
|
21
|
+
maybe.print.space(test);
|
|
20
22
|
print('__test');
|
|
23
|
+
|
|
21
24
|
print(';');
|
|
22
|
-
maybe.print(update
|
|
25
|
+
maybe.print.space(update);
|
|
23
26
|
print('__update');
|
|
24
27
|
print(')');
|
|
25
28
|
|
|
26
29
|
if (body.body) {
|
|
27
|
-
print(
|
|
30
|
+
print.space();
|
|
28
31
|
print('__body');
|
|
29
32
|
} else {
|
|
30
33
|
const is = !path.get('body').isEmptyStatement();
|
package/package.json
CHANGED