`@stylistic/no-mixed-operators` isn't compatible with Prettier
Author: patrik-csakCreated Jun 19, 2026Updated Jul 17, 2026
Labelsbug
I tested this on XO v0.60.0–3.0.2
Given this code:
function getRandomIntInclusive(min, max) {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}xo --prettier=compat✖ 4:34 Unexpected mix of * and +. Use parentheses to clarify the intended order of operations. @stylistic/no-mixed-operators
✖ 4:65 Unexpected mix of * and +. Use parentheses to clarify the intended order of operations. @stylistic/no-mixed-operatorsSo I add clarifying parentheses:
- return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
+ return Math.floor((Math.random() * (maxFloored - minCeiled + 1)) + minCeiled);But Prettier strips them:
- return Math.floor((Math.random() * (maxFloored - minCeiled + 1)) + minCeiled);
+ return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);Related: prettier/prettier#187
Source: xojs/xo