I have been experimenting using ormolu with "format on save" in my editor and find that it is quite convenient for relieving my mind from having to make lots of micro-decisions on formatting choices. I can just write valid code and save, and it formats it nicely enough.
And if I want to make a single-line expression into a multi-line one, I can add a line break somewhere in the middle, save again, and I get the multi-line version.
In some cases, such as adding an item to a list (whether it be an actual list [] or just a list of module exports) might be nice if I add an extra comma or forget one, that omolu tries to fix the problem for me, by adding the comma or taking it away.
While this certainly wouldn't work for the general case, it might be nicer than just reporting an error for cases where the fix is not too difficult.
I realize this might not be very practical but for a few specific cases, if any at all, but I thought I would add it here as something "nice to have".
I have been experimenting using ormolu with "format on save" in my editor and find that it is quite convenient for relieving my mind from having to make lots of micro-decisions on formatting choices. I can just write valid code and save, and it formats it nicely enough.
And if I want to make a single-line expression into a multi-line one, I can add a line break somewhere in the middle, save again, and I get the multi-line version.
In some cases, such as adding an item to a list (whether it be an actual list
[]
or just a list of module exports) might be nice if I add an extra comma or forget one, that omolu tries to fix the problem for me, by adding the comma or taking it away.While this certainly wouldn't work for the general case, it might be nicer than just reporting an error for cases where the fix is not too difficult.
I realize this might not be very practical but for a few specific cases, if any at all, but I thought I would add it here as something "nice to have".