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

no-redeclare does not work with renaming in destructures inside for-loop #8071

Closed
zdbrandt opened this issue Feb 13, 2017 · 6 comments
Closed
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion needs info Not enough information has been provided to triage this issue triage An ESLint team member will look at this issue soon

Comments

@zdbrandt
Copy link

I'm running:
eslint: v3.13.1
node: v6.9.1
npm: 3.10.8
Babel-ESLint: v7.1.1

Here's the code:

function foo(params) {
    for (let i = 0; i < params.length; ++i) {
        const { value: paramValue } = params[i];
        const paramValue = params[i].value;
    }
}

I expect to get a no-redeclare error thrown by eslint. However I am not receiving any errors. ESLint just shows that there are no errors. If I get rid of the for-loop, ESLint properly throws errors.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Feb 13, 2017
@not-an-aardvark
Copy link
Member

This is actually a syntax error -- it should cause a parsing failure, since variables declared with const can't be redeclared.

Also see: acornjs/acorn#487

@mysticatea
Copy link
Member

I could not reproduce this on our online demo.

image

@mysticatea
Copy link
Member

Also, I could not reproduce this with babel-eslint.

@eslintbot
Copy link

Hi @zachdini, thanks for the issue. It looks like there's not enough information for us to know how to help you.

If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

Requesting a rule change? Please see Proposing a Rule Change for instructions.

If it's something else, please just provide as much additional information as possible. Thanks!

@mysticatea mysticatea added the needs info Not enough information has been provided to triage this issue label Feb 14, 2017
@zdbrandt
Copy link
Author

@not-an-aardvark Not sure how I missed that. Thanks for the info. Didn't cause a parsing error so I'll have to look into that.

@alberto
Copy link
Member

alberto commented Mar 11, 2017

Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues!

@alberto alberto closed this as completed Mar 11, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@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 Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion needs info Not enough information has been provided to triage this issue triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

5 participants