Rule: binary-expression-operand-order

In a binary expression, a literal should always be on the right-hand side if possible. For example, prefer ‘x + 1’ over ‘1 + x’.

Rationale

Expressions like 1 + x are sometimes referred to as “Yoda” expressions because they read opposite to how we would normally speak the expression.

Sticking to a consistent grammar for conditions helps keep code readable and understandable.

Config

Not configurable.

Config examples
"binary-expression-operand-order": true
Schema
null