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

Lint for consistency in multiline vs single-line "if" and "else" #524

Merged
merged 4 commits into from
Apr 20, 2023

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Apr 20, 2023

See tc39/ecma262#3043.

Needed some minor refactoring to have enough context to apply the rule, so I recommend reviewing commits individually.

Calling this major due to adding a new on-by-default lint rule, which will break the build of most nontrivial specs.

}
);
});

Copy link
Contributor

Choose a reason for hiding this comment

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

There should maybe be a couple tests with a mismatch between If and Else if.

Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

Code LGTM but could use a few more tests. Two negative tests for if/else without else-if. And as @jmdyck points out, positive tests where if and else-if do not agree.

@bakkot bakkot force-pushed the lint-inconsistent-if branch from abda892 to cc37421 Compare April 20, 2023 19:15
@bakkot bakkot merged commit 42016dd into main Apr 20, 2023
@bakkot bakkot deleted the lint-inconsistent-if branch April 20, 2023 19:18
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

Successfully merging this pull request may close these issues.

3 participants