Rule proposal: Collapsible if-statements
See original GitHub issueThe rule should identify nested if-statements that can be combined into one.
Would be useful if the rule could be auto-fixable.
Instead of:
if (foo) { if (bar) { // ... } }
Prefer:
if (foo && bar) { // ... }
From: https://github.com/typescript-eslint/typescript-eslint/issues/279
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Rule proposal: Collapsible if-statements · Issue #279 - GitHub
The rule should identify nested if-statements that can be combined into one. Would be useful if the rule could be auto-fixable. Instead of:....
Read more >Apex static code analysis: Collapsible "if" statements should ...
Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your APEX code ... Collapsible "if" statements should be merged.
Read more >Refactoring - Collapsible "if" statements should be merged
In IntelliJ IDEA put the text cursor on the first if keyword, press Alt + Enter and invoke Merge nested 'if's . Save...
Read more >SonarQube - Collapsible If Statements
Sometimes two 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator. This rule is deprecated, ...
Read more >Collapse If Statements | jSparrow Documentation
Collapses, when possible, the nested if-statements into a single one by concatenating their conditions with the infix operator && . If the concatenation ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I have given up bothering proposing stuff over at ESLint. The process there is way too slow and they reject almost everything anyway.
Anyway, the rule is ready https://github.com/sindresorhus/eslint-plugin-unicorn/pull/936