eslint/eslint — pull request #965 by jrajav (2014-06-06 23:25:55+00:00)
Title: Breaking: Change 'no-yoda' rule to 'yoda' and add "always" option (Fixes #959)

Fixes #959.

Renames 'no-yoda' rule to 'yoda'.

Expands 'yoda' rule to have options "always" and "never", where "never" is the original behavior of the 'no-yoda' rule (disallowing yoda conditions) and "always" is the opposite, requiring all comparisons to be yoda conditions.

The implementation is a bit of a deviation from the usual coding style in this project, it's more functional - the config decides which function should be assigned to the BinaryExpression node type, rather than being checked every time the node type is hit. Let me know if this is wrong, it can just as easily be checked every time.