@putout/plugin-putout 27.7.0 β†’ 27.7.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.
package/README.md CHANGED
@@ -813,11 +813,15 @@ t.transform('nested-not-block', [
813
813
 
814
814
  ## convert-push-object-to-push-path
815
815
 
816
- Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/abcc9f79469db69849b6d6efd3e85a8a/0536c9f780a0c9db2feed3be92299a22f06b9720).
816
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fc54c923cb3cc4095c3c1d84d7ae7982/7de8eace54c8068be4ec5954ad4dde6d52ec6ca6).
817
817
 
818
818
  ### ❌ Example of incorrect code
819
819
 
820
820
  ```js
821
+ export const fix = ({path}) => {
822
+ removeClassName(path, SELECTED);
823
+ };
824
+
821
825
  push({
822
826
  path: child,
823
827
  });
@@ -826,6 +830,10 @@ push({
826
830
  ### βœ… Example of correct code
827
831
 
828
832
  ```js
833
+ export const fix = (path) => {
834
+ removeClassName(path, SELECTED);
835
+ };
836
+
829
837
  push(child);
830
838
  ```
831
839
 
@@ -1,5 +1,24 @@
1
+ import {operator} from 'putout';
2
+
3
+ const {traverse} = operator;
4
+
1
5
  export const report = () => `Use 'push(__a)' instead of 'push({path: __a})'`;
2
6
 
7
+ export const match = () => ({
8
+ 'export const fix = ({path}) => __a': (vars, {parentPath}) => {
9
+ let is = false;
10
+
11
+ traverse(parentPath, {
12
+ 'push({path: __a})': () => {
13
+ is = true;
14
+ },
15
+ });
16
+
17
+ return is;
18
+ },
19
+ });
20
+
3
21
  export const replace = () => ({
4
22
  'push({path: __a})': 'push(__a)',
23
+ 'export const fix = ({path}) => __a': 'export const fix = (path) => __a',
5
24
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "27.7.0",
3
+ "version": "27.7.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",