@putout/plugin-putout 11.1.0 → 11.1.1
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,6 +19,7 @@ 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",
|
|
22
23
|
"putout/add-args": "on",
|
|
23
24
|
"putout/add-push": "on",
|
|
24
25
|
"putout/convert-putout-test-to-create-test": "on",
|
|
@@ -65,6 +66,30 @@ test('', async ({process}) => {
|
|
|
65
66
|
});
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
## apply-remove
|
|
70
|
+
|
|
71
|
+
Better to use [`remove(path)`](https://github.com/coderaiser/putout/tree/master/packages/operate#removepath) method of `operator`.
|
|
72
|
+
It helps to preserve comments.
|
|
73
|
+
|
|
74
|
+
### ❌ Example of incorrect code
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
export const fix = (path) => {
|
|
78
|
+
path.remove();
|
|
79
|
+
};
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### ✅ Example of correct code
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import {operator} from 'putout';
|
|
86
|
+
const {remove} = operator;
|
|
87
|
+
|
|
88
|
+
export const fix = (path) => {
|
|
89
|
+
remove(path);
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
68
93
|
## apply-async-formatter
|
|
69
94
|
|
|
70
95
|
### ❌ Example of incorrect code
|
|
@@ -120,7 +145,7 @@ const test = putoutTest(__dirname, {
|
|
|
120
145
|
### ✅ Example of correct code
|
|
121
146
|
|
|
122
147
|
```js
|
|
123
|
-
import createTest from '@putout/test';
|
|
148
|
+
import {createTest} from '@putout/test';
|
|
124
149
|
|
|
125
150
|
const test = createTest(__dirname, {
|
|
126
151
|
'remove-unused-variables': rmVars,
|
|
@@ -460,6 +485,8 @@ module.exports.traverse = ({push}) => ({
|
|
|
460
485
|
|
|
461
486
|
## convert-add-argument-to-add-args
|
|
462
487
|
|
|
488
|
+
### ❌ Example of incorrect code
|
|
489
|
+
|
|
463
490
|
```js
|
|
464
491
|
const {operator} = require('putout');
|
|
465
492
|
const {addArgument} = operator;
|
|
@@ -482,6 +509,8 @@ module.exports = addArgs({
|
|
|
482
509
|
|
|
483
510
|
## convert-dirname-to-url
|
|
484
511
|
|
|
512
|
+
### ❌ Example of incorrect code
|
|
513
|
+
|
|
485
514
|
```js
|
|
486
515
|
import {createTest} from '@putout/test';
|
|
487
516
|
import plugin from '@putout/plugin-debugger';
|
|
@@ -506,11 +535,13 @@ const test = createTest(import.meta.url, {
|
|
|
506
535
|
|
|
507
536
|
## convert-url-to-dirname-
|
|
508
537
|
|
|
538
|
+
### ❌ Example of incorrect code
|
|
539
|
+
|
|
509
540
|
```js
|
|
510
541
|
const {createTest} = require('@putout/test');
|
|
511
542
|
const plugin = require('@putout/plugin-debugger');
|
|
512
543
|
|
|
513
|
-
const test = createTest(
|
|
544
|
+
const test = createTest(__dirname, {
|
|
514
545
|
'remove-debugger': plugin,
|
|
515
546
|
});
|
|
516
547
|
```
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {assign} = Object;
|
|
4
|
+
|
|
3
5
|
module.exports.report = () => `Use 'createTest' instead of 'putoutTest'`;
|
|
4
6
|
|
|
5
7
|
module.exports.filter = ({scope}) => !scope.bindings.createTest;
|
|
@@ -9,6 +11,14 @@ module.exports.include = () => [
|
|
|
9
11
|
];
|
|
10
12
|
|
|
11
13
|
module.exports.fix = (path) => {
|
|
14
|
+
const [first] = path.node.specifiers;
|
|
15
|
+
|
|
16
|
+
assign(first, {
|
|
17
|
+
type: 'ImportSpecifier',
|
|
18
|
+
kind: 'value',
|
|
19
|
+
imported: first.local,
|
|
20
|
+
});
|
|
21
|
+
|
|
12
22
|
path.scope.rename('putoutTest', 'createTest');
|
|
13
23
|
};
|
|
14
24
|
|
package/lib/declare/operator.js
CHANGED
|
@@ -13,6 +13,7 @@ module.exports = {
|
|
|
13
13
|
addArgs: `const {addArgs} = operator`,
|
|
14
14
|
replaceWith: `const {replaceWith} = operator`,
|
|
15
15
|
replaceWithMultiple: `const {replaceWithMultiple} = operator`,
|
|
16
|
+
remove: 'const {remove} = operator',
|
|
16
17
|
isESM: `const {isESM} = operator`,
|
|
17
18
|
getProperty: `const {getProperty} = operator`,
|
|
18
19
|
getProperties: `const {getProperties} = operator`,
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports.rules = {
|
|
|
8
8
|
...getRule('apply-processors-destructuring'),
|
|
9
9
|
...getRule('apply-async-formatter'),
|
|
10
10
|
...getRule('apply-create-test'),
|
|
11
|
+
...getRule('apply-remove'),
|
|
11
12
|
...getRule('convert-putout-test-to-create-test'),
|
|
12
13
|
...getRule('convert-to-no-transform-code'),
|
|
13
14
|
...getRule('convert-find-to-traverse'),
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "🐊Putout plugin helps with plugins development",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-putout#readme",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"release": false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"c8": "^7.5.0",
|
|
41
41
|
"eslint": "^8.0.1",
|
|
42
42
|
"eslint-plugin-node": "^11.0.0",
|
|
43
|
-
"eslint-plugin-putout": "^
|
|
43
|
+
"eslint-plugin-putout": "^15.0.0",
|
|
44
44
|
"lerna": "^4.0.0",
|
|
45
45
|
"madrun": "^9.0.0",
|
|
46
46
|
"montag": "^1.2.1",
|