Follow on from #19825
https://github.com/eslint/eslint/blob/46eea6d1cbed41d020cb76841ebba30710b0afd0/lib/rules/no-constant-binary-expression.js#L457-L486
Eslint currently only supports const binary conditions on ==, !=, ===, !== binary operators. We should expand this support for the full set to catch issues such as 1 > 0
- Fails:
const a = 1 > 0
const b = 0 > 1
const shouldShowStreak = profile.streak ?? 0 > 1
- Passes:
const a = x > 0
const a = foo() > 0
- expressions with possible side effects in either operand
- No double-report with
no-constant-condition on if (1 > 0) {}.
Follow on from #19825
https://github.com/eslint/eslint/blob/46eea6d1cbed41d020cb76841ebba30710b0afd0/lib/rules/no-constant-binary-expression.js#L457-L486
Eslint currently only supports const binary conditions on
==,!=,===,!==binary operators. We should expand this support for the full set to catch issues such as1 > 0const a = 1 > 0const b = 0 > 1const shouldShowStreak = profile.streak ?? 0 > 1const a = x > 0const a = foo() > 0no-constant-conditiononif (1 > 0) {}.