ThisIsManta / stylus-supremacy

A Node.js script that helps formatting Stylus files.
https://thisismanta.github.io/stylus-supremacy
MIT License
88 stars 9 forks source link

Multiplication of parentheses around expressions #71

Open cyberbiont opened 4 years ago

cyberbiont commented 4 years ago

when I use variable in require path, something like

@require folder + '/fileName'

parentheses are added every time on formatting, like this

@require (folder + '/fileName')

then

@require ((folder + '/fileName'))

etc.

I found a workaround is to as add empty string at the beginning

@require '' + folder + '/fileName'

But I'm reporting it just in case.

cyberbiont commented 4 years ago

The problem seems to more be more serious, something is wrong with the way parenthesis are inserted around expressions. For example, simple ternary expression:

b = a ? b * 2 : b * 3

gets formatted as

b = a ? (b * 2) : (b * 3)

then

b = a ? ((b * 2)) : ((b * 3))

and each subsequent formatting keeps adding parentheses.

Is there at least an option to turn off parentheses around expressions at all ?

cyberbiont commented 4 years ago

I see that it is a duplicate of https://github.com/ThisIsManta/stylus-supremacy/issues/45 https://github.com/ThisIsManta/stylus-supremacy/issues/41 https://github.com/ThisIsManta/stylus-supremacy/issues/30