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
Closed

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

danez opened this issue Mar 22, 2017 · 5 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@danez
Copy link

danez 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 An ESLint team member will look at this issue soon label Mar 22, 2017
@vitorbal vitorbal added bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Apr 6, 2017
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Apr 22, 2017
@not-an-aardvark
Copy link
Member

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

@VictorHom
Copy link
Member

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

@not-an-aardvark
Copy link
Member

Thanks @VictorHom!

@pvdlg
Copy link
Contributor

pvdlg 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
Copy link
Member

nzakas 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
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 18, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants