@putout/plugin-putout 18.2.0 β†’ 18.3.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
@@ -588,7 +588,10 @@ module.exports.replace = () => ({
588
588
 
589
589
  ## convert-traverse-to-scan
590
590
 
591
- Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/afe988c8e53ae70e50bf26512672f3cd/a6677d53b996e85880a4af18250c00e849322bbe).
591
+ Checkout in 🐊**Putout Editor**:
592
+
593
+ - [`Traverser`](https://putout.cloudcmd.io/#/gist/afe988c8e53ae70e50bf26512672f3cd/a6677d53b996e85880a4af18250c00e849322bbe);
594
+ - [`Replacer`](https://putout.cloudcmd.io/#/gist/2e89f498c88f3208beeb85dd01a9178e/ed975281c57f451fc1c3aaf187425a33499af71d);
592
595
 
593
596
  ### ❌ Example of incorrect code
594
597
 
@@ -27,7 +27,12 @@ module.exports.traverse = ({push}) => ({
27
27
  const statement = path.find(isForOfStatement);
28
28
 
29
29
  if (!statement)
30
- return false;
30
+ return;
31
+
32
+ const forOfCount = statement.parentPath.get('body').filter(isForOfStatement).length;
33
+
34
+ if (forOfCount > 1)
35
+ return;
31
36
 
32
37
  push({
33
38
  path,
@@ -33,7 +33,12 @@ module.exports.fix = ({path, pathProperty}) => {
33
33
  replaceWith(path.parentPath, path.get('value.body'));
34
34
  path.parentPath.parentPath.node.params.unshift(Identifier('path'));
35
35
 
36
- const {left} = path.parentPath.parentPath.parentPath.node;
36
+ const assignmentPath = path.parentPath.parentPath.parentPath;
37
+
38
+ if (!assignmentPath.isAssignmentExpression())
39
+ return;
40
+
41
+ const {left} = assignmentPath.node;
37
42
 
38
43
  left.property.name = 'scan';
39
44
  return;
@@ -84,7 +89,6 @@ module.exports.traverse = ({push}) => ({
84
89
  path,
85
90
  });
86
91
  },
87
- '__.map(push)'() {},
88
92
  'push(__a)'(path) {
89
93
  const __aPath = path.get('arguments.0');
90
94
 
package/lib/index.js CHANGED
@@ -45,7 +45,7 @@ const addIndexToImport = require('./add-index-to-import');
45
45
  const applyRename = require('./apply-rename');
46
46
  const applyShortProcessors = require('./apply-short-processors');
47
47
  const addTrackFile = require('./add-track-file');
48
- const convertProgressToTrack = require('./convert-progress-to-track');
48
+ const convertProgressToTrackFile = require('./convert-progress-to-track-file');
49
49
 
50
50
  module.exports.rules = {
51
51
  'apply-processors-destructuring': applyProcessorsDestructuring,
@@ -93,5 +93,5 @@ module.exports.rules = {
93
93
  'apply-short-processors': applyShortProcessors,
94
94
  'convert-traverse-to-scan': convertTraverseToScan,
95
95
  'add-track-file': addTrackFile,
96
- 'convert-progress-to-track': convertProgressToTrack,
96
+ 'convert-progress-to-track-file': convertProgressToTrackFile,
97
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "18.2.0",
3
+ "version": "18.3.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",