@putout/plugin-putout 19.5.0 β 19.5.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/README.md
CHANGED
|
@@ -837,6 +837,8 @@ module.exports.traverse = ({push}) => ({
|
|
|
837
837
|
|
|
838
838
|
## add-store
|
|
839
839
|
|
|
840
|
+
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/b453bd78b8e9380da8b2f33dfb38b4e2/53b14f89eb88aa10c8e00ba1f0251976592e14ee).
|
|
841
|
+
|
|
840
842
|
### β Example of incorrect code
|
|
841
843
|
|
|
842
844
|
```js
|
|
@@ -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
|
+
}
|
|
@@ -20,7 +20,7 @@ const isRecast = (program) => program.get('body.0.expression').isStringLiteral({
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
module.exports.report = () => {
|
|
23
|
-
return `
|
|
23
|
+
return `Use 'operator.replaceWith()' instead of 'path.replaceWith()'`;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
module.exports.fix = ({path, calleePath, property, object, program, isInserted}) => {
|
package/package.json
CHANGED