facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.11k stars 468 forks source link

Force LF line endings in bin/jscodeshift.js and remove spaces after shebang #555

Closed jakeboone02 closed 1 year ago

jakeboone02 commented 1 year ago

This PR forces LF line endings for bin/jscodeshift.js and removes the spaces added after the shebang pragma in #549. I believe the spaces are not necessary as long as the line endings are LF and not CRLF.

See my comment about Bun here: https://github.com/facebook/jscodeshift/pull/549#issuecomment-1493142756

Daniel15 commented 1 year ago

Thanks - I'll try to cut a new release soon.

jakeboone02 commented 1 year ago

Thanks! 🚀

juzerzarif commented 1 year ago

Is there a release published with this fix?

Daniel15 commented 1 year ago

I'm going to publish a new version soon. I'll try to have it done by the end of the weekend.

Regards, Daniel Lo Nigro https://d.sb[https://d.sb/]

Sent from my phone

May 6, 2023 3:57:06 PM Juzer Zarif @.***>:

Is there a release published with this fix?

— Reply to this email directly, view it on GitHub[https://github.com/facebook/jscodeshift/pull/555#issuecomment-1537238181], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAAWOHNA26DNI6V54TY6TADXE3JMZANCNFSM6AAAAAAWP42SAM]. You are receiving this because you modified the open/close state.[Tracking image][https://github.com/notifications/beacon/AAAWOHNEEHM3YU7TD2HKKJLXE3JMZA5CNFSM6AAAAAAWP42SAOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS3UBSKK.gif]

ElonVolo commented 1 year ago

It was sort of a showstopper for me so I’ve updated the evcodeshift fork. Until Daniel gets the changes in you might be able to evcodeshift a spin (shilling for free testing)evcodeshiftnpmjs.comSent from my iPhoneOn May 6, 2023, at 19:02, Daniel Lo Nigro @.***> wrote: I'm going to publish a new version soon. I'll try to have it done by the end of the weekend.

Regards, Daniel Lo Nigro https://d.sb[https://d.sb/]

Sent from my phone

May 6, 2023 3:57:06 PM Juzer Zarif @.***>:

Is there a release published with this fix?

— Reply to this email directly, view it on GitHub[https://github.com/facebook/jscodeshift/pull/555#issuecomment-1537238181], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAAWOHNA26DNI6V54TY6TADXE3JMZANCNFSM6AAAAAAWP42SAM]. You are receiving this because you modified the open/close state.[Tracking image][https://github.com/notifications/beacon/AAAWOHNEEHM3YU7TD2HKKJLXE3JMZA5CNFSM6AAAAAAWP42SAOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS3UBSKK.gif]

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

Daniel15 commented 1 year ago

npm is giving me an error when I try to publish:

npm ERR! code E429
npm ERR! 429 Too Many Requests - PUT https://registry.npmjs.org/jscodeshift

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Daniel\AppData\Roaming\npm-cache\_logs\2023-05-07T19_48_27_396Z-debug.log

Not sure why I'm getting a 429 given I haven't used npm today 🤔

Daniel15 commented 1 year ago

Fixed my npm issue. New version has been published. Thanks for the patience.

I'm going to see if I can somehow automatically publish dev versions of jscodeshift.

razzeee commented 8 months ago

This seems to be a regression an reintroduce the original issue.

Trying to run the codemod in https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5 on the codebase of https://github.com/flathub/website/ leaves me with

─ npx jscodeshift ./src/ \                                                                                                                                                 ─╯
  --extensions=ts,tsx \
  --parser=tsx \
  --transform=./node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.js
/usr/bin/env: „node\r“: Datei oder Verzeichnis nicht gefunden
/usr/bin/env: Verwenden Sie -[v]S, um Optionen in #!-Zeichen zu übergeben

Using linux with zsh (in vscode)

Daniel15 commented 8 months ago

Hmm I'm not sure how this could have regressed :/ I'll look into it.

ElonVolo commented 8 months ago

Normally don't most projects prevent these sorts of regressions by including an .editorconfig file and some fairly aggressive eslint/prettier configs?

Daniel15 commented 8 months ago

@EnolVolo We do have an .editorconfig file that says to use LF newlines for all files: https://github.com/facebook/jscodeshift/blob/main/.editorconfig

Daniel15 commented 8 months ago

@razzeee I'm unable to reproduce the issue. I tested on both Ubuntu 22.04 and Debian 12, and both can run jscodeshift without an error:

11:02 daniel@la05 /home/daniel
% npx jscodeshift --version
Need to install the following packages:
jscodeshift@0.15.1
Ok to proceed? (y) y
jscodeshift: 0.15.1
 - babel: 7.23.3
 - babylon: 7.23.3
 - flow: 0.222.0
 - recast: 0.23.4

It may be something to do with that specific transform? I'm unsure. Please open a new issue with more debugging info if you need help.

razzeee commented 8 months ago

Sorry for the comotion, it's that standard npx bug again :roll_eyes:

So you need to run npx jscodeshift@latest ... to actually not get a random version.

npx jscodeshift@latest ./src/ \
  --extensions=ts,tsx \
  --parser=tsx \
  --transform=./node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.js