@putout/printer 14.7.3 → 14.8.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 +7 -0
- package/lib/tokenize/expressions/object-expression/object-expression.js +1 -0
- package/lib/tokenize/statements/block-statement/block-statement.js +6 -2
- package/lib/tokenize/statements/export-declaration/export-declaration.js +7 -3
- package/lib/tokenize/statements/return-statement/return-statement.js +0 -1
- package/package.json +2 -2
package/ChangeLog
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
2025.05.26, v14.8.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 1d87093 @putout/printer: eslint-plugin-putout v27.0.0
|
|
5
|
+
- 6b3ea67 @putout/printer: ExportDeclaration: trailingComma
|
|
6
|
+
- fa15bb1 @putout/printer: ObjectExpression: ObjectMethod: trailingComma
|
|
7
|
+
|
|
1
8
|
2025.05.23, v14.7.3
|
|
2
9
|
|
|
3
10
|
feature:
|
|
@@ -49,6 +49,7 @@ const parentIfWithoutElse = ({parentPath}) => {
|
|
|
49
49
|
|
|
50
50
|
module.exports.BlockStatement = {
|
|
51
51
|
print(path, printer, semantics) {
|
|
52
|
+
const {trailingComma} = semantics;
|
|
52
53
|
const {
|
|
53
54
|
indent,
|
|
54
55
|
maybe,
|
|
@@ -93,8 +94,10 @@ module.exports.BlockStatement = {
|
|
|
93
94
|
|
|
94
95
|
maybe.indent.dec(callInsideChain);
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const {parentPath} = path;
|
|
98
|
+
|
|
99
|
+
if (isObjectMethod(parentPath))
|
|
100
|
+
maybe.write(isNext(parentPath) || trailingComma, ',');
|
|
98
101
|
},
|
|
99
102
|
afterIf: shouldAddNewlineAfter,
|
|
100
103
|
after(path, {write}) {
|
|
@@ -193,3 +196,4 @@ function isTry({parentPath}) {
|
|
|
193
196
|
|
|
194
197
|
return parentPath.parentPath?.isTryStatement();
|
|
195
198
|
}
|
|
199
|
+
|
|
@@ -39,7 +39,8 @@ module.exports.ExportNamespaceSpecifier = (path, {print}) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
module.exports.ExportNamedDeclaration = {
|
|
42
|
-
print(path, {print, traverse, indent, maybe}) {
|
|
42
|
+
print(path, {print, traverse, indent, maybe}, semantics) {
|
|
43
|
+
const {trailingComma} = semantics;
|
|
43
44
|
const {exportKind} = path.node;
|
|
44
45
|
const specifiers = path.get('specifiers');
|
|
45
46
|
const {maxOneLineSpecifiers} = options.exports;
|
|
@@ -77,14 +78,17 @@ module.exports.ExportNamedDeclaration = {
|
|
|
77
78
|
|
|
78
79
|
for (const [i, spec] of specifiers.entries()) {
|
|
79
80
|
const isType = spec.node.exportKind === 'type';
|
|
81
|
+
const isLast = i < lastIndex;
|
|
82
|
+
|
|
80
83
|
maybe.indent(isNewline);
|
|
81
84
|
maybe.print(isType, 'type ');
|
|
82
85
|
traverse(spec);
|
|
83
86
|
|
|
84
|
-
if (
|
|
87
|
+
if (isLast && !isNewline)
|
|
85
88
|
print(', ');
|
|
89
|
+
else if (isNewline)
|
|
90
|
+
maybe.print(isLast || trailingComma, ',');
|
|
86
91
|
|
|
87
|
-
maybe.print(isNewline, ',');
|
|
88
92
|
maybe.print.newline(isNewline);
|
|
89
93
|
}
|
|
90
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.8.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"check-dts": "^0.9.0",
|
|
81
81
|
"escover": "^4.0.1",
|
|
82
82
|
"eslint": "^9.0.0",
|
|
83
|
-
"eslint-plugin-putout": "^
|
|
83
|
+
"eslint-plugin-putout": "^27.0.0",
|
|
84
84
|
"estree-to-babel": "^11.0.2",
|
|
85
85
|
"goldstein": "^6.0.1",
|
|
86
86
|
"just-kebab-case": "^4.2.0",
|