Skip to content

Commit 312bb4d

Browse files
LiviaMedeirosruyadorno
authored andcommitted
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 352daac commit 312bb4d

17 files changed

+27
-30
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/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
@@ -889,7 +889,7 @@ built-in modules and if a name matching a built-in module is added to the cache,
889889
only `node:`-prefixed require calls are going to receive the built-in module.
890890
Use with care!
891891

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

894894
```js
895895
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
@@ -2099,10 +2099,10 @@ class Test {
20992099
constructor() {
21002100
finalization.register(this, (ref) => ref.dispose());
21012101

2102-
// even something like this is highly discouraged
2102+
// Even something like this is highly discouraged
21032103
// finalization.register(this, () => this.dispose());
2104-
}
2105-
dispose() {}
2104+
}
2105+
dispose() {}
21062106
}
21072107
```
21082108

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

@@ -3916,7 +3916,7 @@ const { StringDecoder } = require('node:string_decoder');
39163916
class StringWritable extends Writable {
39173917
constructor(options) {
39183918
super(options);
3919-
this._decoder = new StringDecoder(options && options.defaultEncoding);
3919+
this._decoder = new StringDecoder(options?.defaultEncoding);
39203920
this.data = '';
39213921
}
39223922
_write(chunk, encoding, callback) {

doc/api/test.md

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

32573257
test('snapshot test with custom serialization', (t) => {
32583258
t.assert.snapshot({ value3: 3, value4: 4 }, {
3259-
serializers: [(value) => JSON.stringify(value)]
3259+
serializers: [(value) => JSON.stringify(value)],
32603260
});
32613261
});
32623262
```

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

doc/api/tracing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ console.log(trace_events.getEnabledCategories());
245245
```js
246246
'use strict';
247247

248-
const { Session } = require('inspector');
248+
const { Session } = require('node:inspector');
249249
const session = new Session();
250250
session.connect();
251251

0 commit comments

Comments
 (0)