Skip to content

Commit 3928175

Browse files
docs: add destructuring examples for computed-property-spacing (#15423)
* docs: add destructuring examples for `computed-property-spacing` * docs: suggestions from code review Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
1 parent 225f211 commit 3928175

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/rules/computed-property-spacing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ obj[foo ]
4848
obj[ 'foo']
4949
var x = {[ b ]: a}
5050
obj[foo[ bar ]]
51+
52+
const { [ a ]: someProp } = obj;
53+
({ [ b ]: anotherProp } = anotherObj);
5154
```
5255

5356
Examples of **correct** code for this rule with the default `"never"` option:
@@ -60,6 +63,9 @@ obj[foo]
6063
obj['foo']
6164
var x = {[b]: a}
6265
obj[foo[bar]]
66+
67+
const { [a]: someProp } = obj;
68+
({ [b]: anotherProp } = anotherObj);
6369
```
6470

6571
### always
@@ -76,6 +82,8 @@ obj[ foo]
7682
obj['foo' ]
7783
obj[foo[ bar ]]
7884
var x = {[ b]: a}
85+
const { [a]: someProp } = obj;
86+
({ [b ]: anotherProp } = anotherObj);
7987
```
8088

8189
Examples of **correct** code for this rule with the `"always"` option:
@@ -88,6 +96,8 @@ obj[ foo ]
8896
obj[ 'foo' ]
8997
var x = {[ b ]: a}
9098
obj[ foo[ bar ] ]
99+
const { [ a ]: someProp } = obj;
100+
({ [ b ]: anotherProp } = anotherObj);
91101
```
92102

93103
#### enforceForClassMembers

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy