Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 753 Bytes

File metadata and controls

35 lines (23 loc) · 753 Bytes

no-exports-in-scripts

📝 Disallow exports in scripts.

💼 This rule is enabled in the following configs: ✅ recommended, ☑️ unopinionated.

Scripts are meant to be executed directly, not imported as modules.

Exports in a script mix module and script boundaries and can mislead readers about how the file is intended to run.

Examples

This script fails:

#!/usr/bin/env node
export const foo = 1;

This script passes:

#!/usr/bin/env node
const foo = 1;
console.log(foo);

Modules pass:

export const foo = 1;