es-check icon indicating copy to clipboard operation
es-check copied to clipboard

Spurious "Symbol" detected with `--featureCheck` against es5

Open Aarononomous opened this issue 1 year ago • 3 comments

Requested Update

Thanks for the great tool!

I get an error that I've used a Symbol in es5 when I haven't.

Here's a very small reproduction:

$ echo 'window.getElementById("x");' > $TMPDIR/test.js; npx es-check@latest es5 $TMPDIR/test.js --checkFeatures --verbose
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

debug: ES-Check: Going to check files using version 5
debug: ES-Check: checking /var/folders/t3/kryjc_nj35l5h2lvvl0dflb00000gq/T/test.js
~/.npm/_npx/29ab2ebeba26f336/node_modules/es-check/detectFeatures.js:71
    throw new Error(
    ^

Error: Unsupported features detected: Symbol. These require a higher ES version than 5.
    at detectFeatures (~/.npm/_npx/29ab2ebeba26f336/node_modules/es-check/detectFeatures.js:71:11)
    at ~/.npm/_npx/29ab2ebeba26f336/node_modules/es-check/index.js:222:54
    at Array.forEach (<anonymous>)
    at Command.<anonymous> (~/.npm/_npx/29ab2ebeba26f336/node_modules/es-check/index.js:203:19)
    at Command.listener [as _actionHandler] (~/.npm/_npx/29ab2ebeba26f336/node_modules/commander/lib/command.js:542:17)
    at ~/.npm/_npx/29ab2ebeba26f336/node_modules/commander/lib/command.js:1502:14
    at Command._chainOrCall (~/.npm/_npx/29ab2ebeba26f336/node_modules/commander/lib/command.js:1386:12)
    at Command._parseCommand (~/.npm/_npx/29ab2ebeba26f336/node_modules/commander/lib/command.js:1501:27)
    at Command.parse (~/.npm/_npx/29ab2ebeba26f336/node_modules/commander/lib/command.js:1064:10)
    at Object.<anonymous> (~/.npm/_npx/29ab2ebeba26f336/node_modules/es-check/index.js:256:9)

Node.js v22.11.0

window.getElementById is clearly not a Symbol!

Are There Examples Of This Requested Update Elsewhere?

Not that I could find.

Thanks!

Aarononomous avatar Jan 15 '25 21:01 Aarononomous

Thanks @Aarononomous ! Hope to get to this asap.

yowainwright avatar Jan 15 '25 22:01 yowainwright

I can second this. I'm also getting these Symbol-related results despite not having any Symbol in my source files. I skimmed https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol and tried to find any of its sub-functions and variables in my code (such as Symbol.matchAll or Symbol.keyFor() but didn't come up with anything.

tonebender avatar Mar 05 '25 11:03 tonebender

I pushed a beta version. Mind trying it out? 🙏

yowainwright avatar Mar 05 '25 17:03 yowainwright

@yowainwright v8.0.2 is working great on that repro above and on my code. I don't see the Error: Unsupported features detected: Symbol error any more.

Thanks so much! Time to bump!

Aarononomous avatar Mar 19 '25 21:03 Aarononomous