@putout/plugin-putout 20.2.0 → 20.4.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
|
@@ -57,6 +57,7 @@ npm i @putout/plugin-putout -D
|
|
|
57
57
|
- ✅ [declare](#declare);
|
|
58
58
|
- ✅ [includer](#includer);
|
|
59
59
|
- ✅ [move-require-on-top-level](#move-require-on-top-level);
|
|
60
|
+
- ✅ [remove-empty-array-from-process](#remove-empty-array-from-process);
|
|
60
61
|
- ✅ [remove-unused-get-properties-argument](#remove-unused-get-properties-argument);
|
|
61
62
|
- ✅ [rename-operate-to-operator](#rename-operate-to-operator);
|
|
62
63
|
- ✅ [replace-operate-with-operator](#replace-operate-with-operator);
|
|
@@ -115,6 +116,7 @@ npm i @putout/plugin-putout -D
|
|
|
115
116
|
"putout/move-require-on-top-level": "on",
|
|
116
117
|
"putout/replace-test-message": "on",
|
|
117
118
|
"putout/remove-unused-get-properties-argument": "on",
|
|
119
|
+
"putout/remove-empty-array-from-process": "on",
|
|
118
120
|
"putout/simplify-replace-template": "on"
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -1209,6 +1211,22 @@ test('plugin-putout: rename-operate-to-operator: no report: operator exist', (t)
|
|
|
1209
1211
|
});
|
|
1210
1212
|
```
|
|
1211
1213
|
|
|
1214
|
+
## remove-empty-array-from-process
|
|
1215
|
+
|
|
1216
|
+
Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fc32ff87e91fd28f26a03f55eba0663e/3423926ba0a80d30beafe2ac66c70c517df173e1).
|
|
1217
|
+
|
|
1218
|
+
### ❌ Example of incorrect code
|
|
1219
|
+
|
|
1220
|
+
```js
|
|
1221
|
+
await process('input', []);
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
### ✅ Example of correct code
|
|
1225
|
+
|
|
1226
|
+
```js
|
|
1227
|
+
await process('input');
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1212
1230
|
## remove-unused-get-properties-argument
|
|
1213
1231
|
|
|
1214
1232
|
Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fc32ff87e91fd28f26a03f55eba0663e/3423926ba0a80d30beafe2ac66c70c517df173e1).
|
|
@@ -1240,6 +1258,8 @@ const {
|
|
|
1240
1258
|
|
|
1241
1259
|
## simplify-replace-template
|
|
1242
1260
|
|
|
1261
|
+
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a012fc12f4d38038da022f7c8f379fe2/c65bf97c42650aa31c5481849bc934323df892a6).
|
|
1262
|
+
|
|
1243
1263
|
### ❌ Example of incorrect code
|
|
1244
1264
|
|
|
1245
1265
|
```js
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
const putout = require('putout');
|
|
4
4
|
const tryCatch = require('try-catch');
|
|
5
|
-
const noop = () => {};
|
|
6
5
|
|
|
6
|
+
const noop = () => {};
|
|
7
7
|
const {types, operator} = putout;
|
|
8
|
-
const {replaceWith} = operator;
|
|
9
8
|
|
|
10
9
|
const {
|
|
11
10
|
ArrayPattern,
|
|
12
11
|
BlockStatement,
|
|
13
12
|
ObjectExpression,
|
|
14
13
|
ObjectPattern,
|
|
14
|
+
Identifier,
|
|
15
15
|
} = types;
|
|
16
16
|
|
|
17
|
+
const {replaceWith} = operator;
|
|
18
|
+
|
|
17
19
|
module.exports = (rootPath, key) => {
|
|
18
20
|
const getVar = createVarStore(rootPath);
|
|
19
21
|
|
|
@@ -64,8 +66,17 @@ module.exports = (rootPath, key) => {
|
|
|
64
66
|
if (name === '__object')
|
|
65
67
|
return objectify(path);
|
|
66
68
|
|
|
67
|
-
if (name === '__body')
|
|
69
|
+
if (name === '__body') {
|
|
70
|
+
if (path.parentPath.isClassProperty()) {
|
|
71
|
+
const key = Identifier(getVar());
|
|
72
|
+
|
|
73
|
+
replaceWith(path, key);
|
|
74
|
+
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
replaceWith(path, BlockStatement([]));
|
|
79
|
+
}
|
|
69
80
|
},
|
|
70
81
|
}],
|
|
71
82
|
],
|
package/lib/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const addAwaitToProgress = require('./add-await-to-progress');
|
|
|
50
50
|
const applyForOfToTrackFile = require('./apply-for-of-to-track-file');
|
|
51
51
|
const removeUnusedGetPropertiesArgument = require('./remove-unused-get-properties-argument');
|
|
52
52
|
const simplifyReplaceTemplate = require('./simplify-replace-template');
|
|
53
|
+
const removeEmptyArrayFromProcess = require('./remove-empty-array-from-process');
|
|
53
54
|
|
|
54
55
|
module.exports.rules = {
|
|
55
56
|
'apply-processors-destructuring': applyProcessorsDestructuring,
|
|
@@ -102,4 +103,5 @@ module.exports.rules = {
|
|
|
102
103
|
'apply-for-of-to-track-file': applyForOfToTrackFile,
|
|
103
104
|
'remove-unused-get-properties-argument': removeUnusedGetPropertiesArgument,
|
|
104
105
|
'simplify-replace-template': simplifyReplaceTemplate,
|
|
106
|
+
'remove-empty-array-from-process': removeEmptyArrayFromProcess,
|
|
105
107
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with plugins development",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@putout/plugin-tape": "*",
|
|
41
|
-
"@putout/test": "^
|
|
41
|
+
"@putout/test": "^10.0.0",
|
|
42
42
|
"c8": "^9.0.0",
|
|
43
43
|
"eslint": "^9.0.0",
|
|
44
44
|
"eslint-plugin-n": "^17.0.0",
|