-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
events: remove unneeded safety check code #9866
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
events: remove unneeded safety check code #9866
Conversation
In the process of creating nodejs#9865, it was discovered that the code checking whether or not events was defined was unnecessary because the only situation in which events would be undefined is if it is monkeypatched by an external entity. This should be removed in order to discourage this. If the test added in nodejs#9865 is merged, it will need to removed on merge of this commit.
In theory, seems good to me, but I'd want to know if we can get a feel for if this is used in the ecosystem. I'd guess not but I've certainly been surprised in the past, so |
I'm not so sure about this change. If we actually enforced that messing with underscored properties ( |
I seem to recall some third party module using |
Its really common for code to derive from EventEmitter, but forget to call the EventEmitter constructor, so the only reason for these checks is not monkey patching. This is semver-major, and I'm -1 on it. |
@sam-github Do you mean If so: @captainsafia Maybe the thing to do is close this and add the above situation to your test in #9865. If not: @sam-github Can you demonstrate with sample code or something? |
@sam-github: Thanks for adding in this insight!
@Trott: Yep. This is the case.
Closing this in favor of augmenting the test suite introduced in #9865. |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
events
Description of change
In the process of creating #9865, it was discovered that the code
checking whether or not events was defined was unnecessary because
the only situation in which events would be undefined is if it is
monkeypatched by an external entity. This should be removed in order
to discourage this. If the test added in #9865 is merged, it will
need to removed on merge of this commit.
Before merging this change we might want to check and see if any
significant usage of monkeypatching
events
in the ecosystem.