Rescript’s formatter is not configurable and currently there’s no plan for it afaik.
The reason behind this is to maintain a consistent codestyle in community and I think there are good reasons for this.
but your cases are valid IMO.
In order to solve this there’s an idea to format pipes (and maybe other parts) based on previous state
see Smart linebreak printer for pipe chains · Issue #257 · rescript-lang/syntax · GitHub .
Note that formatter currently does that in some cases.
For example check these two snippets and hit format : #1#2
Again, harder to read, harder to quick change.
There might be a good reason and bad consequences. Rust has a unified formatter experience, and it’s marvelous (I think you can customize it these days anyway). Rescript has it too and, in my opinion, is… well, questionable.
It’s hit or miss approach, some may like it and some will hate, and won’t touch language anymore. But there is a bigger problem here, IMHO. When I started ReasonML, it was just fun to write code. It’s not anymore with Rescript. With more and more little gotchas like that, I have to think twice every time I approach a new project. ReasonML felt like 2 steps forward and Rescript like 1 step back (but still 1 step forward ).
I really like Elm, but unfortunately, it doesn’t support anything like React Native. Because of that, I think Rescript is currently the best alternative for Typescript, and also is pretty fresh yet, so I hope all these little gotchas will be improved some day
The only practical usage of Prettier is with integration with linters, so basically tons of configuration. For me, it seems like the article is irrelevant to its own tool.
Of course, it’s better to have auto-indent, but while thinking about code formatting I have rust-fmt in mind that format code heavily without any configuration or Prettier+eslint that has tons of configuration but can deal even with jsx.
I’m not saying that having a lot of configuration is good. I don’t even mean that Rescript needs configuration files.
We already agreed, that in some cases Rescript could handle it better.
The only thing that worries me is that the issue was reported 4 months ago. Seems like there is not a chance for quick progression for pipes, and it will be even harder for jsx.
Yay, this is super annoying to the point it’s hindering reading. I don’t have a problem with no config formaters, Rust or Elm got it right. Very surprising especially even your own documentation got it right. This is such a big deal for me coming from a common-sense formater I’ll just stop using it.