Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive in prefer-const and array-destructuring #8308

Closed
danez opened this issue Mar 22, 2017 · 5 comments

Comments

@danez
Copy link

commented Mar 22, 2017

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.

@eslintbot eslintbot added the triage label Mar 22, 2017

@vitorbal vitorbal added bug evaluating rule and removed triage labels Apr 6, 2017

@not-an-aardvark not-an-aardvark added accepted and removed evaluating labels Apr 22, 2017

@not-an-aardvark

This comment has been minimized.

Copy link
Member

commented Apr 22, 2017

Thanks for the report. I was able to reproduce this issue.

@VictorHom

This comment has been minimized.

Copy link
Member

commented Jun 25, 2017

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

@not-an-aardvark

This comment has been minimized.

Copy link
Member

commented Jun 25, 2017

Thanks @VictorHom!

@pvdlg

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2018

If that can help, the same happen with Object destructuring:

let a;
const b = {};

({a, c: b.c} = func());

4:3 - 'a' is never reassigned. Use 'const' instead. (prefer-const)

@nzakas

This comment has been minimized.

Copy link
Member

commented Oct 4, 2018

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

@nzakas nzakas self-assigned this Oct 4, 2018

nzakas added a commit that referenced this issue Oct 5, 2018

@eslint eslint bot locked and limited conversation to collaborators Apr 18, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants
You can’t perform that action at this time.