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.

Make prefer-destructuring fixable

See original GitHub issue

What rule do you want to change? prefer-destructuring

Does this change cause the rule to produce more or fewer warnings? same

Please provide some example code that this change will affect:

// This
const z = a.z
// should autofix to this
const { z } = a

Are you willing to submit a pull request to implement this change? no

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
sindresorhuscommented, Dec 27, 2018

I would be happy if it only auto-fixed the simple case, like let x = a.x; => let {x} = a;.

2reactions
ilyavolodincommented, Feb 1, 2019

I think supporting auto-fixing for the most basic cases is fine for this rule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

prefer-destructuring - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
How to fix Eslint error "prefer-destructuring"? - Stack Overflow
It's an ES6 feature used to unpack variables from arrays or objects. this syntax create an array from variables: var x = [y,...
Read more >
prefer-destructuring - Rules - ESLint - GitHub Pages
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
JavaScript : How to fix Eslint error "prefer-destructuring"?
JavaScript : How to fix Eslint error " prefer - destructuring "? [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] JavaScript :...
Read more >
Use Object Destructuring.Eslint(Prefer-Destructuring) - ADocLib
Prefer destructuring from arrays and objects preferdestructuring. The fix option on the command line can automatically fix some of the problems reported by...
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