@putout/printer 8.13.0 → 8.14.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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {maybeTypeAnnotation} = require('
|
|
3
|
+
const {maybeTypeAnnotation} = require('../../maybe/maybe-type-annotation');
|
|
4
4
|
const isForOf = ({parentPath}) => parentPath.parentPath.parentPath?.isForOfStatement();
|
|
5
5
|
|
|
6
6
|
module.exports.ArrayPattern = maybeTypeAnnotation((path, {indent, maybe, print}, options) => {
|
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
|
|
30
30
|
const {AssignmentExpression} = require('./assignment-expression');
|
|
31
31
|
const {ArrayExpression} = require('./array-expression/array-expression');
|
|
32
|
-
const {ArrayPattern} = require('./array-pattern');
|
|
32
|
+
const {ArrayPattern} = require('./array-pattern/array-pattern');
|
|
33
33
|
const {AssignmentPattern} = require('./assignment-pattern');
|
|
34
34
|
const {RestElement} = require('./rest-element');
|
|
35
35
|
const {SpreadElement} = require('./spread-element');
|
|
@@ -21,11 +21,16 @@ const isTwoLevelsDeep = ({parentPath}) => parentPath.parentPath.parentPath.isObj
|
|
|
21
21
|
|
|
22
22
|
const isOneParentProperty = ({parentPath}) => parentPath.parentPath.node.properties?.length === 1;
|
|
23
23
|
|
|
24
|
+
function isIndent(path) {
|
|
25
|
+
return !path.parentPath.isArrayPattern();
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
module.exports.ObjectPattern = {
|
|
25
29
|
print: maybeTypeAnnotation((path, {indent, print, maybe}, semantics) => {
|
|
26
30
|
const {maxPropertiesInOneLine} = semantics;
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
const shouldIndent = isIndent(path);
|
|
33
|
+
maybe.indent.inc(shouldIndent);
|
|
29
34
|
print('{');
|
|
30
35
|
|
|
31
36
|
const properties = path.get('properties');
|
|
@@ -87,8 +92,8 @@ module.exports.ObjectPattern = {
|
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
indent.dec();
|
|
91
|
-
maybe.indent(is);
|
|
95
|
+
maybe.indent.dec(shouldIndent);
|
|
96
|
+
maybe.indent(is && shouldIndent);
|
|
92
97
|
print('}');
|
|
93
98
|
}),
|
|
94
99
|
afterIf(path) {
|
|
@@ -158,3 +163,4 @@ function shouldAddNewline(path, {maxPropertiesInOneLine}) {
|
|
|
158
163
|
|
|
159
164
|
return parentPath.isObjectProperty();
|
|
160
165
|
}
|
|
166
|
+
|
package/package.json
CHANGED