question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule Proposal: prefer-destructuring

See original GitHub issue

From requireArrayDestructuring and requireObjectDestructuring.

This rule will warn MemberExpressions as the favor of destructuring assignments.

{
    "prefer-destructuring": ["error", {"object": true, "array": true}]
}

JSCS documents seem to say that this doesn’t prefer nested destructuring. How do we address nested destructuring?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27 (22 by maintainers)

github_iconTop GitHub Comments

5reactions
platinumazurecommented, Aug 3, 2016

I think we can agree on one level for now, just so we have something for users.

All in favor? 👍 from me.

3reactions
alexlafrosciacommented, Dec 11, 2016

I’m putting the PR together to add the rule I already created as part of the core rules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

prefer-destructuring - ESLint - Pluggable JavaScript Linter
This rule enforces usage of destructuring instead of accessing a property through a member expression.
Read more >
Rule proposal: prefer-destructured-variables #1230 - GitHub
I understand we already have consistent-destructuring, and it already covers cases I'm going to post, but that rule is buggy, ...
Read more >
ESLint: prefer-destructuring - Styleguide JavaScript
Use object destructuring when accessing and using multiple properties of an object. Destructuring avoids the usage of temporary references for those ...
Read more >
What to do when ESLint rule "prefer-destructuring" makes no ...
The first example would be solved by const [firstItem] = myList; obj. · I know. · if you find it useful in general...
Read more >
Rule proposal: `prefer-destructured-variables` #1230 - Issuehunt
Rule proposal : `prefer-destructured-variables` #1230. fisker posted onGitHub. <!-- Please don't ignore this template -->.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found