@putout/printer 9.10.0 → 9.11.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
|
@@ -11,7 +11,12 @@ const {
|
|
|
11
11
|
isNext,
|
|
12
12
|
} = require('../is');
|
|
13
13
|
|
|
14
|
-
const hasBody = (path) =>
|
|
14
|
+
const hasBody = (path) => {
|
|
15
|
+
if (path.isTSModuleDeclaration())
|
|
16
|
+
return true;
|
|
17
|
+
|
|
18
|
+
return path.node.body?.length;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
const isFnParam = (path) => {
|
|
17
22
|
const {parentPath} = path;
|
|
@@ -51,6 +56,9 @@ function isCommentOnNextLine(path) {
|
|
|
51
56
|
if (parentPath.isMemberExpression())
|
|
52
57
|
return false;
|
|
53
58
|
|
|
59
|
+
if (path.isClassMethod())
|
|
60
|
+
return false;
|
|
61
|
+
|
|
54
62
|
if (isTrailingIsLeading(path))
|
|
55
63
|
return false;
|
|
56
64
|
|
|
@@ -113,3 +121,4 @@ module.exports.parseTrailingComments = (path, {write, maybe}, semantics) => {
|
|
|
113
121
|
}
|
|
114
122
|
}
|
|
115
123
|
};
|
|
124
|
+
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
isNext,
|
|
5
|
+
hasTrailingComment,
|
|
6
|
+
} = require('../../is');
|
|
4
7
|
const {printParams} = require('./params');
|
|
5
8
|
const {maybeDecorators} = require('../../maybe/maybe-decorators');
|
|
6
9
|
const {printKey} = require('../object-expression/print-key');
|
|
7
10
|
const {printKind} = require('./kind');
|
|
8
11
|
|
|
12
|
+
const noTrailingCommentAndNext = (path) => {
|
|
13
|
+
if (hasTrailingComment(path))
|
|
14
|
+
return false;
|
|
15
|
+
|
|
16
|
+
return isNext(path);
|
|
17
|
+
};
|
|
18
|
+
|
|
9
19
|
const ClassMethod = {
|
|
10
20
|
print: maybeDecorators((path, printer, semantics) => {
|
|
11
21
|
const {print} = printer;
|
|
@@ -45,7 +55,7 @@ const ClassMethod = {
|
|
|
45
55
|
print.space();
|
|
46
56
|
print('__body');
|
|
47
57
|
}),
|
|
48
|
-
afterSatisfy: () => [
|
|
58
|
+
afterSatisfy: () => [noTrailingCommentAndNext],
|
|
49
59
|
after(path, {print}) {
|
|
50
60
|
print.linebreak();
|
|
51
61
|
},
|
package/package.json
CHANGED