@putout/plugin-putout 13.0.0 → 13.1.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
|
@@ -19,8 +19,9 @@ npm i @putout/plugin-putout -D
|
|
|
19
19
|
"putout/apply-create-test": "on",
|
|
20
20
|
"putout/apply-processors-destructuring": "on",
|
|
21
21
|
"putout/apply-async-formatter": "on",
|
|
22
|
-
"putout/apply-remove": "on",
|
|
23
22
|
"putout/apply-declare": "on",
|
|
23
|
+
"putout/apply-remove": "on",
|
|
24
|
+
"putout/apply-insert-after": "on",
|
|
24
25
|
"putout/add-args": "on",
|
|
25
26
|
"putout/add-push": "on",
|
|
26
27
|
"putout/check-match": "on",
|
|
@@ -96,6 +97,31 @@ export const fix = (path) => {
|
|
|
96
97
|
};
|
|
97
98
|
```
|
|
98
99
|
|
|
100
|
+
## apply-insert-after
|
|
101
|
+
|
|
102
|
+
Better to use [`insertAfter(a, b)`](https://github.com/coderaiser/putout/tree/master/packages/operate#insert-after) method of `operator`.
|
|
103
|
+
It helps to avoid duplication of comments.
|
|
104
|
+
|
|
105
|
+
### ❌ Example of incorrect code
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
export const fix = (path) => {
|
|
109
|
+
path.insertAfter(path.get('init'));
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### ✅ Example of correct code
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
import {operator} from 'putout';
|
|
117
|
+
|
|
118
|
+
const {insertAfter} = operator;
|
|
119
|
+
|
|
120
|
+
export const fix = (path) => {
|
|
121
|
+
insertAfter(path, path.get('init'));
|
|
122
|
+
};
|
|
123
|
+
```
|
|
124
|
+
|
|
99
125
|
## apply-declare
|
|
100
126
|
|
|
101
127
|
Better to use [`Declareator`](https://github.com/coderaiser/putout/tree/master/packages/engine-runner#declarator) instead of `operator.declare()`.
|
|
@@ -218,7 +244,7 @@ isNumericLiteral(node);
|
|
|
218
244
|
|
|
219
245
|
## convert-putout-test-to-create-test
|
|
220
246
|
|
|
221
|
-
Fixes results of [@putout/convert-commonjs-to-esm](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-commonjs-to-esm) work.
|
|
247
|
+
Fixes results of [@putout/convert-commonjs-to-esm](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-commonjs-to-esm#readme) work.
|
|
222
248
|
|
|
223
249
|
### ❌ Example of incorrect code
|
|
224
250
|
|
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
} = require('putout');
|
|
8
8
|
|
|
9
9
|
const {StringLiteral} = types;
|
|
10
|
-
const {compare} = operator;
|
|
10
|
+
const {compare, remove} = operator;
|
|
11
11
|
|
|
12
12
|
const isPush = (path) => path.get('value').isIdentifier({
|
|
13
13
|
name: 'push',
|
|
@@ -42,7 +42,7 @@ module.exports.replace = () => ({
|
|
|
42
42
|
|
|
43
43
|
if (isPush(propertyPath) || isBlock(propertyPath)) {
|
|
44
44
|
node.right.body.elements.push(StringLiteral(name));
|
|
45
|
-
|
|
45
|
+
remove(propertyPath);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
package/lib/declare/operator.js
CHANGED
|
@@ -16,6 +16,7 @@ module.exports = {
|
|
|
16
16
|
isSimpleRegExp: `const {isSimpleRegExp} = operator`,
|
|
17
17
|
getTemplateValues: `const {getTemplateValues} = operator`,
|
|
18
18
|
addArgs: `const {addArgs} = operator`,
|
|
19
|
+
insertAfter: 'const {insertAfter} = operator',
|
|
19
20
|
replaceWith: `const {replaceWith} = operator`,
|
|
20
21
|
replaceWithMultiple: `const {replaceWithMultiple} = operator`,
|
|
21
22
|
remove: 'const {remove} = operator',
|
package/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ module.exports.rules = {
|
|
|
9
9
|
...getRule('apply-async-formatter'),
|
|
10
10
|
...getRule('apply-create-test'),
|
|
11
11
|
...getRule('apply-remove'),
|
|
12
|
+
...getRule('apply-insert-after'),
|
|
12
13
|
...getRule('apply-declare'),
|
|
13
14
|
...getRule('check-replace-code'),
|
|
14
15
|
...getRule('check-match'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"lerna": "^6.0.1",
|
|
45
45
|
"madrun": "^9.0.0",
|
|
46
46
|
"montag": "^1.2.1",
|
|
47
|
-
"nodemon": "^
|
|
47
|
+
"nodemon": "^3.0.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"putout": ">=30"
|