-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
fix: don't crash when fs.readFile
returns promise from another realm
#18416
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
tests/lib/eslint/eslint.js
Outdated
@@ -1057,6 +1057,61 @@ describe("ESLint", () => { | |||
await assert.rejects(async () => await eslint.lintFiles(["lib/cli.js"]), /Expected object with parse\(\) or parseForESLint\(\) method/u); | |||
}); | |||
|
|||
// https://github.com/eslint/eslint/issues/18407 | |||
it("should work in case when `fs.readFile()` returns an object that is not an instance of Promise from this realm", async () => { |
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.
Maybe fs.promises.readFile()
or fsp.readFile()
?
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.
Updated to fsp.readFile()
in 0b8b96b.
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. Just waiting for the patch release period to pass.
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Fixes #18407
What changes did you make? (Give an overview)
Updated
@humanwhocodes/retry
dependency to the latest v0.2.4 that includes the fix for #18407 and added a test that fails with v0.2.3.Also updates
lib/eslint/eslint.js
to userequire("fs/promises")
instead ofrequire("fs").promises
.Is there anything you'd like reviewers to focus on?