@putout/printer 1.92.1 → 1.92.3
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 +10 -0
- package/lib/tokenize/expressions/object-expression.js +3 -2
- package/lib/tokenize/statements/export-declaration/export-declaration.js +1 -1
- package/lib/tokenize/statements/switch-statement.js +5 -3
- package/lib/tokenize/statements/variable-declaration.js +4 -3
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2023.05.11, v1.92.3
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 4518b45 @putout/printer: statements: SwitchStatement: add support of fall
|
|
5
|
+
|
|
6
|
+
2023.05.10, v1.92.2
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- e2f6ca0 @putout/printer: VariableDeclaration: couple VariableDeclarators without init
|
|
10
|
+
|
|
1
11
|
2023.05.10, v1.92.1
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -29,7 +29,9 @@ module.exports.ObjectExpression = (path, {print, maybe, indent, write}) => {
|
|
|
29
29
|
|
|
30
30
|
maybe.print(parens, '(');
|
|
31
31
|
print('{');
|
|
32
|
-
parseComments(path, {
|
|
32
|
+
parseComments(path, {
|
|
33
|
+
write,
|
|
34
|
+
});
|
|
33
35
|
maybe.print.newline(manyLines);
|
|
34
36
|
|
|
35
37
|
for (const property of properties) {
|
|
@@ -138,4 +140,3 @@ function isParens(path) {
|
|
|
138
140
|
|
|
139
141
|
return false;
|
|
140
142
|
}
|
|
141
|
-
|
|
@@ -9,6 +9,7 @@ const {
|
|
|
9
9
|
markAfter,
|
|
10
10
|
isMarkedAfter,
|
|
11
11
|
} = require('../../mark');
|
|
12
|
+
|
|
12
13
|
const {isExportNamespaceSpecifier} = require('@babel/types');
|
|
13
14
|
|
|
14
15
|
const isDeclarationNewline = (path) => isMarkedAfter(path.get('declaration'));
|
|
@@ -110,4 +111,3 @@ module.exports.ExportNamedDeclaration = {
|
|
|
110
111
|
markAfter(path);
|
|
111
112
|
},
|
|
112
113
|
};
|
|
113
|
-
|
|
@@ -32,14 +32,16 @@ module.exports.SwitchStatement = {
|
|
|
32
32
|
|
|
33
33
|
print(':');
|
|
34
34
|
|
|
35
|
+
const consequents = switchCase.get('consequent');
|
|
36
|
+
|
|
35
37
|
const isBlock = switchCase
|
|
36
38
|
.get('consequent.0')
|
|
37
|
-
|
|
39
|
+
?.isBlockStatement();
|
|
38
40
|
|
|
39
41
|
maybe.indent.inc(!isBlock);
|
|
40
|
-
maybe.print.newline(!isBlock);
|
|
42
|
+
maybe.print.newline(!isBlock && consequents.length);
|
|
41
43
|
|
|
42
|
-
for (const consequent of
|
|
44
|
+
for (const consequent of consequents) {
|
|
43
45
|
if (!consequent.isBlockStatement()) {
|
|
44
46
|
print(consequent);
|
|
45
47
|
continue;
|
|
@@ -30,18 +30,19 @@ module.exports.VariableDeclaration = {
|
|
|
30
30
|
for (const [index, declaration] of declarations.entries()) {
|
|
31
31
|
const id = declaration.get('id');
|
|
32
32
|
const init = declaration.get('init');
|
|
33
|
+
const notLast = index < n;
|
|
33
34
|
|
|
34
35
|
traverse(id);
|
|
35
36
|
|
|
36
37
|
if (exists(init)) {
|
|
37
|
-
const notLast = index < n;
|
|
38
38
|
write.space();
|
|
39
39
|
write('=');
|
|
40
40
|
write.space();
|
|
41
41
|
traverse(init);
|
|
42
|
-
maybe.write(notLast, ',');
|
|
43
|
-
maybe.write.space(notLast);
|
|
44
42
|
}
|
|
43
|
+
|
|
44
|
+
maybe.write(notLast, ',');
|
|
45
|
+
maybe.write.space(notLast);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
maybe.write(isParentBlock(path), ';');
|
package/package.json
CHANGED