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

nonblock-statement-body-position Errors on Correct Code #8202

Closed
epmatsw opened this issue Mar 4, 2017 · 1 comment · Fixed by singapore/lint-condo#244 or renovatebot/renovate#123 · May be fixed by iamhunter/teammates#4
Closed
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

@epmatsw
Copy link

epmatsw commented Mar 4, 2017

Tell us about your environment

  • ESLint Version: 3.17.0
  • Node Version: 7.6.0
  • npm Version: 4.1.2

What parser (default, Babel-ESLint, etc.) are you using?
Default

Please show your full configuration:

{
    rules: {
        'nonblock-statement-body-position':  2
    }
}

What did you do? Please include the actual source code causing the issue.

function blah() {
    if (window.hey) return window.doit({
        asdf: 2,
    });
    return 1;
}

What did you expect to happen?
No errors.

What actually happened? Please include the actual, raw output from ESLint.

3:21 error Expected no linebreak before this statement nonblock-statement-body-position

Even if the rule doesn't allow expressions that extend onto the next line (which would be a bit of a bummer), the error message doesn't make a whole lot of sense.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Mar 4, 2017
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Mar 4, 2017
@not-an-aardvark
Copy link
Member

Thanks for the report, I can reproduce this issue.

The intended behavior is that this code should be valid. It looks like the rule is reporting an error when the statement is multiline, even if it starts on the same line as the if statement.

@epmatsw epmatsw changed the title nonblock-statement-body-position Errors on Potentially Correct Code nonblock-statement-body-position Errors on Correct Code Mar 4, 2017
@not-an-aardvark not-an-aardvark self-assigned this Mar 4, 2017
not-an-aardvark added a commit that referenced this issue Mar 4, 2017
The nonblock-statement-body-position rule is intended to compare the *start* line of a statement with the end line of the previous token. Due to a typo, it was comparing the *end* line of the statement instead, which caused false positives for multiline statements.
@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
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
3 participants