I'm using Prettier in VS Code on a React Native project and it removes parentheses in mixed operators or when declaring a var with a parenthesis. How to prevent Prettier from doing that?
Example 1:
const foo = (a && b) || c;
After:
const foo = a && b || c;
Example 2:
const c = (a.toString()).toUpperCase();
After:
const c = a.toString().toUpperCase();
I know that in most cases it doesn't change the logic but I want to disable this feature.
You can use “prettier-ignore” comments to ignore parts of files. Like // prettier-ignore
Here you have a link to documentation: https://prettier.io/docs/en/ignore.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With