Disallow "Yoda" conditions
ProprietaryFlips comparisons that have a literal on the left and a non-literal expression on the right, so the variable reads first. For example, "red" === color becomes color === "red" and 5 > count becomes count < 5. Directional operators are mirrored when the operands swap. Comparisons of two literals are left unchanged, and undefined does not count as a literal. A comparison that starts a statement after one without a terminating semicolon is left unchanged when its flipped form would start with a token that continues that statement, such as (, [ or a unary minus. Replicates the autofix of the ESLint rule yoda under its default options.
io. moderne. javascript. cleanup. Yodamod run . --recipe= io. moderne. javascript. cleanup. YodaInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.