Skip to content
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

promise/always-return should not be reported when process exits #451

Closed
nandi95 opened this issue Feb 8, 2024 · 3 comments · Fixed by #493
Closed

promise/always-return should not be reported when process exits #451

nandi95 opened this issue Feb 8, 2024 · 3 comments · Fixed by #493

Comments

@nandi95
Copy link

nandi95 commented Feb 8, 2024

Description

If I do process.exit(0); in a .then callback no return value should be expected from the callback as after the exit the rest of the code is unreachable.

Steps to Reproduce

 void fetch(
     'my-url',
     {
         method: 'POST',
         headers: {
             // eslint-disable-next-line @typescript-eslint/naming-convention
             'Content-Type': 'application/json'
         },
         body: JSON.stringify({...})
     }
     // eslint-disable-next-line promise/always-return (this should not be needed)
 ).then(() => {
     task.stop();
     process.exit(0);
});

Expected behavior: not to report issue when process exists

Actual behavior: issue reported

Versions

[Please fill this in if you are submitting a bug report]

  • Node version: 21.6.1
  • ESLint version: ^8.23.1
  • eslint-plugin-promise version: ^6.0.0
@scagood
Copy link
Contributor

scagood commented May 7, 2024

I think you should use eslint-plugin-n with process-exit-as-throw.
If you do then something probably is wrong 🤔

But, I am not sure that this should be in the promise plugin.

@brettz9
Copy link
Member

brettz9 commented Jul 20, 2024

I think it is reasonable to have an exception like this specific to Promise rules.

Copy link
Contributor

🎉 This issue has been resolved in version 6.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants