@putout/plugin-destructuring 1.0.0 → 1.0.2
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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-destructuring.svg?style=flat&longCache=true
|
|
4
4
|
[NPMURL]: https://npmjs.org/package/@putout/plugin-destructuring"npm"
|
|
5
5
|
|
|
6
|
-
> The **destructuring** assignment syntax is a **JavaScript** expression that makes it possible to unpack values from arrays
|
|
6
|
+
> The **destructuring** assignment syntax is a **JavaScript** expression that makes it possible to unpack values from `arrays`, or `properties` from `objects`, into distinct `variables`.
|
|
7
7
|
>
|
|
8
8
|
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)
|
|
9
9
|
|
|
@@ -23,6 +23,7 @@ npm i @putout/plugin-destructuring
|
|
|
23
23
|
- ✅ [convert-object-to-array](#convert-object-to-array);
|
|
24
24
|
- ✅ [split-nested](#split-nested);
|
|
25
25
|
- ✅ [split-call](#split-call);
|
|
26
|
+
- ✅ [merge-properties](#merge-properties);
|
|
26
27
|
|
|
27
28
|
## Config
|
|
28
29
|
|
|
@@ -32,7 +33,10 @@ npm i @putout/plugin-destructuring
|
|
|
32
33
|
"destructuring/apply-object": "on",
|
|
33
34
|
"destructuring/apply-array": "on",
|
|
34
35
|
"destructuring/remove-useless-object": "on",
|
|
35
|
-
"destructuring/convert-object-to-array": "on"
|
|
36
|
+
"destructuring/convert-object-to-array": "on",
|
|
37
|
+
"destructuring/split-nested": "on",
|
|
38
|
+
"destructuring/split-call": "on",
|
|
39
|
+
"destructuring/merge-properties": "on"
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
```
|
|
@@ -163,10 +167,6 @@ console.log('hello');
|
|
|
163
167
|
|
|
164
168
|
## merge-properties
|
|
165
169
|
|
|
166
|
-
> The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from `arrays`, or `properties` from `objects`, into distinct `variables`.
|
|
167
|
-
>
|
|
168
|
-
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)
|
|
169
|
-
|
|
170
170
|
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/11c8cfa59f87e46238309b857448b9c5/688f10ad8fd7c0e4d9e9e0c74c399f1edb3ba29e).
|
|
171
171
|
|
|
172
172
|
### ❌ Example of incorrect code
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as convertObjectToArray from './convert-object-to-array/index.js';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
2
|
+
import * as applyObject from './apply-object/index.js';
|
|
3
|
+
import * as applyArray from './apply-array/index.js';
|
|
4
|
+
import * as removeUselessObject from './remove-useless-object/index.js';
|
|
5
5
|
import * as splitNested from './split-nested/index.js';
|
|
6
6
|
import * as splitCall from './split-call/index.js';
|
|
7
7
|
import * as mergeProperties from './merge-properties/index.js';
|
|
8
8
|
|
|
9
9
|
export const rules = {
|
|
10
|
-
'apply-object':
|
|
11
|
-
'apply-array':
|
|
12
|
-
'remove-useless-object':
|
|
10
|
+
'apply-object': applyObject,
|
|
11
|
+
'apply-array': applyArray,
|
|
12
|
+
'remove-useless-object': removeUselessObject,
|
|
13
13
|
'convert-object-to-array': convertObjectToArray,
|
|
14
14
|
'split-nested': splitNested,
|
|
15
15
|
'split-call': splitCall,
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|