Skip to content

Commit

Permalink
Reconfigure prefer-destructuring rule
Browse files Browse the repository at this point in the history
This reconfigures the rule to not require destructuring for arrays.
Also, removes custom implementation to just use the one provided by
eslint.
  • Loading branch information
Serabe committed Jul 27, 2018
1 parent 6e03edd commit 7736f83
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 106 deletions.
2 changes: 1 addition & 1 deletion config/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
'no-var': 'error',
'no-useless-rename': 'error',
'object-shorthand': ['error', 'always'],
'prefer-destructuring': 'error',
'prefer-destructuring': ['error', { array: false, object: true }, { enforceForRenamedProperties: false }],
'prefer-spread': 'error',
'prefer-template': 'error',
'eol-last': ['error', 'always'],
Expand Down
92 changes: 0 additions & 92 deletions lib/rules/prefer-destructuring.js

This file was deleted.

1 change: 1 addition & 0 deletions tests/fixtures/prefer-destructuring/bad/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let foo = SomeThing.foo;
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable prefer-destructuring */
let { foo } = SomeThing;
let { bar } = SomeThing.Baz;

Expand All @@ -8,4 +7,7 @@ const { get } = SomeThing;
const { set } = SomeThing;

const { val } = SomeThing['some.key'];
/* eslint-enable prefer-destructuring */

let arr = [1, 2, 3, 4];
let [one] = arr;
let alsoOne = arr[0];

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions tests/fixtures/require-array-destructuring/good/example.js

This file was deleted.

0 comments on commit 7736f83

Please sign in to comment.