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

fix: check elseClause inside noUselessLoneBlockStatements #584

Merged
merged 11 commits into from
Oct 23, 2023

Conversation

vasucp1207
Copy link
Member

Summary

Closes #567

Test Plan

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 22, 2023
@@ -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();
Copy link
Member

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:

Suggested change
let syntax_kind = block.syntax().parent().unwrap().kind();
let Some(parent) = block.syntax().parent() else { return false; };

@Conaclos Conaclos changed the title fix: check elseClause inside NoUselessLoneBlockStatements fix: check elseClause inside noUselessLoneBlockStatements Oct 22, 2023
Copy link
Member

@ematipico ematipico left a 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!

@ematipico ematipico merged commit d420a7f into biomejs:main Oct 23, 2023
12 checks passed
@vasucp1207
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Improper no lone statements
3 participants