trivago / prettier-plugin-twig-melody

Code formatting plugin for Prettier which can handle Twig/Melody templates
Apache License 2.0
155 stars 35 forks source link

Removes helpful parenthesis #96

Open maxfenton opened 2 years ago

maxfenton commented 2 years ago

input: {% set style = ((style is defined) and style and (style in validStyles)) ? style : 'link' %} output:

{% set style = style is defined and style and style in validStyles
  ? style
  : 'link'
%}

Could there be a flag (or is there) to not remove those?

FlavienBusseuil commented 1 year ago

Indeed.

{% set value = nb / (0 != total ? total : 1) %} translates to: {% set value = nb / 0 != total ? total : 1 %} division by 0. :skull: