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.

False-positive in prefer-const and array-destructuring

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.18.0
  • Node Version: 6.10.0
  • npm Version: 4.4.4

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

{
  "ecmaVersion": 7,
  "rules": [
    "prefer-const"
  ]
}

What did you do? Please include the actual source code causing the issue.

let predicate;
[typeNode.returnType, predicate] = foo();

What did you expect to happen?

No error

What actually happened? Please include the actual, raw output from ESLint.

2:23 - 'predicate' is never reassigned. Use 'const' instead. (prefer-const)

The rule should consider that it is not possible to actually make predicate a const here.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
nzakascommented, Oct 4, 2018

This seems like a pretty significant bug. I’d like to take a stab at fixing this.

1reaction
VictorHomcommented, Jun 25, 2017

I would like to look into this issue as well if no one is working on this 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >
prefer-const - 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 >
Typescript object destructuring is caught by ESLint no-unused ...
I have an object in Typescript that I am destructuring in order to extract a partial object. However, it fails ...
Read more >
ESLint v2.0.0 released - ESLint中文文档
186e8f0 Update: Ignore camelcase in object destructuring (fixes #3185) (alberto) ... 361377f Fix: prefer-const false positive reading before writing (fixes ...
Read more >
vue/no-ref-object-destructure
This rule also supports Reactivity Transform, but Reactivity Transform is an experimental feature and may have false positives due to future ...
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