@putout/printer 18.9.1 → 18.9.2
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,5 +1,11 @@
|
|
|
1
|
+
import {types} from '@putout/babel';
|
|
1
2
|
import {hasTrailingComment} from '#is';
|
|
2
3
|
|
|
4
|
+
const {
|
|
5
|
+
isCallExpression,
|
|
6
|
+
isMemberExpression,
|
|
7
|
+
} = types;
|
|
8
|
+
|
|
3
9
|
const {assign} = Object;
|
|
4
10
|
|
|
5
11
|
export const chain = (path) => {
|
|
@@ -48,12 +54,12 @@ function up(current) {
|
|
|
48
54
|
|
|
49
55
|
current = current.parentPath;
|
|
50
56
|
|
|
51
|
-
if (
|
|
57
|
+
if (isCallExpression(current)) {
|
|
52
58
|
properties.push(build(current));
|
|
53
59
|
current = current.parentPath;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
if (!
|
|
62
|
+
if (!isMemberExpression(current))
|
|
57
63
|
break;
|
|
58
64
|
}
|
|
59
65
|
|
|
@@ -69,7 +75,7 @@ function build(path) {
|
|
|
69
75
|
type: path.type,
|
|
70
76
|
};
|
|
71
77
|
|
|
72
|
-
if (
|
|
78
|
+
if (isCallExpression(path))
|
|
73
79
|
assign(prop, {
|
|
74
80
|
args: path.node.arguments.length,
|
|
75
81
|
name: path.node.callee.property?.name || '',
|
|
@@ -7,30 +7,23 @@ import {
|
|
|
7
7
|
import {chain} from '../chain.js';
|
|
8
8
|
import {checkCallsCount} from './check-calls-count.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
return properties.find(hasComment);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const isPathGet = ([property]) => {
|
|
15
|
-
return isCallExpression(property, {
|
|
16
|
-
name: 'get',
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
isIfStatement,
|
|
22
|
-
isCallExpression,
|
|
23
|
-
} = types;
|
|
10
|
+
const {isIfStatement} = types;
|
|
24
11
|
|
|
12
|
+
const hasPropertyWithComment = (properties) => properties.find(hasComment);
|
|
25
13
|
const callWithRoot = (fn) => (a, {root}) => fn(root);
|
|
14
|
+
const hasComment = ({type}) => type === 'CommentLine';
|
|
15
|
+
|
|
16
|
+
const isPathGet = createTypeChecker([
|
|
17
|
+
['-: 0 -> !CallExpression'],
|
|
18
|
+
['-: 0.name -> !', '=', 'get'],
|
|
19
|
+
['+: 0.args ->', '=', 1],
|
|
20
|
+
]);
|
|
26
21
|
|
|
27
22
|
const isExcludedFromChain = createTypeChecker([
|
|
28
23
|
'+: -> UnaryExpression',
|
|
29
24
|
'+: -> IfStatement',
|
|
30
25
|
]);
|
|
31
26
|
|
|
32
|
-
const hasComment = ({type}) => type === 'CommentLine';
|
|
33
|
-
|
|
34
27
|
const isInsideMemberCall = createTypeChecker([
|
|
35
28
|
['-: node.object -> !Identifier'],
|
|
36
29
|
['-: node.property -> !Identifier'],
|
package/package.json
CHANGED