Ensures keys are sorted for object destructuring.
Makes sure the keys from object destructuring are sorted properly.
The following patterns are not considered problems:
/* eslint wyze/sort-destructuring-keys: 'error' */
const props = { a: 1, b: 2, B: 3 }
const { a, b } = props
const { B, a } = props
const { ['b'.toUpperCase()]: c, a } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'desc'] */
const { b, a } = props
const { a, B } = props
const { ['b'.toUpperCase()]: c, B } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'asc', { caseSensitive: false }] */
const { B, a } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'asc', { ignoreComputed: true }] */
const { a, b, ['b'.toUpperCase()]: c } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'asc', { ignoreDefaults: false }] */
const { b, a = b } = props
The following patterns are considered problems:
/* eslint wyze/sort-destructuring-keys: 'error' */
const props = { a: 1, b: 2, B: 3 }
const { b, a } = props
const { a, B } = props
const { a, b, ['b'.toUpperCase()]: c } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'desc'] */
const { a, b } = props
const { a, B } = props
/* eslint wyze/sort-destructuring-keys: ['error', 'asc', { caseSensitive: false }] */
const { B, a } = props
Specify which way you would like the keys to be sorted.
The next set of options are an object with the following properties.
Turn off case sensitivity sorting.
Include default values so some property may be placed before other properties.
Ignore computed properties so they don't have to appear before other properties.
You can turn this rule off if you are not concerned with the order of your destructuring keys.