nixfmt
nixfmt copied to clipboard
nixfmt incorrectly transforms strings to double single quote form
Description
Nixfmt (sometimes?) converts strings to double single quote form. For certain strings, the transformation is incorrect. No transformation at all would be preferrable.
Small example input
someValue = ",\n ";
Expected output
someValue = ",\n "; # Unchanged, no transformation necessary
Actual output
someValue = ''
,
''; # Equivalent to "\n,"
The conversion to multiline strings is something that's been very ergonomic for my team, so we'd be sad to lose it. A length heuristic might help?
That said, here's another incorrect transformation.
Sample input
"\n'"
Expected output
''
''\'''
Actual output
''
'''
The output doesn't parse anymore.
Edit: it seems like this one is fixed in 0.5.0!
Another case:
Sample input
"'\${x:y}'\n"
Expected output
''
''\'''${x:y}'
''
Actual output
''
'''${x:y}'
''
Yep! Fixed in v0.5.0!