Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: shebang code #220

Open
1 task
its-dibo opened this issue Apr 8, 2024 · 1 comment
Open
1 task

Bug: shebang code #220

its-dibo opened this issue Apr 8, 2024 · 1 comment

Comments

@its-dibo
Copy link

its-dibo commented Apr 8, 2024

Environment

Node version: 20.10.0
npm version: 10.2.3
ESLint version: 8.55.0
eslint-plugin-n version: 16.3.1
Operating System: Linux, ubuntu 22.0

What rule do you want to report?

hashbang

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp1kb1uwzAMhF9FVYcs/tlddOvepehSZZAlInBrUSolBSkCv3spK0HjAB0MWLzjhyN5lpFMDyftwgzdZ5SDNB5jElo8i924e1Iom9VjnO1S0R8f+hypHyfsAY8ixRa9BUUKy8fuDuI8YSLDPI/ccVYohJJwSoA2KjmID36tpoHAeOe4DlbJhl1hzocJB+w3yr6pjKApAr2GNHHKQlrZK904/Q4UWSh1JWedICaGXh3RZzLw9hOgGpy3eeb/oi8XPnFly/3OnjnX0ESeak7r81i692u7woUnD9p86UPZ4+3cFo4vEMogaKY7et3CP4Gr2NaNtHdj3abmW2yofKtq/jvcpaHkXH4BFLii/A==

What did you expect to happen?

both shebang and n/hashbang suppose that the only valid bang syntax is #!/usr/bin/env node, but we may need to use another valid one such as #!/usr/bin/env ts-node.

bug:
reporting #!/usr/bin/env ts-node as invalid shebang is a mistake

suggestions:

  • add an option to this rule to specified additional valid shebang ['ts-node']
  • auto detect shebang based on the current file extension, for example if it is a .ts, it is ts-node by default
  • add an option for extension mapping, to override the default values, { js: 'node', ts: 'ts-node' }

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@its-dibo its-dibo added the bug label Apr 8, 2024
@aladdin-add
Copy link

Thanks for the report! sounds good to opt-in 👍 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants