Skip to content

feat: add o-top-level-side-effects rule#2937

Closed
uwufuzzywiiiaisddd wants to merge 1 commit intosindresorhus:mainfrom
uwufuzzywiiiaisddd:feat/no-top-level-side-effects
Closed

feat: add o-top-level-side-effects rule#2937
uwufuzzywiiiaisddd wants to merge 1 commit intosindresorhus:mainfrom
uwufuzzywiiiaisddd:feat/no-top-level-side-effects

Conversation

@uwufuzzywiiiaisddd
Copy link
Copy Markdown

Adds the no-top-level-side-effects rule, which flags top-level executable statements in ES modules.\n\nAddresses the issues noted in #2870 and #2912:\n- export default foo() now correctly flagged\n- void foo(), condition && foo(), top-level if/for/while/try all flagged\n- UnaryExpression handled so export default -1 is not a false positive\n- Template literal embedded expressions checked\n- module.id = 1 (non-exports assignment) correctly flagged\n- Files without any exports treated as scripts (no errors)\n- Hashbang files treated as scripts\n- Pure annotation support (@__PURE__, #__PURE__, @__NO_SIDE_EFFECTS__)

@uwufuzzywiiiaisddd uwufuzzywiiiaisddd closed this by deleting the head repository Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant