Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1774

Adding custom code formatting

$
0
0

Thanks Florian, the smart line breaks look good in that context.

Perhaps I’ve got any terminology wrong, but I think there’s a slight discrepancy in behavior when formatting ReScript code and JSX.

It appears that within a function one blank line is allowed between statements, whereas all blank lines are removed when the JSX is formatted.

In the example below I find it much easier to read when the switch statement has a blank newline before and after it (these are removed when formatting). I could explain this further, but ultimately it comes down to personal preference - I find it easier to see at a glance what’s happening in the code.

I don’t think adding comments would help necessarily, and even then I’d prefer a newline preceding the comment.

without spaces:
withoutSpaces

with spaces:
withSpaces


Viewing all articles
Browse latest Browse all 1774

Trending Articles