mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.2k stars 340 forks source link

Add option to disable comment alignment #1002

Closed sleroq closed 1 year ago

sleroq commented 1 year ago

I use prettier for js code and it doesn’t align comments but instead removes unnecessary spaces.

We want our codebase to be uniform, so it would be great if shfmt had an option to disable comment alignment.

mvdan commented 1 year ago

What exactly is wrong with the way shfmt aligns comments? If you found a bug, we should fix it. Aside from that, I think it's somewhat natural that different languages will format differently. We borrowed this particular idea from Go's gofmt, for example.

In general, we avoid adding more formatting options, as they add complexity for both users and maintainers. Just testing all combinations of formatting options is exponentially more expensive.

sleroq commented 1 year ago

Fair enough! Thanks for taking the time to explain that to me.