Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ If no arguments are passed in at all `message` will be set to the string:
Be aware that in the `repl` the error message will be different to the one
thrown in a file! See below for further details.

<!-- eslint-skip -->
<!-- eslint-disable no-restricted-syntax -->

```mjs
import assert from 'node:assert/strict';
Expand Down Expand Up @@ -1720,7 +1720,7 @@ assert.ok(0);
// assert.ok(0)
```

<!-- eslint-skip -->
<!-- eslint-disable no-restricted-syntax -->

```cjs
const assert = require('node:assert/strict');
Expand Down
8 changes: 2 additions & 6 deletions doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ added: v8.3.0
Maintains an internal counter specific to `label` and outputs to `stdout` the
number of times `console.count()` has been called with the given `label`.

<!-- eslint-skip -->

```js
```console
> console.count()
default: 1
undefined
Expand Down Expand Up @@ -274,9 +272,7 @@ added: v8.3.0

Resets the internal counter specific to `label`.

<!-- eslint-skip -->

```js
```console
> console.count('abc');
abc: 1
undefined
Expand Down
2 changes: 0 additions & 2 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ try {
}
```

<!-- eslint-enable no-global-assign -->

When using the lexical ESM `import` keyword, the error can only be
caught if a handler for `process.on('uncaughtException')` is registered
_before_ any attempt to load the module is made (using, for instance,
Expand Down
96 changes: 36 additions & 60 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][],
that are currently configured for DNS resolution. A string will include a port
section if a custom port is used.

<!-- eslint-disable @stylistic/js/semi-->

```js
```json
[
'8.8.8.8',
'2001:4860:4860::8888',
'8.8.8.8:1053',
'[2001:4860:4860::8888]:1053',
"8.8.8.8",
"2001:4860:4860::8888",
"8.8.8.8:1053",
"[2001:4860:4860::8888]:1053",
]
```

Expand Down Expand Up @@ -559,8 +557,6 @@ will be present on the object:

Here is an example of the `ret` object passed to the callback:

<!-- eslint-disable @stylistic/js/semi -->

```js
[ { type: 'A', address: '127.0.0.1', ttl: 299 },
{ type: 'CNAME', value: 'example.com' },
Expand All @@ -574,7 +570,7 @@ Here is an example of the `ret` object passed to the callback:
refresh: 900,
retry: 900,
expire: 1800,
minttl: 60 } ]
minttl: 60 } ];
```

DNS server operators may choose not to respond to `ANY`
Expand Down Expand Up @@ -678,17 +674,15 @@ function will contain an array of objects with the following properties:
* `order`
* `preference`

<!-- eslint-skip -->

```js
{
({
flags: 's',
service: 'SIP+D2U',
regexp: '',
replacement: '_sip._udp.example.com',
order: 30,
preference: 100
}
preference: 100,
});
```

## `dns.resolveNs(hostname, callback)`
Expand Down Expand Up @@ -763,18 +757,16 @@ be an object with the following properties:
* `expire`
* `minttl`

<!-- eslint-skip -->

```js
{
({
nsname: 'ns.example.com',
hostmaster: 'root.example.com',
serial: 2013101809,
refresh: 10000,
retry: 2400,
expire: 604800,
minttl: 3600
}
minttl: 3600,
});
```

## `dns.resolveSrv(hostname, callback)`
Expand Down Expand Up @@ -803,15 +795,13 @@ be an array of objects with the following properties:
* `port`
* `name`

<!-- eslint-skip -->

```js
{
({
priority: 10,
weight: 5,
port: 21223,
name: 'service.example.com'
}
name: 'service.example.com',
});
```

## `dns.resolveTlsa(hostname, callback)`
Expand Down Expand Up @@ -840,15 +830,13 @@ array of objects with these properties:
* `match`
* `data`

<!-- eslint-skip -->

```js
{
({
certUsage: 3,
selector: 1,
match: 1,
data: [ArrayBuffer]
}
data: [ArrayBuffer],
});
```

## `dns.resolveTxt(hostname, callback)`
Expand Down Expand Up @@ -1081,14 +1069,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][],
that are currently configured for DNS resolution. A string will include a port
section if a custom port is used.

<!-- eslint-disable @stylistic/js/semi-->

```js
```json
[
'8.8.8.8',
'2001:4860:4860::8888',
'8.8.8.8:1053',
'[2001:4860:4860::8888]:1053',
"8.8.8.8",
"2001:4860:4860::8888",
"8.8.8.8:1053",
"[2001:4860:4860::8888]:1053"
]
```

Expand Down Expand Up @@ -1329,8 +1315,6 @@ present on the object:

Here is an example of the result object:

<!-- eslint-disable @stylistic/js/semi -->

```js
[ { type: 'A', address: '127.0.0.1', ttl: 299 },
{ type: 'CNAME', value: 'example.com' },
Expand All @@ -1344,7 +1328,7 @@ Here is an example of the result object:
refresh: 900,
retry: 900,
expire: 1800,
minttl: 60 } ]
minttl: 60 } ];
```

### `dnsPromises.resolveCaa(hostname)`
Expand Down Expand Up @@ -1407,17 +1391,15 @@ of objects with the following properties:
* `order`
* `preference`

<!-- eslint-skip -->

```js
{
({
flags: 's',
service: 'SIP+D2U',
regexp: '',
replacement: '_sip._udp.example.com',
order: 30,
preference: 100
}
preference: 100,
});
```

### `dnsPromises.resolveNs(hostname)`
Expand Down Expand Up @@ -1465,18 +1447,16 @@ following properties:
* `expire`
* `minttl`

<!-- eslint-skip -->

```js
{
({
nsname: 'ns.example.com',
hostmaster: 'root.example.com',
serial: 2013101809,
refresh: 10000,
retry: 2400,
expire: 604800,
minttl: 3600
}
minttl: 3600,
});
```

### `dnsPromises.resolveSrv(hostname)`
Expand All @@ -1496,15 +1476,13 @@ the following properties:
* `port`
* `name`

<!-- eslint-skip -->

```js
{
({
priority: 10,
weight: 5,
port: 21223,
name: 'service.example.com'
}
name: 'service.example.com',
});
```

### `dnsPromises.resolveTlsa(hostname)`
Expand All @@ -1526,15 +1504,13 @@ with these properties:
* `match`
* `data`

<!-- eslint-skip -->

```js
{
({
certUsage: 3,
selector: 1,
match: 1,
data: [ArrayBuffer]
}
data: [ArrayBuffer],
});
```

### `dnsPromises.resolveTxt(hostname)`
Expand Down
2 changes: 0 additions & 2 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,6 @@ console.log(cjs === cjsSugar);
This Module Namespace Exotic Object can be directly observed either when using
`import * as m from 'cjs'` or a dynamic import:

<!-- eslint-skip -->

```js
import * as m from 'cjs';
console.log(m);
Expand Down
16 changes: 7 additions & 9 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ property, which is an array of `[key, value, key2, value2, ...]`. For
example, the previous message header object might have a `rawHeaders`
list like the following:

<!-- eslint-disable @stylistic/js/semi -->

```js
[ 'ConTent-Length', '123456',
'content-LENGTH', '123',
'content-type', 'text/plain',
'CONNECTION', 'keep-alive',
'Host', 'example.com',
'accepT', '*/*' ]
```json
[ "ConTent-Length", "123456",
"content-LENGTH", "123",
"content-type", "text/plain",
"CONNECTION", "keep-alive",
"Host", "example.com",
"accepT", "*/*" ]
```

## Class: `http.Agent`
Expand Down
6 changes: 2 additions & 4 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4303,10 +4303,8 @@ Accept: text/plain

Then `request.url` will be:

<!-- eslint-disable @stylistic/js/semi -->

```js
'/status?name=ryan'
```json
"/status?name=ryan"
```

To parse the url into its parts, `new URL()` can be used:
Expand Down
6 changes: 1 addition & 5 deletions doc/api/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,21 +1128,17 @@ export async function load(url, context, nextLoad) {
Unlike synchronous hooks, the asynchronous hooks would not run for these modules loaded in the file
that calls `register()`:

<!-- eslint-disable no-restricted-globals -->

```mjs
// register-hooks.js
import { register, createRequire } from 'node:module';
register('./hooks.mjs', import.meta.url);

// Asynchronous hooks does not affect modules loaded via custom require()
// functions created by module.createRequire().
const userRequire = createRequire(__filename);
const userRequire = createRequire(import.meta.filename);
userRequire('./my-app-2.cjs'); // Hooks won't affect this
```

<!-- eslint-enable no-restricted-globals -->

```cjs
// register-hooks.js
const { register, createRequire } = require('node:module');
Expand Down
8 changes: 2 additions & 6 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ the default export in the `.default` property, similar to the results returned b
To customize what should be returned by `require(esm)` directly, the ES Module can export the
desired value using the string name `"module.exports"`.

<!-- eslint-disable @stylistic/js/semi -->

```mjs
// point.mjs
export default class Point {
Expand All @@ -273,7 +271,7 @@ export default class Point {
// `distance` is lost to CommonJS consumers of this module, unless it's
// added to `Point` as a static property.
export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); }
export { Point as 'module.exports' }
export { Point as 'module.exports' };
```

<!-- eslint-disable node-core/no-duplicate-requires -->
Expand All @@ -293,8 +291,6 @@ named exports, the module can make sure that the default export is an object wit
named exports attached to it as properties. For example with the example above,
`distance` can be attached to the default export, the `Point` class, as a static method.

<!-- eslint-disable @stylistic/js/semi -->

```mjs
export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); }

Expand All @@ -303,7 +299,7 @@ export default class Point {
static distance = distance;
}

export { Point as 'module.exports' }
export { Point as 'module.exports' };
```

<!-- eslint-disable node-core/no-duplicate-requires -->
Expand Down
Loading
Loading