Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upEnable rule `padding-line-between-statements` #1342
Comments
This comment has been minimized.
This comment has been minimized.
|
I opened an issue about this on ESLint a while ago: eslint/eslint#7116 They added a rule specifically to address this: |
feross
changed the title
Lint if conditions in the same line
Enable rule `padding-line-between-statements`
May 23, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm not completely convinced about that rule. I see the same problem that you mention in that issue. By enabling that rule you are forced to leave a line between if statements. So:
would be disallowed. Moreover, since it can be "automatically" fixed, |
This comment has been minimized.
This comment has been minimized.
|
I personally think that looks better with an empty line between it if (...) {
// something
}
if (...) {
// another if
} |
This comment has been minimized.
This comment has been minimized.
|
Add this to the list for Standard 14 (#1321)? |
This comment has been minimized.
This comment has been minimized.
|
It seems like the rule that ESLint added doesn't work for our purposes, but I may have misunderstood something, so I just opened an issue to clarify: eslint/eslint#12033 |
furstenheim commentedMay 20, 2018
Hi,
I'd like to propose a new rule to standard config. When having a chain of if conditions the following is not linted as an error:
This is misleading because on a quick glance the second condition would be expected to be an
else ifinstead of anif.Would you be interested in including a rule to avoid that possible error? I think there is no real situation where that would be something expected.
I've already written a plugin and I could write the pr to add it to the config.
Cheers