-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
util: replace process.noDeprecation with getOptionValue for deprecation handling #59063
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #59063 +/- ##
==========================================
- Coverage 90.06% 90.06% -0.01%
==========================================
Files 645 645
Lines 189130 189129 -1
Branches 37094 37098 +4
==========================================
- Hits 170339 170335 -4
+ Misses 11511 11471 -40
- Partials 7280 7323 +43
🚀 New features to boost your workflow:
|
@@ -182,8 +182,7 @@ function deprecate(fn, msg, code, useEmitSync, modifyPrototype = true) { | |||
); | |||
|
|||
function deprecated(...args) { | |||
// TODO(joyeecheung): use getOptionValue('--no-deprecation') instead. | |||
if (!process.noDeprecation) { | |||
if (!getOptionValue('--no-deprecation')) { |
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.
Unfortunately I don't think we can change this in this way. The process.noDeprecate
property can be set dynamically at runtime and there are applications out there that take advantage of it. This change would end up breaking those existing uses. The irony here would be that we'd likely need to deprecate the process.noDeprecation
flag.
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.
That I didn't know, and honestly, I'm not sure if that support for doing it dynamically should be deprecated.
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.
Yeah, in this case I think the TODO comment is just incorrect. As long as the option and the process.noDeprecation
flag are compatible with each other and non-contradictory, then I would just remove the TODO comment and leave this as is.
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.
I think the TODO comment was left during refactoring when I was trying to figure out whether it's deprecatable at all - but at this point I am inclined to think that it is not as this shows up quite often in GitHub code search and also I am fairly certain there was one point I had to tell others to use it when there's no other alternative to avoid triggering excessive runtime warnings. It's probably better to document it instead of deprecating it at this point.
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.
Yeah, the existing documentation (https://nodejs.org/docs/latest/api/process.html#processnodeprecation) leaves a lot to be desired.
one less TODO