Skip to content

Commit 2c11d6e

Browse files
tools: lint js in doc/**/*.md
PR-URL: #55904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent f4cd4d9 commit 2c11d6e

19 files changed

+31
-34
lines changed

doc/api/errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
6161
<!-- eslint-disable no-useless-return -->
6262

6363
```js
64-
const fs = require('fs/promises');
64+
const fs = require('node:fs/promises');
6565

6666
(async () => {
6767
let data;

doc/api/esm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ module default import or its corresponding sugar syntax:
511511
512512
```js
513513
import { default as cjs } from 'cjs';
514-
// identical to the above
514+
// Identical to the above
515515
import cjsSugar from 'cjs';
516516

517517
console.log(cjs);

doc/api/inspector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ inspector.Network.requestWillBeSent({
505505
request: {
506506
url: 'https://nodejs.org/en',
507507
method: 'GET',
508-
}
508+
},
509509
});
510510
```
511511

doc/api/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ built-in modules and if a name matching a built-in module is added to the cache,
890890
only `node:`-prefixed require calls are going to receive the built-in module.
891891
Use with care!
892892

893-
<!-- eslint-disable node-core/no-duplicate-requires -->
893+
<!-- eslint-disable node-core/no-duplicate-requires, no-restricted-syntax -->
894894

895895
```js
896896
const assert = require('node:assert');

doc/api/perf_hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ performance.measure('Start to Now');
2828

2929
performance.mark('A');
3030
(async function doSomeLongRunningProcess() {
31-
await new Promise(r => setTimeout(r, 5000));
31+
await new Promise((r) => setTimeout(r, 5000));
3232
performance.measure('A to Now', 'A');
3333

3434
performance.mark('B');

doc/api/process.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,10 +2111,10 @@ class Test {
21112111
constructor() {
21122112
finalization.register(this, (ref) => ref.dispose());
21132113

2114-
// even something like this is highly discouraged
2114+
// Even something like this is highly discouraged
21152115
// finalization.register(this, () => this.dispose());
2116-
}
2117-
dispose() {}
2116+
}
2117+
dispose() {}
21182118
}
21192119
```
21202120

doc/api/punycode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `punycode` module is a bundled version of the [Punycode.js][] module. It
2121
can be accessed using:
2222

2323
```js
24-
const punycode = require('punycode');
24+
const punycode = require('node:punycode');
2525
```
2626

2727
[Punycode][] is a character encoding scheme defined by RFC 3492 that is

doc/api/stream.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ events (due to incorrect stream implementations) do not cause unexpected
315315
crashes. If this is unwanted behavior then `options.cleanup` should be set to
316316
`true`:
317317

318-
```js
318+
```mjs
319319
await finished(rs, { cleanup: true });
320320
```
321321

@@ -3926,7 +3926,7 @@ const { StringDecoder } = require('node:string_decoder');
39263926
class StringWritable extends Writable {
39273927
constructor(options) {
39283928
super(options);
3929-
this._decoder = new StringDecoder(options && options.defaultEncoding);
3929+
this._decoder = new StringDecoder(options?.defaultEncoding);
39303930
this.data = '';
39313931
}
39323932
_write(chunk, encoding, callback) {

doc/api/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3283,7 +3283,7 @@ test('snapshot test with default serialization', (t) => {
32833283

32843284
test('snapshot test with custom serialization', (t) => {
32853285
t.assert.snapshot({ value3: 3, value4: 4 }, {
3286-
serializers: [(value) => JSON.stringify(value)]
3286+
serializers: [(value) => JSON.stringify(value)],
32873287
});
32883288
});
32893289
```

doc/api/tls.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,13 @@ to set the security level to 0 while using the default OpenSSL cipher list, you
465465
const tls = require('node:tls');
466466
const port = 443;
467467

468-
tls.createServer({ciphers: 'DEFAULT@SECLEVEL=0', minVersion: 'TLSv1'}, function (socket) {
468+
tls.createServer({ ciphers: 'DEFAULT@SECLEVEL=0', minVersion: 'TLSv1' }, function(socket) {
469469
console.log('Client connected with protocol:', socket.getProtocol());
470470
socket.end();
471471
this.close();
472-
}).
473-
listen(port, () => {
474-
tls.connect(port, {ciphers: 'DEFAULT@SECLEVEL=0', maxVersion: 'TLSv1'});
472+
})
473+
.listen(port, () => {
474+
tls.connect(port, { ciphers: 'DEFAULT@SECLEVEL=0', maxVersion: 'TLSv1' });
475475
});
476476
```
477477

0 commit comments

Comments
 (0)