@putout/plugin-putout 29.14.0 → 29.15.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.
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import {types} from 'putout';
|
|
1
|
+
import {types, operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {getBindingPath} = operator;
|
|
4
|
+
const {
|
|
5
|
+
isObjectProperty,
|
|
6
|
+
isImportDeclaration,
|
|
7
|
+
} = types;
|
|
4
8
|
|
|
5
9
|
export const report = () => `Avoid useless 'source' argument`;
|
|
6
10
|
|
|
7
|
-
export const filter = (path) =>
|
|
11
|
+
export const filter = (path) => {
|
|
12
|
+
if (isObjectProperty(path.parentPath))
|
|
13
|
+
return false;
|
|
14
|
+
|
|
15
|
+
const {name} = path.node.callee;
|
|
16
|
+
|
|
17
|
+
const bindingPath = getBindingPath(path, name);
|
|
18
|
+
|
|
19
|
+
if (!bindingPath)
|
|
20
|
+
return true;
|
|
21
|
+
|
|
22
|
+
const {parentPath} = bindingPath;
|
|
23
|
+
|
|
24
|
+
if (!isImportDeclaration(parentPath))
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
const {value} = parentPath.node.source;
|
|
28
|
+
|
|
29
|
+
return !value.startsWith('.');
|
|
30
|
+
};
|
|
8
31
|
|
|
9
32
|
export const replace = () => ({
|
|
10
33
|
'findPlaces(__a, __b, __c)': 'findPlaces(__a, __c)',
|
package/package.json
CHANGED