@putout/printer 15.9.1 → 15.10.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
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
isUnaryExpression,
|
|
9
9
|
isIfStatement,
|
|
10
10
|
isCallExpression,
|
|
11
|
+
isIdentifier,
|
|
11
12
|
} = types;
|
|
12
13
|
|
|
13
14
|
const isArgOfCall = (path) => path.parentPath?.isCallExpression() && path.parentPath.get('arguments.0') === path;
|
|
@@ -16,9 +17,22 @@ const isCall = (a) => a.type === 'CallExpression';
|
|
|
16
17
|
const isExcludedFromChain = satisfy([isUnaryExpression, isIfStatement]);
|
|
17
18
|
const hasComment = ({type}) => type === 'CommentLine';
|
|
18
19
|
|
|
20
|
+
const isInsideMemberCall = (path) => {
|
|
21
|
+
if (!isIdentifier(path.node.object))
|
|
22
|
+
return false;
|
|
23
|
+
|
|
24
|
+
if (!isIdentifier(path.node.property))
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
return isCallExpression(path.parentPath.parentPath);
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
module.exports.isLooksLikeChain = (path) => {
|
|
20
31
|
const [root, properties] = chain(path);
|
|
21
32
|
|
|
33
|
+
if (isInsideMemberCall(path))
|
|
34
|
+
return false;
|
|
35
|
+
|
|
22
36
|
if (isExcludedFromChain(root))
|
|
23
37
|
return false;
|
|
24
38
|
|
package/package.json
CHANGED