Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
function foo (obj1, obj2, array) {
var a = obj1.a; // Noncompliant
var b = obj1.b;
var name = obj2.name; // ignored; there's only one extraction-and-assignment
var zero = array[0]; // Noncompliant
var one = array[1];
}function foo (obj1, obj2, array) {
var {a, b} = obj1;
var {name} = obj2; // this syntax works because var name and property name are the same
var [zero, one] = array;
}Popular · 1 of 42
Destructuring syntax should be used for assignments
function foo (obj1, obj2, array) {
var a = obj1.a; // Noncompliant
var b = obj1.b;
var name = obj2.name; // ignored; there's only one extraction-and-assignment
var zero = array[0]; // Noncompliant
var one = array[1];
}function foo (obj1, obj2, array) {
var {a, b} = obj1;
var {name} = obj2; // this syntax works because var name and property name are the same
var [zero, one] = array;
}