-
-
Notifications
You must be signed in to change notification settings - Fork 476
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(lint): useCollapsedIf JS lint rule #4179
Conversation
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
CodSpeed Performance ReportMerging #4179 will improve performances by 18.61%Comparing Summary
Benchmarks breakdown
|
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!
@@ -0,0 +1,81 @@ | |||
/** |
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.
Could you check the original test file and add cases to increase coverage?
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/test/no-lonely-if.mjs
@@ -0,0 +1,18 @@ | |||
if (condition && anotherCondition) { |
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.
ditto. Please check the test file.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/test/no-lonely-if.mjs
crates/biome_js_analyze/tests/specs/nursery/useCollapsedIf/invalid.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
# Conflicts: # crates/biome_configuration/src/analyzer/linter/rules.rs
806cee3
to
63dd21e
Compare
Signed-off-by: Naoki Ikeguchi <[email protected]>
…eck the expr needs parens Signed-off-by: Naoki Ikeguchi <[email protected]>
# Conflicts: # crates/biome_configuration/src/analyzer/linter/rules.rs
# Conflicts: # crates/biome_configuration/src/analyzer/linter/rules.rs # crates/biome_js_analyze/src/lint/nursery.rs # packages/@biomejs/backend-jsonrpc/src/workspace.ts # packages/@biomejs/biome/configuration_schema.json
Signed-off-by: Naoki Ikeguchi <[email protected]>
8556077
to
68c6810
Compare
@togami2864 @Conaclos |
bc81ebf
to
ac9ff95
Compare
ac9ff95
to
0847315
Compare
@togami2864 Merged main branch and re-run |
Signed-off-by: Naoki Ikeguchi <[email protected]>
Summary
Closes #3944
This pull requests adds
useCollapsedIf
rule that suggests to merge two nestedif
statements into one if the parent has only one statement and the child has no else clauses.The implementation is largely based on
useCollapsedElseIf
(#160).This is my first time to make changes to Biome, so please let me know if missing something to do. 🙏
Test Plan
See test snapshots.