noEmptyPattern (since v0.7.0)
This rule is recommended by Rome.
Disallows empty destructuring patterns.
Examples
Invalid
var {} = foo; error[js/noEmptyPattern]: Unexpected empty object pattern.
┌─ js/noEmptyPattern.js:1:5
│
1 │ var {} = foo;
│ ^^
var {a: {}} = foo; error[js/noEmptyPattern]: Unexpected empty object pattern.
┌─ js/noEmptyPattern.js:1:9
│
1 │ var {a: {}} = foo;
│ ^^
function foo({}) {} error[js/noEmptyPattern]: Unexpected empty object pattern.
┌─ js/noEmptyPattern.js:1:14
│
1 │ function foo({}) {}
│ ^^
Valid
The following cases are valid because they create new bindings.
var {a = {}} = foo;
var {a, b = {}} = foo;
var {a = []} = foo;
function foo({a = {}}) {}
function foo({a = []}) {}
var [a] = foo;