@putout/printer 10.10.0 → 10.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
|
@@ -26,6 +26,13 @@ const isProperty = satisfy([
|
|
|
26
26
|
isSpreadElement,
|
|
27
27
|
]);
|
|
28
28
|
|
|
29
|
+
const isInsideVar = ({parentPath}) => {
|
|
30
|
+
if (isVariableDeclarator(parentPath))
|
|
31
|
+
return true;
|
|
32
|
+
|
|
33
|
+
return isVariableDeclarator(parentPath.parentPath);
|
|
34
|
+
};
|
|
35
|
+
|
|
29
36
|
const hasDecorators = (path) => {
|
|
30
37
|
const {parentPath} = path;
|
|
31
38
|
|
|
@@ -79,7 +86,7 @@ module.exports.parseLeadingComments = (path, {print, maybe, indent}, semantics)
|
|
|
79
86
|
if (!looksLikeSwitchCase && hasTrailingComment(path.getPrevSibling()))
|
|
80
87
|
return;
|
|
81
88
|
|
|
82
|
-
const insideFn = path.parentPath.isFunction();
|
|
89
|
+
const insideFn = path.parentPath.isFunction() && !path.isTSTypeParameterDeclaration();
|
|
83
90
|
|
|
84
91
|
const propIs = isProperty(path);
|
|
85
92
|
const isIndent = isFirst(path) || !looksLikeSwitchCase && !path.isClassMethod() && !insideFn && !propIs;
|
|
@@ -102,6 +109,13 @@ module.exports.parseLeadingComments = (path, {print, maybe, indent}, semantics)
|
|
|
102
109
|
|
|
103
110
|
maybe.print.breakline(propIs);
|
|
104
111
|
maybe.print.newline(!propIs);
|
|
112
|
+
|
|
113
|
+
if (isInsideVar(path)) {
|
|
114
|
+
indent.inc();
|
|
115
|
+
indent();
|
|
116
|
+
indent.dec();
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
continue;
|
|
106
120
|
}
|
|
107
121
|
|
package/package.json
CHANGED