Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier has suddenly started adding parentheses to mathematical expressions #268

Open
levz0r opened this issue May 27, 2020 · 0 comments
Open

Comments

@levz0r
Copy link

levz0r commented May 27, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant