-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
fix: check elseClause
inside noUselessLoneBlockStatements
#584
Conversation
@@ -145,6 +145,11 @@ fn statement_has_block_level_declaration(statement: &AnyJsStatement, is_module: | |||
} | |||
|
|||
fn in_control_structure(block: &JsBlockStatement) -> bool { | |||
let syntax_kind = block.syntax().parent().unwrap().kind(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we don't use unwrap
in rule impl. You can use if let
or:
let syntax_kind = block.syntax().parent().unwrap().kind(); | |
let Some(parent) = block.syntax().parent() else { return false; }; |
elseClause
inside NoUselessLoneBlockStatements
elseClause
inside noUselessLoneBlockStatements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @vasucp1207 for your contribution! I noticed you have been contributing for a while now :)
May I ask you to start filling out our PR template, please? Especially the Test Plan
section. We try to keep the template very small, without asking too much from our contributors, in exchange we request to tell us you test the new code. Thank you!
Sure, I will do this next time. |
Summary
Closes #567
Test Plan