jscodeshift command converts LF to CRLF
arai-a opened this issue · comments
Related to #262 , running jscodeshift
command on a file with LF converts the newline to CRLF, even if there's no other change.
workaround posted in #262 (comment) isn't applicable for jscodeshift
command.
Are you perchance running jscodeshift on Windows (I'm guessing that won't matter, but I'd like to rule our anything platform-specific first).
oh, sorry, I forgot to explain the context.
yes, I bumped into the issue when running jscodeshift
across OSes, and I see the behavior only on Windows.
The behavior itself you're seeing is caused by a recast issue. Recast defaults to the platform-specific line terminator.
So is the issue that toSource() in your workaround isn't actually changing the line terminator used for the output?
I'm running node_modules/.bin/jscodeshift
command after npm install jscodeshift
.
instead of importing jscodeshift
from JS application.
So there's no toSource
call I can modify.
https://github.com/facebook/jscodeshift/blob/main/bin/jscodeshift.js
Possible fix is to add new command-line parameter to jscodeshift
command that receives the override for line terminator.
If the fix sounds reasonable, I'll look into fixing the command.
oh, sorry, I misunderstood the issue.
I see toSource()
call in the transform file I'm using.