-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Workaround for Electron issue with setImmediate #12765
Conversation
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.
✨ Seems like a reasonable work around. I like the name. 😸
One comment need updated from copy/paste of previous lint rule.
eslint-rules/set-almost-immediate.js
Outdated
const sourceCode = context.getSourceCode() | ||
|
||
/** | ||
* Check each member of the interface body and ensure it is marked `readonly`. |
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.
Copy/Pasta 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.
Ouch! Fixed now, thanks 😄
// @ts-check | ||
|
||
/** | ||
* set-almost-immediate |
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.
These custom rules are neat!
@sergiou87 ESLint rules look fine to me |
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.
✨
Description
This PR includes a workaround for electron/electron#29261 that basically replaces calls to
setImmediate
withsetTimeout(…, 0)
.Given it will need some time in testing, I created a very original abstraction with
setAlmostImmediate
and wrote an eslint rule to make sure we don't usesetImmediate
(@shiftkey I'd love if you could take a look at it and share any feedback… but only if you have time!!!)After testing it, I haven't noticed any issues, and of course I wasn't able to repro the aforementioned issue after bumping Electron to one of the affected versions, so we could say this temporary workaround is actually useful 😌
Release notes
Notes: no-notes