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

feat: fix indent rule for else-if #17318

Merged
merged 2 commits into from Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rules/indent.js
Expand Up @@ -1250,7 +1250,7 @@ module.exports = {

IfStatement(node) {
addBlocklessNodeIndent(node.consequent);
if (node.alternate && node.alternate.type !== "IfStatement") {
Copy link
Member

@BYK BYK Jun 29, 2023

Choose a reason for hiding this comment

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

I was able to trace this logic all the way back to the big rewrite of this rule so I'm guessing it was carried over from broken logic earlier or was an inherent bug in the initial implementation.

if (node.alternate) {
addBlocklessNodeIndent(node.alternate);
}
},
Expand Down