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-shadow does not catch shadowing when the shadowing is inside if statement #2294

Closed
grabus opened this issue Apr 12, 2015 · 7 comments
Closed
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

@grabus
Copy link

grabus commented Apr 12, 2015

The following pattern is caught:

let foo = 1;
function bar () {
    let foo = 2;
}

But this is not caught:

let foo = 1;
function bar () {
  if (1) {
    let foo = 2;
  }
}

These are both equivalent examples of shadowing and should thus both be flagged by the rule.

ESLint version: v0.18.0

@gyandeeps
Copy link
Member

As of now I dont think this rule takes into consideration blockBindings. Thats why it fails to flag that.

@btmills btmills added bug ESLint is working incorrectly rule Relates to ESLint's core rules labels Apr 13, 2015
@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label Apr 13, 2015
@nzakas
Copy link
Member

nzakas commented Apr 13, 2015

Can you try upgrading to 0.19.0 and see if there's a difference?

@grabus
Copy link
Author

grabus commented Apr 13, 2015

Yep, I've upgraded to 0.19.0 and there is no difference.

@nzakas
Copy link
Member

nzakas commented Apr 13, 2015

Okay thanks, we'll take a look.

@nzakas
Copy link
Member

nzakas commented May 8, 2015

Working on this.

@nzakas
Copy link
Member

nzakas commented May 8, 2015

Not working on this anymore. Free for someone else to pick up.

@jrvidal
Copy link
Contributor

jrvidal commented May 13, 2015

Working on this.

jrvidal added a commit to jrvidal/eslint that referenced this issue May 13, 2015
@nzakas nzakas closed this as completed in 3fb9fce May 14, 2015
nzakas added a commit that referenced this issue May 14, 2015
Fix: forced no-shadow to check all scopes (fixes #2294)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 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 7, 2018
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

No branches or pull requests

5 participants