Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 763 Bytes

no-useless-rest-spread.md

File metadata and controls

35 lines (25 loc) · 763 Bytes

Disallow unnecessary rest/spread operators (no-useless-rest-spread)

(fixable) The --fix option on the command line automatically fixes problems reported by this rule.

Rule Details

Examples of incorrect code for this rule:

/*eslint no-useless-rest-spread: "error"*/

let list = [a, ...[b, c], d]
let obj = {a, ...{b, c}, d}
foo(...[a, b, c])

let [a, b, ...[c, d]] = list;
let {a, b, ...{c, d}} = obj;
function foo(a, b, ...[c, d]) {
}

Examples of correct code for this rule:

/*eslint no-useless-rest-spread: "error"*/

let list = [a, b, c, d]
let obj = {a, b, c, d}
foo(a, b, c)

let [a, b, c, d] = list;
let {a, b, c, d} = obj;
function foo(a, b, c, d) {
}