prettier
prettier copied to clipboard
Align formatting of `%` with `/` and `*`
This is related to https://github.com/prettier/prettier/issues/187. However, this issue is about one specific operator.
Unfortunately GH search is not very good when searching for symbols, so I couldn't find if there is already a similar issue.
Prettier 3.5.3 Playground link
# Options (if any):
Input:
let high = num % 256 - 128;
let high = num / 256 - 128;
Output:
let high = (num % 256) - 128;
let high = num / 256 - 128;
Expected output:
let high = num % 256 - 128;
let high = num / 256 - 128;
or
let high = (num % 256) - 128;
let high = (num / 256) - 128;
Why?
%, * and / all have the same precedence in JavaScript, so I would expect them to be formatted the same way.
It seems intentional ... https://github.com/prettier/prettier/pull/4413