Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add destructuring examples for computed-property-spacing #15423

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/rules/computed-property-spacing.md
Expand Up @@ -48,6 +48,10 @@ obj[foo ]
obj[ 'foo']
var x = {[ b ]: a}
obj[foo[ bar ]]

// applies to the spacing for dynamic keys (computed property key) when destructuring objects.
snitin315 marked this conversation as resolved.
Show resolved Hide resolved
const { [ a ]: someProp } = obj;
({ [ b ]: anotherProp } = anotherObj);
```

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

// applies to the spacing for dynamic keys (computed property key) when destructuring objects.
snitin315 marked this conversation as resolved.
Show resolved Hide resolved
const { [a]: someProp } = obj;
({ [b]: anotherProp } = anotherObj);
```

### always
Expand All @@ -76,6 +84,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 +98,8 @@ obj[ foo ]
obj[ 'foo' ]
var x = {[ b ]: a}
obj[ foo[ bar ] ]
const { [ a ]: someProp } = obj;
({ [ b ]: anotherProp } = anotherObj);
```

#### enforceForClassMembers
Expand Down