@putout/plugin-putout 27.7.1 → 27.8.1
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.
|
@@ -5,6 +5,18 @@ const {traverse} = operator;
|
|
|
5
5
|
export const report = () => `Use 'push(__a)' instead of 'push({path: __a})'`;
|
|
6
6
|
|
|
7
7
|
export const match = () => ({
|
|
8
|
+
'push({path})': (vars, path) => {
|
|
9
|
+
let is = false;
|
|
10
|
+
const programPath = path.scope.getProgramParent().path;
|
|
11
|
+
|
|
12
|
+
traverse(programPath, {
|
|
13
|
+
'export const fix = (path) => __body': () => {
|
|
14
|
+
is = true;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return is;
|
|
19
|
+
},
|
|
8
20
|
'export const fix = ({path}) => __a': (vars, {parentPath}) => {
|
|
9
21
|
let is = false;
|
|
10
22
|
|
|
@@ -12,6 +24,9 @@ export const match = () => ({
|
|
|
12
24
|
'push({path: __a})': () => {
|
|
13
25
|
is = true;
|
|
14
26
|
},
|
|
27
|
+
'push({path})': () => {
|
|
28
|
+
is = true;
|
|
29
|
+
},
|
|
15
30
|
});
|
|
16
31
|
|
|
17
32
|
return is;
|
|
@@ -20,5 +35,6 @@ export const match = () => ({
|
|
|
20
35
|
|
|
21
36
|
export const replace = () => ({
|
|
22
37
|
'push({path: __a})': 'push(__a)',
|
|
38
|
+
'push({path})': 'push(path)',
|
|
23
39
|
'export const fix = ({path}) => __a': 'export const fix = (path) => __a',
|
|
24
40
|
});
|
package/package.json
CHANGED