@putout/plugin-putout 12.0.0 β 12.0.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 +27 -0
- package/lib/apply-declare/index.js +8 -0
- package/lib/declare/index.js +8 -4
- package/lib/index.js +1 -0
- package/package.json +2 -3
- package/lib/declare/declarations.js +0 -12
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ npm i @putout/plugin-putout -D
|
|
|
20
20
|
"putout/apply-processors-destructuring": "on",
|
|
21
21
|
"putout/apply-async-formatter": "on",
|
|
22
22
|
"putout/apply-remove": "on",
|
|
23
|
+
"putout/apply-declare": "on",
|
|
23
24
|
"putout/add-args": "on",
|
|
24
25
|
"putout/add-push": "on",
|
|
25
26
|
"putout/convert-putout-test-to-create-test": "on",
|
|
@@ -93,6 +94,32 @@ export const fix = (path) => {
|
|
|
93
94
|
};
|
|
94
95
|
```
|
|
95
96
|
|
|
97
|
+
## apply-declare
|
|
98
|
+
|
|
99
|
+
Better to use [`Declareator`](https://github.com/coderaiser/putout/tree/master/packages/engine-runner#declarator) instead of `operator.declare()`.
|
|
100
|
+
Check out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/cf35de5e80e8f7aad866358a50c5eded/0af6142fc9c9e71ac2a2aa96cb85613dd95c9fbf).
|
|
101
|
+
|
|
102
|
+
### β Example of incorrect code
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
const {operator} = require('putout');
|
|
106
|
+
const {declare} = operator;
|
|
107
|
+
|
|
108
|
+
module.exports = declare({
|
|
109
|
+
tryCatch: `import tryCatch from 'try-catch'`,
|
|
110
|
+
tryToCatch: `import tryToCatch from 'try-to-catch'`,
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### β
Example of correct code
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
module.exports.declare = () => ({
|
|
118
|
+
tryCatch: `import tryCatch from 'try-catch'`,
|
|
119
|
+
tryToCatch: `import tryToCatch from 'try-to-catch'`,
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
96
123
|
## apply-async-formatter
|
|
97
124
|
|
|
98
125
|
### β Example of incorrect code
|
package/lib/declare/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const {declare} = operator;
|
|
3
|
+
const types = require('./types');
|
|
4
|
+
const operator = require('./operator');
|
|
6
5
|
|
|
7
|
-
module.exports =
|
|
6
|
+
module.exports.declare = () => ({
|
|
7
|
+
template: `import {template} from 'putout'`,
|
|
8
|
+
createTest: `import {createTest} from '@putout/test'`,
|
|
9
|
+
...operator,
|
|
10
|
+
...types,
|
|
11
|
+
});
|
|
8
12
|
|
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-declare'),
|
|
12
13
|
...getRule('convert-putout-test-to-create-test'),
|
|
13
14
|
...getRule('convert-to-no-transform-code'),
|
|
14
15
|
...getRule('convert-find-to-traverse'),
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.1",
|
|
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",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-putout#readme",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
-
"commitType": "colon",
|
|
10
9
|
"release": false,
|
|
11
10
|
"tag": false,
|
|
12
11
|
"changelog": false,
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"putout"
|
|
38
37
|
],
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@putout/test": "^
|
|
39
|
+
"@putout/test": "^6.0.0",
|
|
41
40
|
"c8": "^7.5.0",
|
|
42
41
|
"eslint": "^8.0.1",
|
|
43
42
|
"eslint-plugin-n": "^15.2.4",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const types = require('./types');
|
|
4
|
-
const operator = require('./operator');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
template: `import {template} from 'putout'`,
|
|
8
|
-
createTest: `import {createTest} from '@putout/test'`,
|
|
9
|
-
...operator,
|
|
10
|
-
...types,
|
|
11
|
-
};
|
|
12
|
-
|