vscode
vscode copied to clipboard
Prettier has suddenly started adding parentheses to mathematical expressions
Hello,
Using extension v0.8.2.
After upgrading from 0.7.0, Prettier formatter has started adding parentheses to math expressions.
.unibeautifyrc.json:
{
"JavaScript": {
"beautifiers": ["Prettier"],
"indent_style": "space",
"indent_size": 2
},
"HTML": {
"beautifiers": ["JS-Beautify"],
"brace_style": "collapse",
"indent_char": " ",
"indent_scripts": "normal",
"indent_size": 3,
"max_preserve_newlines": 0,
"preserve_newlines": true,
"unformatted": ["sub", "sup", "b", "u", "h3"],
"wrap_line_length": 125
},
"CSS": {
"beautifiers": ["JS-Beautify"],
"indent_char": " ",
"indent_size": 4
},
"SCSS": {
"beautifiers": ["Prettier"]
},
"TypeScript": {
"beautifiers": ["Prettier"]
},
"JSON": {
"beautifiers": ["Prettier"]
}
}
Before upgrading:
function calculate_percents(fraction, number) {
return number ? fraction * 100 / number : 0;
}
After:
function calculate_percents(fraction, number) {
return number ? (fraction * 100) / number : 0;
}
package.json:
"devDependencies": {
"@unibeautify/beautifier-js-beautify": "^0.4.0",
"@unibeautify/beautifier-prettier": "^0.9.0",
"js-beautify": "^1.10.3",
"prettier": "github:prettier/prettier",
"unibeautify": "^0.17.0"
}
I'd like to disable this functionality. Thank you.