Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: simplify recommendations in process.md
Remove recommendation that has no explanation. Make the other
recommendation less wordy.

PR-URL: #42556
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
  • Loading branch information
Trott committed Apr 3, 2022
commit b07dc4d19fdbc15b4f76557dc45b3ce3a43ad0c3
6 changes: 2 additions & 4 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<!-- source_link=lib/process.js -->

The `process` object provides information about, and control over, the current
Node.js process. While it is available as a global, it is recommended to
explicitly access it via require or import:
Node.js process.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference here would be to add text explaining why the global should be avoided, but I don't know what that reason is. Also, with this change, there is now no mention of process being available as a global and that is something that should be mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mentioned here:

node/doc/api/globals.md

Lines 467 to 477 in 175638b

## `process`
<!-- YAML
added: v0.1.7
-->
<!-- type=global -->
* {Object}
The process object. See the [`process` object][] section.

I don't think we need more, especially if the intent is to promote importing/requiring the core module rather than rely on the global property.


```mjs
import process from 'process';
Expand Down Expand Up @@ -1487,8 +1486,7 @@ The following additional handling is implemented if the warning `type` is
### Avoiding duplicate warnings

As a best practice, warnings should be emitted only once per process. To do
so, it is recommended to place the `emitWarning()` behind a simple boolean
flag as illustrated in the example below:
so, place the `emitWarning()` behind a boolean.

```mjs
import { emitWarning } from 'process';
Expand Down