fix: throw clear error when prettier is not installed instead of hanging#782
fix: throw clear error when prettier is not installed instead of hanging#782isamu wants to merge 2 commits intoprettier:mainfrom
Conversation
When prettier is not installed as a dependency, ESLint would hang indefinitely because the synckit worker thread fails to start and never responds. Add a require.resolve check before creating the worker to fail fast with a descriptive error message. Fixes prettier#781
🦋 Changeset detectedLatest commit: 1318b9b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 297bc40 in 9 seconds. Click for details.
- Reviewed
19lines of code in1files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_I0hB4LMO2m0e7T0F
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
📝 WalkthroughWalkthroughAdds a defensive check to eslint-plugin-prettier to verify the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Only catch MODULE_NOT_FOUND errors, re-throw unexpected errors - Add changeset for patch version bump
Summary
require.resolve('prettier')check before creating the synckit worker threadFixes #781
Root Cause
worker.mjsimportsprettieras a top-level static import. When prettier is not installed, the worker thread crashes on startup.synckitdoesn't handle worker startup failures — the main thread blocks forever onAtomics.wait().Fix
Check for prettier availability via
require.resolve('prettier')before creating the worker. If not found, throw:Test plan
pnpm test)Important
Adds a check for Prettier's installation in
eslint-plugin-prettier.jsto prevent ESLint from hanging, throwing a clear error if missing.require.resolve('prettier')check ineslint-plugin-prettier.jsbefore creating the synckit worker thread.eslint-plugin-prettier requires "prettier" package to be installed. Please install it with: npm install -D prettier.This description was created by
for 297bc40. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit