@putout/plugin-putout 19.5.1 → 19.6.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/README.md
CHANGED
|
@@ -18,6 +18,7 @@ npm i @putout/plugin-putout -D
|
|
|
18
18
|
- ✅ [add-index-to-import](#add-index-to-import);
|
|
19
19
|
- ✅ [add-push](#add-push);
|
|
20
20
|
- ✅ [add-store](#add-store);
|
|
21
|
+
- ✅ [add-path-store](#add-path-store);
|
|
21
22
|
- ✅ [add-track-file](#add-track-file);
|
|
22
23
|
- ✅ [apply-async-formatter](#apply-async-formatter);
|
|
23
24
|
- ✅ [apply-create-test](#apply-create-test);
|
|
@@ -83,6 +84,7 @@ npm i @putout/plugin-putout -D
|
|
|
83
84
|
"putout/add-args": "on",
|
|
84
85
|
"putout/add-push": "on",
|
|
85
86
|
"putout/add-store": "on",
|
|
87
|
+
"putout/add-path-store": "on",
|
|
86
88
|
"putout/add-track-file": "on",
|
|
87
89
|
"putout/add-await-to-progress": "on",
|
|
88
90
|
"putout/add-index-to-import": "on",
|
|
@@ -865,6 +867,24 @@ module.exports.traverse = ({store}) => ({
|
|
|
865
867
|
});
|
|
866
868
|
```
|
|
867
869
|
|
|
870
|
+
## add-path-store
|
|
871
|
+
|
|
872
|
+
### ❌ Example of incorrect code
|
|
873
|
+
|
|
874
|
+
```js
|
|
875
|
+
export const traverse = () => ({
|
|
876
|
+
'module.exports.match = __object': pathStore,
|
|
877
|
+
});
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
### ✅ Example of correct code
|
|
881
|
+
|
|
882
|
+
```js
|
|
883
|
+
export const traverse = ({pathStore}) => ({
|
|
884
|
+
'module.exports.match = __object': pathStore,
|
|
885
|
+
});
|
|
886
|
+
```
|
|
887
|
+
|
|
868
888
|
## add-await-to-progress
|
|
869
889
|
|
|
870
890
|
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/978d70945edfa369390ea059654ff04d/89225c04039b9c0e9057aad34852c9428264f119).
|
|
@@ -34,7 +34,7 @@ module.exports.traverse = ({push}) => ({
|
|
|
34
34
|
const {bindings} = scope;
|
|
35
35
|
const __aPath = path.get('arguments.0');
|
|
36
36
|
|
|
37
|
-
if (__aPath
|
|
37
|
+
if (isPathNode(__aPath)) {
|
|
38
38
|
push({
|
|
39
39
|
path,
|
|
40
40
|
__aPath,
|
|
@@ -66,3 +66,14 @@ module.exports.traverse = ({push}) => ({
|
|
|
66
66
|
});
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
|
+
|
|
70
|
+
function isPathNode(path) {
|
|
71
|
+
if (!path.isMemberExpression())
|
|
72
|
+
return false;
|
|
73
|
+
|
|
74
|
+
const propertyPath = path.get('property');
|
|
75
|
+
|
|
76
|
+
return propertyPath.isIdentifier({
|
|
77
|
+
name: 'node',
|
|
78
|
+
});
|
|
79
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const addStore = require('./add-store');
|
|
4
|
+
const addPathStore = require('./add-path-store');
|
|
3
5
|
const applyProcessorsDestructuring = require('./apply-processors-destructuring');
|
|
4
6
|
const applyAsyncFormatter = require('./apply-async-formatter');
|
|
5
7
|
const applyCreateTest = require('./apply-create-test');
|
|
@@ -49,9 +51,10 @@ const convertProgressToTrackFile = require('./convert-progress-to-track-file');
|
|
|
49
51
|
const addAwaitToProgress = require('./add-await-to-progress');
|
|
50
52
|
const applyForOfToTrackFile = require('./apply-for-of-to-track-file');
|
|
51
53
|
const removeUnusedGetPropertiesArgument = require('./remove-unused-get-properties-argument');
|
|
52
|
-
const addStore = require('./add-store');
|
|
53
54
|
|
|
54
55
|
module.exports.rules = {
|
|
56
|
+
'add-store': addStore,
|
|
57
|
+
'add-path-store': addPathStore,
|
|
55
58
|
'apply-processors-destructuring': applyProcessorsDestructuring,
|
|
56
59
|
'apply-async-formatter': applyAsyncFormatter,
|
|
57
60
|
'apply-create-test': applyCreateTest,
|
|
@@ -101,5 +104,4 @@ module.exports.rules = {
|
|
|
101
104
|
'add-await-to-progress': addAwaitToProgress,
|
|
102
105
|
'apply-for-of-to-track-file': applyForOfToTrackFile,
|
|
103
106
|
'remove-unused-get-properties-argument': removeUnusedGetPropertiesArgument,
|
|
104
|
-
'add-store': addStore,
|
|
105
107
|
};
|
package/package.json
CHANGED