Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Feature Request: newline-condition #3995

Closed
zheeeng opened this issue Jun 27, 2018 · 2 comments
Closed

Feature Request: newline-condition #3995

zheeeng opened this issue Jun 27, 2018 · 2 comments

Comments

@zheeeng
Copy link

zheeeng commented Jun 27, 2018

Rule: newline-condition

prefer

if (condition1
    || codition2
    || condition3
) {}

const pass = condition1
    && condition2
    && condition3

over

if (condition1 || codition2 || condition3) {}

const pass = condition1 && condition2 && condition3

Rationale

When we blame someone a condition statement, we can get the reason why this condition is added through the git commit message.

@giladgray
Copy link

@zheeeng this should probably be an option on an existing rule, tho i'm not sure the ideal choice off the top of my head. we have several that deal with whitespace and newlines.

Prettier handles this elegantly (if your conditions are longer than a single line). https://github.com/alexjoverm/tslint-config-prettier

@johnwiseheart
Copy link
Contributor

Going to close this in favor of prettier.

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

No branches or pull requests

3 participants