Skip to content

Commit

Permalink
docs: add destructuring examples for computed-property-spacing (#15423
Browse files Browse the repository at this point in the history
)

* 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>
  • Loading branch information
snitin315 and mdjermanovic committed Dec 14, 2021
1 parent 225f211 commit 3928175
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/rules/computed-property-spacing.md
Expand Up @@ -48,6 +48,9 @@ obj[foo ]
obj[ 'foo']
var x = {[ b ]: a}
obj[foo[ bar ]]

const { [ a ]: someProp } = obj;
({ [ b ]: anotherProp } = anotherObj);
```

Examples of **correct** code for this rule with the default `"never"` option:
Expand All @@ -60,6 +63,9 @@ obj[foo]
obj['foo']
var x = {[b]: a}
obj[foo[bar]]

const { [a]: someProp } = obj;
({ [b]: anotherProp } = anotherObj);
```

### always
Expand All @@ -76,6 +82,8 @@ obj[ foo]
obj['foo' ]
obj[foo[ bar ]]
var x = {[ b]: a}
const { [a]: someProp } = obj;
({ [b ]: anotherProp } = anotherObj);
```

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

#### enforceForClassMembers
Expand Down

0 comments on commit 3928175

Please sign in to comment.