no-unnecessary-polyfills
false positive for regexp.escape
#2584
Labels
no-unnecessary-polyfills
false positive for regexp.escape
#2584
The
unicorn/no-unnecessary-polyfills
rule is triggered by importing regexp.escape in a package withengines.node: ">=18"
. I believe this is a false-positive since RegExp.escape() is not supported by any version of Node.js (also confirmed by the core-js compat table).Full reproduction:
I've bisected the regression to zloirock/core-js@7321cc1 (
[email protected]
) which added the featurees.regexp.escape
.The crux of the issue appears to be that
coreJsCompat.entries['core-js/full/regexp/escape']
is['es.regexp.escape', 'esnext.regexp.escape']
whilecoreJsCompat({ node: '>=18' }).list
contains'es.regexp.escape'
but not'esnext.regexp.escape'
, causingcheckFeatures()
to returntrue
ateslint-plugin-unicorn/rules/no-unnecessary-polyfills.js
Line 133 in e48a620
Thanks,
Kevin
The text was updated successfully, but these errors were encountered: