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

"Unnecessary { after 'else'" error appears on wrong line #4362

andy-hanson opened this issue Nov 8, 2015 · 2 comments


None yet
3 participants
Copy link

commented Nov 8, 2015

This is the code I'm linting:

if (0)
else if (1) {
    // Above curly brace is necessary.
} else {
    // Above curly brace is unnecessary.
    if (2)

And here's my package.json:

    "scripts": {
        "lint": "eslint src test"
    "devDependencies": {
        "eslint": "1.9.0"
    "eslintConfig": {
        "rules": {
            "curly": [1, "multi"]

I get the following error:

  3:6  warning  Unnecessary { after 'else'  curly

✖ 1 problem (0 errors, 1 warning)

which is the correct error but has the wrong line number.
The error should be for the last else, on line 7.


This comment has been minimized.

Copy link

commented Nov 9, 2015

This isn't an issue with the wrong line number showing in the message. The first else is incorrectly being flagged. It's probably confused because there's an if right after it (which is one statement) and then a curly.

@mysticatea mysticatea self-assigned this Nov 15, 2015


This comment has been minimized.

Copy link

commented Nov 15, 2015

I'm working on this.

mysticatea added a commit to mysticatea/eslint that referenced this issue Nov 15, 2015

@nzakas nzakas closed this in #4430 Nov 15, 2015

@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.