Skip to content

Commit 7a30050

Browse files
committed
fix: allow for "if else" constructs
1 parent 4bd0289 commit 7a30050

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/rules/ifStatement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const ifStatementRule = new class extends Rule<IfStatement> {
1111
ast.addDiagnostic(`Missing "else" in "if-else" statement`, DiagnosticSeverity.Error, { start: child.loc!.start, end: child.consequent.loc!.start });
1212
if (child.consequent.type !== STATEMENTS.BLOCK)
1313
ast.addDiagnostic("Missing curly braces around if", DiagnosticSeverity.Error, child.consequent.loc!);
14-
if (child.alternate && child.alternate.type !== STATEMENTS.BLOCK)
14+
if (child.alternate && child.alternate.type !== STATEMENTS.BLOCK && child.alternate.type !== STATEMENTS.IF)
1515
ast.addDiagnostic("Missing curly braces around else", DiagnosticSeverity.Error, child.alternate.loc!);
1616
}
17-
}();
17+
}();

0 commit comments

Comments
 (0)