eslint-community / eslint-plugin-promise

Enforce best practices for JavaScript promises
ISC License
939 stars 91 forks source link

Access to `Promise.prototype.%somethingStandard%` trigger `promise/spec-only` #533

Open zloirock opened 1 month ago

zloirock commented 1 month ago
x:y  error  Avoid using non-standard 'Promise.prototype'  promise/spec-only
voxpelli commented 1 month ago

Why are you accessing Promise.prototype? 🤔

zloirock commented 1 month ago

It's a very strange question.

At first, because methods like .catch and .finally are generics and can be applied on non-native promises. At second, for caching for avoiding unneeded observable side effects, for preventing breakage in case of patching, etc. I have many other reasons to get access to methods from Promise.prototype.