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

Rule proposal: no-exports-in-scripts #2513

Open
zanminkian opened this issue Dec 18, 2024 · 1 comment
Open

Rule proposal: no-exports-in-scripts #2513

zanminkian opened this issue Dec 18, 2024 · 1 comment

Comments

@zanminkian
Copy link
Contributor

zanminkian commented Dec 18, 2024

Description

Currently, a js file starts with hashbang #! is script file. In script file, using exports is useless and confused.

Fail

#!/usr/bin/env node

export const foo = {};

Pass

export {}
#!/usr/bin/env node

console.log('foo');

Proposed rule name

no-exports-in-scripts

Additional Info

No response

@fregante
Copy link
Collaborator

Somewhat related:

This rule:

  • report exports if it has side effects (detected via hashbang)

That rule:

  • report side effects if it has exports

However this rule as defined is much easier to implement:

  1. find export statement
  2. report if line 1 is hashbang

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