@putout/plugin-for-of 2.0.0 → 3.0.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
@@ -289,7 +289,7 @@ for (const [i, item] of array.entries()) {
289
289
 
290
290
  ### for-entries-n
291
291
 
292
- ##### ❌ Example of incorrect code
292
+ #### ❌ Example of incorrect code
293
293
 
294
294
  ```js
295
295
  const n = array.length;
@@ -30,7 +30,7 @@ const forOfEntriesTemplate = template(`
30
30
  const {keys} = Object;
31
31
  const isRoot = (path) => path.isFunction() || path.isProgram();
32
32
 
33
- module.exports.report = () => `for-of should be used instead of forEach`;
33
+ module.exports.report = () => `Use 'for-of' instead of 'forEach()'`;
34
34
 
35
35
  module.exports.replace = () => ({
36
36
  '__.forEach.call(__a, (__b) => __body)': 'for (const __b of __a) __body',
package/lib/index.js CHANGED
@@ -1,21 +1,31 @@
1
1
  'use strict';
2
2
 
3
- const getRule = (a) => ({
4
- [a]: require(`./${a}`),
5
- });
3
+ const map = require('./map');
4
+ const forEach = require('./for-each');
5
+ const forN = require('./for-n');
6
+ const forLength = require('./for-length');
7
+ const forEntries = require('./for-entries');
8
+ const forEntriesN = require('./for-entries-n');
9
+ const forInNegative = require('./for-in-negative');
10
+ const forInPositive = require('./for-in-positive');
11
+ const reduce = require('./reduce');
12
+ const removeUseless = require('./remove-useless');
13
+ const removeUselessVariables = require('./remove-useless-variables');
14
+ const removeUselessArrayFrom = require('./remove-useless-array-from');
15
+ const removeUnusedVariables = require('./remove-unused-variables');
6
16
 
7
17
  module.exports.rules = {
8
- ...getRule('map'),
9
- ...getRule('for-each'),
10
- ...getRule('for-n'),
11
- ...getRule('for-length'),
12
- ...getRule('for-entries'),
13
- ...getRule('for-entries-n'),
14
- ...getRule('for-in-negative'),
15
- ...getRule('for-in-positive'),
16
- ...getRule('reduce'),
17
- ...getRule('remove-useless'),
18
- ...getRule('remove-useless-variables'),
19
- ...getRule('remove-useless-array-from'),
20
- ...getRule('remove-unused-variables'),
18
+ map,
19
+ 'for-each': forEach,
20
+ 'for-n': forN,
21
+ 'for-length': forLength,
22
+ 'for-entries': forEntries,
23
+ 'for-entries-n': forEntriesN,
24
+ 'for-in-negative': forInNegative,
25
+ 'for-in-positive': forInPositive,
26
+ reduce,
27
+ 'remove-useless': removeUseless,
28
+ 'remove-useless-variables': removeUselessVariables,
29
+ 'remove-useless-array-from': removeUselessArrayFrom,
30
+ 'remove-unused-variables': removeUnusedVariables,
21
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-for-of",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to apply for...of",
@@ -44,14 +44,14 @@
44
44
  "c8": "^8.0.0",
45
45
  "eslint": "^8.0.1",
46
46
  "eslint-plugin-n": "^16.0.0",
47
- "eslint-plugin-putout": "^18.0.0",
47
+ "eslint-plugin-putout": "^19.0.0",
48
48
  "lerna": "^6.0.1",
49
49
  "madrun": "^9.0.0",
50
50
  "montag": "^1.2.1",
51
- "nodemon": "^2.0.1"
51
+ "nodemon": "^3.0.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "putout": ">=30"
54
+ "putout": ">=31"
55
55
  },
56
56
  "license": "MIT",
57
57
  "engines": {