Skip to content

Commit

Permalink
Docs: Add prefer-destructuring examples (fixes eslint#9970)
Browse files Browse the repository at this point in the history
Add examples for the `prefer-destructuring` rules when `enforceForRenamedProperties` is enabled.
  • Loading branch information
pvdlg committed Feb 18, 2018
1 parent 883a2a2 commit 4a684d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/rules/prefer-destructuring.md
Expand Up @@ -46,12 +46,20 @@ let foo;
Examples of **incorrect** code when `enforceForRenamedProperties` is enabled:

```javascript
// With `array` enabled
var foo = array[someIndex];

// With `object` enabled
var foo = object.bar;
```

Examples of **correct** code when `enforceForRenamedProperties` is enabled:

```javascript
// With `array` enabled
var { [someIndex]: foo } = array;

// With `object` enabled
var { bar: foo } = object;
```

Expand Down

0 comments on commit 4a684d2

Please sign in to comment.