@putout/plugin-for-of 12.1.0 → 12.2.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.
@@ -7,12 +7,13 @@ import {
7
7
  const {
8
8
  isIdentifier,
9
9
  continueStatement,
10
+ isReturnStatement,
10
11
  } = types;
11
12
 
12
13
  const {
13
14
  replaceWith,
14
15
  replaceWithMultiple,
15
- traverse,
16
+ superTraverse,
16
17
  } = operator;
17
18
 
18
19
  const forOfTemplate = template(`
@@ -81,6 +82,9 @@ export const match = () => ({
81
82
  '__.forEach(__args)': (vars, path) => {
82
83
  const {parentPath} = path;
83
84
 
85
+ if (isReturnStatement(parentPath))
86
+ return false;
87
+
84
88
  if (parentPath.isSequenceExpression())
85
89
  return false;
86
90
 
@@ -130,7 +134,7 @@ function isSameNames(paramPath, objectPath) {
130
134
  }
131
135
 
132
136
  function fixReturn(path) {
133
- traverse(path, {
137
+ superTraverse(path, {
134
138
  'return __'(path) {
135
139
  if (!isForBeforeFnUp(path))
136
140
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-for-of",
3
- "version": "12.1.0",
3
+ "version": "12.2.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to apply for...of",
@@ -41,10 +41,9 @@
41
41
  "@putout/plugin-variables": "*",
42
42
  "@putout/test": "^15.0.0",
43
43
  "eslint": "^10.0.0",
44
- "eslint-plugin-n": "^17.0.0",
45
44
  "eslint-plugin-putout": "^31.0.0",
46
45
  "madrun": "^13.0.0",
47
- "montag": "^1.2.1",
46
+ "montag": "^2.0.0",
48
47
  "nodemon": "^3.0.1",
49
48
  "superc8": "^12.0.0"
50
49
  },