-
-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
Description
Description
The new no-multiple-resolved rule (#369) reports an error if resolve is used in the try block and reject is used in the catch block, even though they can't be both executed:
return new Promise((resolve, reject) => {
https.get(someUrl, response => {
response.on(`end`, async () => {
try {
await writeFile(someFilePath, someContents);
resolve();
}
catch (error) {
reject(error);
}
});
});
});Steps to Reproduce
(see code above)
Expected behavior: No error, since resolve is only called when the writeFile call succeeds, and reject is only called if the writeFile call fails.
Actual behavior: The reject call is reported:
Promise should not be resolved multiple times. Promise is potentially resolved
Versions
- Node version: 16.17.0
- ESLint version: 8.25.0
- eslint-plugin-promise version: 6.1.0
Additional Information
Repo to reproduce (but the rule is not enabled there yet):
https://github.com/OpenLightingProject/open-fixture-library/blob/6ee07f7a4a4be9907c1238531acd3ec0deeabdb3/plugins/qlcplus_4.12.2/exportTests/fixture-tool-validation.js#L81-L101
DerZyklop