Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign updon't cross the browser and node streams #46
Comments
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Another good reason to split these modes apart: as I just discovered, because |
This comment has been minimized.
This comment has been minimized.
|
Possible resolutions to this issue:
Any other ideas? |
This comment has been minimized.
This comment has been minimized.
|
My preference is for 2, although I strongly agree with the goal of keeping configurability and modes to an absolute minimum. My argument in favor is that this is probably the biggest split going through the Just as a quick note, this would allow browserify users to get warnings for forgetting to shim their node globals in their browser code as well – no |
This comment has been minimized.
This comment has been minimized.
|
I think 4 is a nice middle ground. It is a bit annoying to not being able to use |
This comment has been minimized.
This comment has been minimized.
|
I'm vehemently against The ultimate goal here is to try to encourage |
This comment has been minimized.
This comment has been minimized.
|
@jprichardson perhaps writing a custom eslint rule that replaces no-undef with this special treatment would not affect processing time as much? |
This comment has been minimized.
This comment has been minimized.
|
I thought of another option, 5:
Here's the full list of globals that we could keep whitelisted. Most don't seem like they would frequently cause problems in node.
These variables, on the other hand, would need to be accessed on
|
This comment has been minimized.
This comment has been minimized.
|
Btw, I'm running option 4 on a local branch – and I really like it so far – the tests all pass with just a few additions of |
feross
added a commit
that referenced
this issue
Mar 7, 2015
This comment has been minimized.
This comment has been minimized.
|
I just published
|
feross
added
the
v3
label
Mar 7, 2015
This comment has been minimized.
This comment has been minimized.
|
Wow, eslint just made a change to properly support CommonJS module scope, i.e. using a variable name that is the same as a global is now allowed! eslint now understands that the local variable shadows the global in node (which we allow), and the "redefining a read-only variable" error goes away! This is basically approach 3. |
feross
added a commit
that referenced
this issue
Mar 9, 2015
feross
added a commit
that referenced
this issue
Mar 12, 2015
feross
closed this
Mar 12, 2015
This comment has been minimized.
This comment has been minimized.
QuantumInformation
commented
Mar 31, 2017
•
|
I'm getting 'CustomEvent' is not defined. Will this be added to the whitelist? Using "standard": "^9.0.2", |
This comment has been minimized.
This comment has been minimized.
|
Try `window.CustomEvent` instead
…On Fri, Mar 31, 2017 at 1:00 PM Nikos ***@***.***> wrote:
I'm getting 'CustomEvent' is not defined. Will this be added to the
whitelist?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#46 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACWlep2kj_YSZArnP-kFQimdKd1_x7FLks5rrNzDgaJpZM4Dmlfc>
.
|
This comment has been minimized.
This comment has been minimized.
QuantumInformation
commented
Mar 31, 2017
•
|
I just done this:
|
othiym23 commentedFeb 26, 2015
My best case against conflating the two modes is this incredibly silly change I had to make to npm to get the affected files through
standard. I know thatwindow.openeris a thing in browsers, but it has not been and never will be part of node, and this error message (like the one you get forcryptoin some contexts) makes no sense unless you know / care about the browser-side problem it's trying to address.I tried very hard to figure out how to remove / override the relevant global check via code comments, but either I don't understand how
eslintapplies those overrides, or it's simply not supported. Either way, I get that a lot of code will be browserified at some point and thus should pass the browser checks, but there is no plausible or reasonable reason to run npm in the browser (phrased that way because I know somebody probably is going to try anyway at some point). It should be OK for server-side apps to say "I am a server-only thing".