I understand we already have consistent-destructuring
, and it already covers cases I'm going to post, but that rule is buggy, and I don't like destructuring all used properties in one, I prefer destructuring when needed, for example:
const {a} = foo;
if (a) {
// ... do something not related to `foo.b`
}
const {b} = foo;
// ... do something with `b`
const {a} = foo;
console.log(foo.a);
const {a} = foo;
console.log(a, foo.b);
It's like splitting consistent-destructuring
into two rules, this one and another like prefer-one-destructuring
.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too