From 3928175d01c6ac2b37147b3256c56df8faf2c6c4 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Tue, 14 Dec 2021 23:05:28 +0530 Subject: [PATCH] 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 Co-authored-by: Milos Djermanovic --- docs/rules/computed-property-spacing.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/rules/computed-property-spacing.md b/docs/rules/computed-property-spacing.md index 3fdd70ce001..903642391b0 100644 --- a/docs/rules/computed-property-spacing.md +++ b/docs/rules/computed-property-spacing.md @@ -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: @@ -60,6 +63,9 @@ obj[foo] obj['foo'] var x = {[b]: a} obj[foo[bar]] + +const { [a]: someProp } = obj; +({ [b]: anotherProp } = anotherObj); ``` ### always @@ -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: @@ -88,6 +96,8 @@ obj[ foo ] obj[ 'foo' ] var x = {[ b ]: a} obj[ foo[ bar ] ] +const { [ a ]: someProp } = obj; +({ [ b ]: anotherProp } = anotherObj); ``` #### enforceForClassMembers