@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.
- package/lib/for-entries/index.js +1 -1
- package/lib/for-entries-n/index.js +1 -1
- package/lib/for-length/index.js +1 -1
- package/lib/for-n/index.js +1 -1
- package/lib/map/index.js +1 -0
- package/lib/reduce/index.js +1 -1
- package/lib/remove-unused-variables/index.js +1 -1
- package/lib/remove-useless-array-from/index.js +1 -1
- package/lib/remove-useless-variables/index.js +1 -1
- package/lib/to-for-n/index.js +1 -1
- package/package.json +1 -1
package/lib/for-entries/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
|
|
12
12
|
const {isBlockStatement} = types;
|
|
13
13
|
|
|
14
|
-
export const report = () => `Use '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
|
|
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`);
|
package/lib/for-length/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
|
|
12
12
|
const {isBlockStatement} = types;
|
|
13
13
|
|
|
14
|
-
export const report = () => `Use '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`);
|
package/lib/for-n/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
|
|
12
12
|
const {isBlockStatement} = types;
|
|
13
13
|
|
|
14
|
-
export const report = () => `Use '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
package/lib/reduce/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
isExportNamedDeclaration,
|
|
8
8
|
} = types;
|
|
9
9
|
|
|
10
|
-
export const report = () => `Use 'for
|
|
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
|
|
15
|
+
return `'${names.join(', ')}' inside 'for..of' loop defined but never used`;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const match = () => ({
|
|
@@ -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
|
|
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);
|
package/lib/to-for-n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const report = () => `Use 'for' instead of 'for
|
|
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