@putout/plugin-for-of 12.4.0 → 12.4.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.
Files changed (2) hide show
  1. package/lib/map/index.js +6 -2
  2. package/package.json +1 -1
package/lib/map/index.js CHANGED
@@ -11,13 +11,14 @@ const {
11
11
  isBlockStatement,
12
12
  isTryStatement,
13
13
  isArrayPattern,
14
+ isCallExpression,
14
15
  } = types;
15
16
 
16
17
  const createPush = template('%%ARRAY%%.push(%%ARGUMENT%%)');
17
18
 
18
19
  const tail = (body) => body.at(-1);
19
20
 
20
- export const report = () => `Use 'for...of' instead of map when 'return' absent`;
21
+ export const report = () => `Use 'for..of' instead of 'map'`;
21
22
 
22
23
  export const match = () => ({
23
24
  '__a.map((__b) => __c)': ({__c}, path) => {
@@ -34,7 +35,10 @@ export const match = () => ({
34
35
 
35
36
  return !isReturnStatement(last);
36
37
  },
37
- 'const __a = __b.map((__c) => __d)': ({__a, __c, __d}) => {
38
+ 'const __a = __b.map((__c) => __d)': ({__a, __b, __c, __d}) => {
39
+ if (isCallExpression(__b))
40
+ return false;
41
+
38
42
  if (compare(__c, __d))
39
43
  return false;
40
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-for-of",
3
- "version": "12.4.0",
3
+ "version": "12.4.1",
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",