@putout/plugin-for-of 12.4.1 → 12.4.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.
@@ -11,7 +11,7 @@ const {
11
11
 
12
12
  const {isBlockStatement} = types;
13
13
 
14
- export const report = () => `Use 'for...of' instead of 'for'`;
14
+ export const report = () => `Use 'for..of' instead of 'for'`;
15
15
 
16
16
  const forLoop = 'for (let __i = 0; __i < __e.length; __i++) __c';
17
17
  const getForOfLoop = template(`for (const [INDEX, ITEM] of ITEMS.entries()) BODY`);
@@ -12,7 +12,7 @@ const {
12
12
 
13
13
  const {isBlockStatement} = types;
14
14
 
15
- export const report = () => `Use 'for...of' instead of 'for'`;
15
+ export const report = () => `Use 'for..of' instead of 'for'`;
16
16
 
17
17
  const forLoopToN = 'for (let __i = 0; __i < __n; __i++) __c';
18
18
  const getForOfLoop = template(`for (const [INDEX, LEFT] of RIGHT.entries()) BODY`);
@@ -11,7 +11,7 @@ const {
11
11
 
12
12
  const {isBlockStatement} = types;
13
13
 
14
- export const report = () => `Use 'for...of' instead of 'for'`;
14
+ export const report = () => `Use 'for..of' instead of 'for'`;
15
15
 
16
16
  const forLoop = 'for (let __i = 0; __i < __e.length; __i++) __c';
17
17
  const getForOfLoop = template(`for (const LEFT of RIGHT) BODY`);
@@ -11,7 +11,7 @@ const {
11
11
 
12
12
  const {isBlockStatement} = types;
13
13
 
14
- export const report = () => `Use 'for...of' instead of 'for'`;
14
+ export const report = () => `Use 'for..of' instead of 'for'`;
15
15
 
16
16
  const forLoopToN = 'for (let __i = 0; __i < __n; __i++) __c';
17
17
  const getForOfLoop = template(`for (const LEFT of RIGHT) BODY`);
package/lib/map/index.js CHANGED
@@ -44,6 +44,7 @@ export const match = () => ({
44
44
 
45
45
  return !isArrayPattern(__a);
46
46
  },
47
+ '__a = __b.map((__c) => __d)': ({__b}) => !isCallExpression(__b),
47
48
  });
48
49
 
49
50
  export const replace = () => ({
@@ -7,7 +7,7 @@ const {
7
7
  isExportNamedDeclaration,
8
8
  } = types;
9
9
 
10
- export const report = () => `Use 'for...of' instead of '.reduce()'`;
10
+ export const report = () => `Use 'for..of' instead of '.reduce()'`;
11
11
 
12
12
  export const match = () => ({
13
13
  'const __a = __b.reduce((__c, __d) => __e)': ({__b, __e}, path) => {
@@ -12,7 +12,7 @@ export const report = (path) => {
12
12
  const variables = getVariables(path);
13
13
  const names = getNames(variables);
14
14
 
15
- return `'${names.join(', ')}' inside 'for...of' loop defined but never used`;
15
+ return `'${names.join(', ')}' inside 'for..of' loop defined but never used`;
16
16
  };
17
17
 
18
18
  export const match = () => ({
@@ -1,4 +1,4 @@
1
- export const report = () => `'Array.from()' has no sense inside 'for...of'`;
1
+ export const report = () => `'Array.from()' has no sense inside 'for..of'`;
2
2
 
3
3
  export const replace = () => ({
4
4
  'for (const __a of Array.from(__b)) __c': 'for (const __a of __b) __c',
@@ -9,7 +9,7 @@ const {
9
9
  const isToManyProperties = (a, {maxProperties}) => a.isObjectPattern() && a.node.properties.length > maxProperties;
10
10
  const isAssignment = (a) => isAssignmentPattern(a.value);
11
11
 
12
- export const report = () => `Use destructuring in head of 'for...of'`;
12
+ export const report = () => `Use destructuring in head of 'for..of'`;
13
13
 
14
14
  export const fix = ({path, varPath}) => {
15
15
  replaceWith(varPath, path.node.id);
@@ -1,4 +1,4 @@
1
- export const report = () => `Use 'for' instead of 'for...of' with '.entries()' when change index`;
1
+ export const report = () => `Use 'for' instead of 'for..of' with '.entries()' when change index`;
2
2
 
3
3
  export const match = () => ({
4
4
  'for (let [__a, __b] of __c.entries())__body': ({__a}, path) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-for-of",
3
- "version": "12.4.1",
3
+ "version": "12.4.2",
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",