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

warns wrong line number with if-else #2

Open
Imarok opened this issue Jul 17, 2017 · 0 comments
Open

warns wrong line number with if-else #2

Imarok opened this issue Jul 17, 2017 · 0 comments

Comments

@Imarok
Copy link

Imarok commented Jul 17, 2017

There is a slight error in your plugin:
Using that config

  "plugins": [
    "brace-rules"
  ],
  "rules": {
    "brace-rules/brace-on-same-line": ["warn", {
      "FunctionDeclaration": "never",
      "FunctionExpression": "never",
      "ArrowFunctionExpression": "always",
      "IfStatement": "never",
      "TryStatement": "never",
      "CatchClause": "never",
      "DoWhileStatement": "never",
      "WhileStatement": "never",
      "ForStatement": "never",
      "ForInStatement": "never",
      "ForOfStatement": "never",
      "SwitchStatement": "never"
    }, { "allowSingleLine": true }]
  }

with this code:

function bar()
{
	if (foo)
	{
		a();
		b();
	}
	else {
		b();
		a();
	}
}

produces this warning: 3:2 warning Opening curly brace appears on the same line as controlling statement brace-rules/brace-on-same-line
So it points to the if (foo), but it should point to else {.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant