-
-
Notifications
You must be signed in to change notification settings - Fork 637
Fix map spreading #875
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
Fix map spreading #875
Conversation
Codecov Report
@@ Coverage Diff @@
## main #875 +/- ##
==========================================
+ Coverage 99.26% 99.29% +0.03%
==========================================
Files 98 101 +3
Lines 1488 1555 +67
Branches 492 511 +19
==========================================
+ Hits 1477 1544 +67
Misses 11 11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I'm confused - is your babel configured to transpile node_modules? It's never safe to transform code you didn't author. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree this is correct (as is the existing code), I'm confused why it's not working for you, since it's been published this way for awhile.
hm, i also note you're using yarn pnp, which breaks a bunch of things. Does this happen using node's actual resolution mechanism? |
@ljharb This is not related to the consumer's Babel configuration. The references to Babel in the description refer to this package's own build configuration.
I wish I knew too. It works when executing I patched my local copy to use
I don't believe it's Yarn PNP, because Node is not explicitly installed on the machine that encounters this error, so while I think the most important thing is that this fix is accurate. 👍 If it had to be defined, "Adds support for Electron." |
|
I agree the fix is accurate; what's mystifying is how you're the first person to report the bug. Additionally, I'm not able to reproduce it - which is why i suspect it might be related to PnP. What version of |
I don't believe it is a PNP issue because it is working with PNP when I execute it by CLI. It only doesn't work via the Yarn ESLint SDK for VSCode. I can't confirm the Babel runtime version until Monday, as this occurred on a work device, and I don't want to work before then. 😆 |
Right - but that's what I'm saying - typically when using PnP, lots of integrations tend to break. Happy to wait :-) it's important to understand why something is broken before fixing it. |
I'm not sure I align with that perspective. It's broken because it's trying to spread a non-spreadable object. It's clear why it's broken. The part that doesn't make sense is why it works. I do not believe that we first need to understand why it works before fixing why it's broken. This change is backwards compatible. |
My hunch is that you're using a version of |
The Babel file throwing the error hasn't been changed since November 2021. Investigation steps:
I don't know why the file I also found this issue where the maintainers state that plain objects are not iterable and are expected to throw an error when passed to |
Sorry, I closed this because I discovered the reason this wasn't impacting others. When I patched This package depends on If you want to keep this PR, you should be able to go ahead and bump |
ahhh, thanks for clarifying. in that case yes, i'll close this as a duplicate of #814. |
Getting this error in ESLint, which seems perfectly valid:
isInteractiveElement
has a couple of instances of[...someMap]
, where the map is not a literalMap
object, but instead is a vanilla object with a couple of hand-written Map prototype methods.This package then uses Babel to transpile the spread operator, and that very Babel transpilation throws an error that said object cannot be spread.
An alternative solution could be to add the
[Symbol.iterator]()
method to the faux maps, but this seems more explicitly accurate and faster than nested dependency changes. I usedentries()
because[...new Map()]
returns an array of the map's entries.