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

prefer-conditional-expression: avoid error on nested if statement #3528

Merged
merged 1 commit into from
Nov 30, 2017
Merged

prefer-conditional-expression: avoid error on nested if statement #3528

merged 1 commit into from
Nov 30, 2017

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Nov 29, 2017

PR checklist

Overview of change:

[bugfix] prefer-conditional-expression: don't repeat error on nested if statements
Fixes: #3350

Is there anything you'd like reviewers to focus on?

To fix the above issue, only the change under the // Be careful not to fail again for the "else if" comment is necessary.
While adding tests, I noticed that check-else-if added the error on the inner if when nesting with blocks. I fixed that along the way which leads to a bigger refactor.

CHANGELOG.md entry:

[bugfix] `prefer-conditional-expression`: don't repeat error on nested if statements
Fixes: #3350
if (length === 1) {
x = "bar";
} else {
if (length === 2) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error used to be reported on this line. I fixed that while I was already touching the code.

@ajafff ajafff merged commit 3db5fcf into palantir:master Nov 30, 2017
@ajafff ajafff deleted the bugfix/prefer-conditional-nested branch November 30, 2017 08:13
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
…lantir#3528)

[bugfix] `prefer-conditional-expression`: don't repeat error on nested if statements
Fixes: palantir#3350
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prefer-conditional-expression: checks deeply nested else if
2 participants