Skip to content

Bug: shebang code #220

Closed
Closed
@its-dibo

Description

@its-dibo

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions