Skip to content

Commit a8533cf

Browse files
vsemozhetbytjasnell
authored andcommitted
doc: add quotes for event names + fix similar nits
PR-URL: #19915 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent a60e498 commit a8533cf

26 files changed

+194
-193
lines changed

doc/api/assert.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ added: v0.1.21
561561
changes:
562562
- version: REPLACEME
563563
pr-url: https://github.com/nodejs/node/pull/18418
564-
description: Calling `assert.fail` with more than one argument is deprecated
565-
and emits a warning.
564+
description: Calling `assert.fail()` with more than one argument is
565+
deprecated and emits a warning.
566566
-->
567567
* `actual` {any}
568568
* `expected` {any}

doc/api/async_hooks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const async_hooks = require('async_hooks');
1515
## Terminology
1616

1717
An asynchronous resource represents an object with an associated callback.
18-
This callback may be called multiple times, for example, the `connection` event
19-
in `net.createServer`, or just a single time like in `fs.open`. A resource
20-
can also be closed before the callback is called. AsyncHook does not
18+
This callback may be called multiple times, for example, the `'connection'`
19+
event in `net.createServer()`, or just a single time like in `fs.open()`.
20+
A resource can also be closed before the callback is called. AsyncHook does not
2121
explicitly distinguish between these different cases but will represent them
2222
as the abstract concept that is a resource.
2323

@@ -128,7 +128,7 @@ const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
128128

129129
If any `AsyncHook` callbacks throw, the application will print the stack trace
130130
and exit. The exit path does follow that of an uncaught exception, but
131-
all `uncaughtException` listeners are removed, thus forcing the process to
131+
all `'uncaughtException'` listeners are removed, thus forcing the process to
132132
exit. The `'exit'` callbacks will still be called unless the application is run
133133
with `--abort-on-uncaught-exception`, in which case a stack trace will be
134134
printed and the application exits, leaving a core file.

doc/api/child_process.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,8 @@ pipes between the parent and child. The value is one of the following:
608608
between parent and child. A [`ChildProcess`][] may have at most *one* IPC stdio
609609
file descriptor. Setting this option enables the [`subprocess.send()`][]
610610
method. If the child is a Node.js process, the presence of an IPC channel
611-
will enable [`process.send()`][], [`process.disconnect()`][],
612-
[`process.on('disconnect')`][], and [`process.on('message')`] within the
613-
child.
611+
will enable [`process.send()`][] and [`process.disconnect()`][] methods,
612+
as well as [`'disconnect'`][] and [`'message'`][] events within the child.
614613

615614
Accessing the IPC channel fd in any way other than [`process.send()`][]
616615
or using the IPC channel with a child process that is not a Node.js instance
@@ -651,8 +650,8 @@ spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
651650
*It is worth noting that when an IPC channel is established between the
652651
parent and child processes, and the child is a Node.js process, the child
653652
is launched with the IPC channel unreferenced (using `unref()`) until the
654-
child registers an event handler for the [`process.on('disconnect')`][] event
655-
or the [`process.on('message')`][] event. This allows the child to exit
653+
child registers an event handler for the [`'disconnect'`][] event
654+
or the [`'message'`][] event. This allows the child to exit
656655
normally without the process being held open by the open IPC channel.*
657656

658657
See also: [`child_process.exec()`][] and [`child_process.fork()`][]
@@ -1103,8 +1102,7 @@ changes:
11031102
When an IPC channel has been established between the parent and child (
11041103
i.e. when using [`child_process.fork()`][]), the `subprocess.send()` method can
11051104
be used to send messages to the child process. When the child process is a
1106-
Node.js instance, these messages can be received via the
1107-
[`process.on('message')`][] event.
1105+
Node.js instance, these messages can be received via the [`'message'`][] event.
11081106

11091107
The message goes through serialization and parsing. The resulting
11101108
message might not be the same as what is originally sent.
@@ -1139,16 +1137,16 @@ allows the child to send messages back to the parent.
11391137

11401138
There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
11411139
containing a `NODE_` prefix in the `cmd` property are reserved for use within
1142-
Node.js core and will not be emitted in the child's [`process.on('message')`][]
1140+
Node.js core and will not be emitted in the child's [`'message'`][]
11431141
event. Rather, such messages are emitted using the
1144-
`process.on('internalMessage')` event and are consumed internally by Node.js.
1142+
`'internalMessage'` event and are consumed internally by Node.js.
11451143
Applications should avoid using such messages or listening for
11461144
`'internalMessage'` events as it is subject to change without notice.
11471145

11481146
The optional `sendHandle` argument that may be passed to `subprocess.send()` is
11491147
for passing a TCP server or socket object to the child process. The child will
11501148
receive the object as the second argument passed to the callback function
1151-
registered on the [`process.on('message')`][] event. Any data that is received
1149+
registered on the [`'message'`][] event. Any data that is received
11521150
and buffered in the socket will not be sent to the child.
11531151

11541152
The optional `callback` is a function that is invoked after the message is
@@ -1363,8 +1361,10 @@ the same requirement. Thus, in `child_process` functions where a shell can be
13631361
spawned, `'cmd.exe'` is used as a fallback if `process.env.ComSpec` is
13641362
unavailable.
13651363

1364+
[`'disconnect'`]: process.html#process_event_disconnect
13661365
[`'error'`]: #child_process_event_error
13671366
[`'exit'`]: #child_process_event_exit
1367+
[`'message'`]: process.html#process_event_message
13681368
[`ChildProcess`]: #child_process_child_process
13691369
[`Error`]: errors.html#errors_class_error
13701370
[`EventEmitter`]: events.html#events_class_eventemitter
@@ -1389,8 +1389,6 @@ unavailable.
13891389
[`process.disconnect()`]: process.html#process_process_disconnect
13901390
[`process.env`]: process.html#process_process_env
13911391
[`process.execPath`]: process.html#process_process_execpath
1392-
[`process.on('disconnect')`]: process.html#process_event_disconnect
1393-
[`process.on('message')`]: process.html#process_event_message
13941392
[`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback
13951393
[`stdio`]: #child_process_options_stdio
13961394
[`util.promisify()`]: util.html#util_util_promisify_original

doc/api/cluster.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ added: v0.7.0
192192
* `message` {Object}
193193
* `handle` {undefined|Object}
194194

195-
Similar to the `cluster.on('message')` event, but specific to this worker.
195+
Similar to the `'message'` event of `cluster`, but specific to this worker.
196196

197197
Within a worker, `process.on('message')` may also be used.
198198

@@ -463,7 +463,7 @@ added: v0.7.9
463463

464464
Emitted after the worker IPC channel has disconnected. This can occur when a
465465
worker exits gracefully, is killed, or is disconnected manually (such as with
466-
worker.disconnect()).
466+
`worker.disconnect()`).
467467

468468
There may be a delay between the `'disconnect'` and `'exit'` events. These
469469
events can be used to detect if the process is stuck in a cleanup or if there
@@ -497,7 +497,7 @@ cluster.on('exit', (worker, code, signal) => {
497497
});
498498
```
499499

500-
See [child_process event: 'exit'][].
500+
See [child_process event: `'exit'`][].
501501

502502
## Event: 'fork'
503503
<!-- YAML
@@ -573,7 +573,7 @@ changes:
573573

574574
Emitted when the cluster master receives a message from any worker.
575575

576-
See [child_process event: 'message'][].
576+
See [child_process event: `'message'`][].
577577

578578
Before Node.js v6.0, this event emitted only the message and the handle,
579579
but not the worker object, contrary to what the documentation stated.
@@ -603,7 +603,7 @@ added: v0.7.0
603603
After forking a new worker, the worker should respond with an online message.
604604
When the master receives an online message it will emit this event.
605605
The difference between `'fork'` and `'online'` is that fork is emitted when the
606-
master forks a worker, and 'online' is emitted when the worker is running.
606+
master forks a worker, and `'online'` is emitted when the worker is running.
607607

608608
```js
609609
cluster.on('online', (worker) => {
@@ -846,6 +846,6 @@ socket.on('data', (id) => {
846846
[`server.close()`]: net.html#net_event_close
847847
[`worker.exitedAfterDisconnect`]: #cluster_worker_exitedafterdisconnect
848848
[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options
849-
[child_process event: 'exit']: child_process.html#child_process_event_exit
850-
[child_process event: 'message']: child_process.html#child_process_event_message
849+
[child_process event: `'exit'`]: child_process.html#child_process_event_exit
850+
[child_process event: `'message'`]: child_process.html#child_process_event_message
851851
[`cluster.settings`]: #cluster_cluster_settings

doc/api/console.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ added: v8.0.0
492492
* `label` {string}
493493

494494
This method does not display anything unless used in the inspector. The
495-
`console.timeStamp()` method adds an event with the label `label` to the
495+
`console.timeStamp()` method adds an event with the label `'label'` to the
496496
**Timeline** panel of the inspector.
497497

498498
### console.timeline([label])

doc/api/deprecations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ API instead.
806806
807807
Type: End-of-Life
808808
809-
`runInAsyncIdScope` doesn't emit the `before` or `after` event and can thus
809+
`runInAsyncIdScope` doesn't emit the `'before'` or `'after'` event and can thus
810810
cause a lot of issues. See https://github.com/nodejs/node/issues/14328 for more
811811
details.
812812

doc/api/dgram.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,13 @@ and port can be retrieved using [`socket.address().address`][] and
605605
added: v0.1.99
606606
-->
607607

608-
* `type` {string} - Either 'udp4' or 'udp6'.
608+
* `type` {string} - Either `'udp4'` or `'udp6'`.
609609
* `callback` {Function} - Attached as a listener to `'message'` events.
610610
* Returns: {dgram.Socket}
611611

612612
Creates a `dgram.Socket` object of the specified `type`. The `type` argument
613-
can be either `udp4` or `udp6`. An optional `callback` function can be passed
614-
which is added as a listener for `'message'` events.
613+
can be either `'udp4'` or `'udp6'`. An optional `callback` function can be
614+
passed which is added as a listener for `'message'` events.
615615

616616
Once the socket is created, calling [`socket.bind()`][] will instruct the
617617
socket to begin listening for datagram messages. When `address` and `port` are

doc/api/documentation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ failures or behavior changes when API modifications occur. To help avoid such
6363
surprises, `Experimental` features may require a command-line flag to
6464
explicitly enable them, or may cause a process warning to be emitted.
6565
By default, such warnings are printed to [`stderr`][] and may be handled by
66-
attaching a listener to the [`process.on('warning')`][] event.
66+
attaching a listener to the [`'warning'`][] event.
6767

6868
## JSON Output
6969
<!-- YAML
@@ -94,9 +94,9 @@ relative to Linux and macOS. For an example of the subtle ways in which it's
9494
sometimes impossible to replace Unix syscall semantics on Windows, see [Node
9595
issue 4760](https://github.com/nodejs/node/issues/4760).
9696

97-
[submit an issue]: https://github.com/nodejs/node/issues/new
98-
[the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
97+
[`'warning'`]: process.html#process_event_warning
9998
[`stderr`]: process.html#process_process_stderr
100-
[`process.on('warning')`]: process.html#process_event_warning
10199
[`fs.open()`]: fs.html#fs_fs_open_path_flags_mode_callback
102100
[`fs.lchown()`]: fs.html#fs_fs_lchown_path_uid_gid_callback
101+
[submit an issue]: https://github.com/nodejs/node/issues/new
102+
[the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md

doc/api/domain.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ binding.
299299

300300
This also works with timers that are returned from [`setInterval()`][] and
301301
[`setTimeout()`][]. If their callback function throws, it will be caught by
302-
the domain 'error' handler.
302+
the domain `'error'` handler.
303303

304304
If the Timer or EventEmitter was already bound to a domain, it is removed
305305
from that one, and bound to this one instead.
@@ -334,30 +334,30 @@ d.on('error', (er) => {
334334

335335
### domain.enter()
336336

337-
The `enter` method is plumbing used by the `run`, `bind`, and `intercept`
338-
methods to set the active domain. It sets `domain.active` and `process.domain`
339-
to the domain, and implicitly pushes the domain onto the domain stack managed
340-
by the domain module (see [`domain.exit()`][] for details on the domain stack).
341-
The call to `enter` delimits the beginning of a chain of asynchronous calls and
342-
I/O operations bound to a domain.
337+
The `enter()` method is plumbing used by the `run()`, `bind()`, and
338+
`intercept()` methods to set the active domain. It sets `domain.active` and
339+
`process.domain` to the domain, and implicitly pushes the domain onto the domain
340+
stack managed by the domain module (see [`domain.exit()`][] for details on the
341+
domain stack). The call to `enter()` delimits the beginning of a chain of
342+
asynchronous calls and I/O operations bound to a domain.
343343

344-
Calling `enter` changes only the active domain, and does not alter the domain
345-
itself. `enter` and `exit` can be called an arbitrary number of times on a
344+
Calling `enter()` changes only the active domain, and does not alter the domain
345+
itself. `enter()` and `exit()` can be called an arbitrary number of times on a
346346
single domain.
347347

348348
### domain.exit()
349349

350-
The `exit` method exits the current domain, popping it off the domain stack.
350+
The `exit()` method exits the current domain, popping it off the domain stack.
351351
Any time execution is going to switch to the context of a different chain of
352352
asynchronous calls, it's important to ensure that the current domain is exited.
353-
The call to `exit` delimits either the end of or an interruption to the chain
353+
The call to `exit()` delimits either the end of or an interruption to the chain
354354
of asynchronous calls and I/O operations bound to a domain.
355355

356356
If there are multiple, nested domains bound to the current execution context,
357-
`exit` will exit any domains nested within this domain.
357+
`exit()` will exit any domains nested within this domain.
358358

359-
Calling `exit` changes only the active domain, and does not alter the domain
360-
itself. `enter` and `exit` can be called an arbitrary number of times on a
359+
Calling `exit()` changes only the active domain, and does not alter the domain
360+
itself. `enter()` and `exit()` can be called an arbitrary number of times on a
361361
single domain.
362362

363363
### domain.intercept(callback)
@@ -481,7 +481,7 @@ d2.run(() => {
481481
```
482482

483483
Note that domains will not interfere with the error handling mechanisms for
484-
Promises, i.e. no `error` event will be emitted for unhandled Promise
484+
Promises, i.e. no `'error'` event will be emitted for unhandled Promise
485485
rejections.
486486

487487
[`Error`]: errors.html#errors_class_error

doc/api/errors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ For *all* [`EventEmitter`][] objects, if an `'error'` event handler is not
109109
provided, the error will be thrown, causing the Node.js process to report an
110110
unhandled exception and crash unless either: The [`domain`][domains] module is
111111
used appropriately or a handler has been registered for the
112-
[`process.on('uncaughtException')`][] event.
112+
[`'uncaughtException'`][] event.
113113

114114
```js
115115
const EventEmitter = require('events');
@@ -1438,7 +1438,7 @@ An attempt was made to use a readable stream that did not implement
14381438
<a id="ERR_STREAM_UNSHIFT_AFTER_END_EVENT"></a>
14391439
### ERR_STREAM_UNSHIFT_AFTER_END_EVENT
14401440

1441-
An attempt was made to call [`stream.unshift()`][] after the `end` event was
1441+
An attempt was made to call [`stream.unshift()`][] after the `'end'` event was
14421442
emitted.
14431443

14441444
<a id="ERR_STREAM_WRAP"></a>
@@ -1656,6 +1656,7 @@ meaning of the error depends on the specific function.
16561656

16571657
Creation of a [`zlib`][] object failed due to incorrect configuration.
16581658

1659+
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
16591660
[`--force-fips`]: cli.html#cli_force_fips
16601661
[`child_process`]: child_process.html
16611662
[`cipher.getAuthTag()`]: crypto.html#crypto_cipher_getauthtag
@@ -1687,7 +1688,6 @@ Creation of a [`zlib`][] object failed due to incorrect configuration.
16871688
[`net`]: net.html
16881689
[`new URL(input)`]: url.html#url_constructor_new_url_input_base
16891690
[`new URLSearchParams(iterable)`]: url.html#url_constructor_new_urlsearchparams_iterable
1690-
[`process.on('uncaughtException')`]: process.html#process_event_uncaughtexception
16911691
[`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback
16921692
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
16931693
[`require('crypto').setEngine()`]: crypto.html#crypto_crypto_setengine_engine_flags

0 commit comments

Comments
 (0)