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

Bug: block-scoped-var rule incorrectly flags break/continue with label #3082

Closed
aparajita opened this issue Jul 19, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@aparajita
Copy link
Contributor

commented Jul 19, 2015

Currently, the block-scoped-var rule generates false warnings for break and continue statements that use labels.

Version: v0.24.1

Source:

/* eslint no-labels:0, block-scoped-var:2 */

foo:
for (var i = 0; i < 10; ++i) {
    bar:
    for (var j = 0; j < 13; ++j) {
        if (j === 7) {
            continue foo;  // warning
        }

        if (j === 2) {
            break bar;  // warning
        }
    }
}

Config: Invoked with eslint --no-eslintrc --reset, so the complete config is in the source config.

Output:

   8:21  error  "foo" used outside of binding context  block-scoped-var
  12:18  error  "bar" used outside of binding context  block-scoped-var
@eslintbot

This comment has been minimized.

Copy link

commented Jul 19, 2015

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you've included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. The source code that caused the problem
  3. The configuration you're using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule - what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don't mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Thanks!

@aparajita aparajita closed this Jul 19, 2015

@aparajita aparajita changed the title False warnings when using break/continue False warnings when using break/continue with labels Jul 19, 2015

@aparajita aparajita reopened this Jul 19, 2015

@aparajita

This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2015

I have a fix, will be submitting it soon.

@aparajita aparajita changed the title False warnings when using break/continue with labels Bug: block-scoped-var rule incorrectly flags break/continue with label Jul 20, 2015

ilyavolodin added a commit that referenced this issue Jul 20, 2015

Merge pull request #3085 from aparajita/fix-break-continue-labels
Fix: block-scoped-var rule incorrectly flagging break/continue with label (fixes #3082)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

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