sindresorhus/eslint-plugin-unicorn
False positive: 'promise.withresolvers' in 'no-unnecessary-polyfills'
Chiusa
#2404 aperta il 22 lug 2024
bughelp wanted
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 4h 30m) (26 PR mergiate in 30 g)
Descrizione
The no-unnecessary-polyfills rule complains about usage of promise.withresolvers package on Node.js 20 even though the native Promise.withResolvers is not available. According to MDN, it is only available since Node 22.0.0.
no-unnecessary-polyfills
Here's my rule config:
"unicorn/no-unnecessary-polyfills": [
"error",
{ targets: "node 20.15.0" },
],
Here's the engines part on package.json:
"engines": {
"node": "^20.15.0",
"pnpm": "^9.4.0"
},
And there's a piece of code that triggers an error.
import withResolvers from "promise.withresolvers"; // Use built-in instead. eslint (unicorn/no-unnecessary-polyfills)