Summary
See this ESLint rule for a detailed description.
There's already something similar in Ruff: https://docs.astral.sh/ruff/rules/if-expr-with-twisted-arms/, but much more narrow in scope - works only for b if not a else a, not for b if not a else c and not for if statements.