-
Notifications
You must be signed in to change notification settings - Fork 3
feat(lint): configure unicorn/prefer-top-level-await rule #218
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
Conversation
- Disable top-level await in library code (src/) to ensure compatibility with consumers who may not support ES modules with top-level await - Enable top-level await in examples/ for cleaner, more readable scripts - Add examples override with no-console off for script-style files
commit: |
- Add unicorn/prefer-module rule globally to enforce ESM patterns - Disallows __dirname/__filename in favour of import.meta.url - Disallows require() in favour of import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR configures the unicorn/prefer-top-level-await ESLint rule to ensure library code remains compatible with consumers while enabling cleaner code patterns in example scripts.
- Disables
unicorn/prefer-top-level-awaitin library source code (src/) for maximum compatibility - Enables
unicorn/prefer-top-level-awaitinexamples/directory to encourage modern async patterns - Adds
no-consoleoverride for example files to allow console output in scripts
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
This reverts commit a5e0cb0.
glebedel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
unicorn/prefer-top-level-awaitin library code (src/) to ensure compatibility with consumers who may not support ES modules with top-level awaitunicorn/prefer-top-level-awaitinexamples/for cleaner, more readable scriptsno-consoleoff for script-style filesReferences
Test plan
pnpm lintpasses