Skip to content

Commit e2c3e47

Browse files
committed
doc: conform to rules for eslint-plugin-markdown
PR-URL: #12563 Refs: #12557 (comment) Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
1 parent b6d293d commit e2c3e47

18 files changed

+141
-137
lines changed

doc/api/assert.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ are evaluated also:
6363
const assert = require('assert');
6464

6565
const obj1 = {
66-
a : {
67-
b : 1
66+
a: {
67+
b: 1
6868
}
6969
};
7070
const obj2 = {
71-
a : {
72-
b : 2
71+
a: {
72+
b: 2
7373
}
7474
};
7575
const obj3 = {
76-
a : {
77-
b : 1
76+
a: {
77+
b: 1
7878
}
7979
};
8080
const obj4 = Object.create(obj1);
@@ -322,18 +322,18 @@ Tests for any deep inequality. Opposite of [`assert.deepEqual()`][].
322322
const assert = require('assert');
323323

324324
const obj1 = {
325-
a : {
326-
b : 1
325+
a: {
326+
b: 1
327327
}
328328
};
329329
const obj2 = {
330-
a : {
331-
b : 2
330+
a: {
331+
b: 2
332332
}
333333
};
334334
const obj3 = {
335-
a : {
336-
b : 1
335+
a: {
336+
b: 1
337337
}
338338
};
339339
const obj4 = Object.create(obj1);
@@ -368,10 +368,10 @@ Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][].
368368
```js
369369
const assert = require('assert');
370370

371-
assert.notDeepEqual({a:1}, {a:'1'});
371+
assert.notDeepEqual({a: 1}, {a: '1'});
372372
// AssertionError: { a: 1 } notDeepEqual { a: '1' }
373373

374-
assert.notDeepStrictEqual({a:1}, {a:'1'});
374+
assert.notDeepStrictEqual({a: 1}, {a: '1'});
375375
// OK
376376
```
377377

@@ -542,7 +542,7 @@ assert.throws(
542542
throw new Error('Wrong value');
543543
},
544544
function(err) {
545-
if ( (err instanceof Error) && /value/.test(err) ) {
545+
if ((err instanceof Error) && /value/.test(err)) {
546546
return true;
547547
}
548548
},

doc/api/buffer.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time
959959
const str = 'Node.js';
960960
const buf = Buffer.allocUnsafe(str.length);
961961

962-
for (let i = 0; i < str.length ; i++) {
962+
for (let i = 0; i < str.length; i++) {
963963
buf[i] = str.charCodeAt(i);
964964
}
965965

@@ -1087,7 +1087,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2`
10871087
const buf1 = Buffer.allocUnsafe(26);
10881088
const buf2 = Buffer.allocUnsafe(26).fill('!');
10891089

1090-
for (let i = 0 ; i < 26 ; i++) {
1090+
for (let i = 0; i < 26; i++) {
10911091
// 97 is the decimal ASCII value for 'a'
10921092
buf1[i] = i + 97;
10931093
}
@@ -1104,7 +1104,7 @@ overlapping region within the same `Buffer`
11041104
```js
11051105
const buf = Buffer.allocUnsafe(26);
11061106

1107-
for (let i = 0 ; i < 26 ; i++) {
1107+
for (let i = 0; i < 26; i++) {
11081108
// 97 is the decimal ASCII value for 'a'
11091109
buf[i] = i + 97;
11101110
}
@@ -1871,7 +1871,7 @@ one byte from the original `Buffer`
18711871
```js
18721872
const buf1 = Buffer.allocUnsafe(26);
18731873

1874-
for (let i = 0 ; i < 26 ; i++) {
1874+
for (let i = 0; i < 26; i++) {
18751875
// 97 is the decimal ASCII value for 'a'
18761876
buf1[i] = i + 97;
18771877
}
@@ -2021,9 +2021,9 @@ const json = JSON.stringify(buf);
20212021
console.log(json);
20222022

20232023
const copy = JSON.parse(json, (key, value) => {
2024-
return value && value.type === 'Buffer'
2025-
? Buffer.from(value.data)
2026-
: value;
2024+
return value && value.type === 'Buffer' ?
2025+
Buffer.from(value.data) :
2026+
value;
20272027
});
20282028

20292029
// Prints: <Buffer 01 02 03 04 05>
@@ -2049,7 +2049,7 @@ Examples:
20492049
```js
20502050
const buf1 = Buffer.allocUnsafe(26);
20512051

2052-
for (let i = 0 ; i < 26 ; i++) {
2052+
for (let i = 0; i < 26; i++) {
20532053
// 97 is the decimal ASCII value for 'a'
20542054
buf1[i] = i + 97;
20552055
}

doc/api/child_process.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ the process is spawned. The default options are:
200200
const defaults = {
201201
encoding: 'utf8',
202202
timeout: 0,
203-
maxBuffer: 200*1024,
203+
maxBuffer: 200 * 1024,
204204
killSignal: 'SIGTERM',
205205
cwd: null,
206206
env: null
@@ -933,13 +933,17 @@ as in this example:
933933
'use strict';
934934
const spawn = require('child_process').spawn;
935935

936-
const child = spawn('sh', ['-c',
937-
`node -e "setInterval(() => {
936+
const child = spawn(
937+
'sh',
938+
[
939+
'-c',
940+
`node -e "setInterval(() => {
938941
console.log(process.pid, 'is alive')
939942
}, 500);"`
940943
], {
941944
stdio: ['inherit', 'inherit', 'inherit']
942-
});
945+
}
946+
);
943947

944948
setTimeout(() => {
945949
child.kill(); // does not terminate the node process in the shell

doc/api/cluster.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,14 @@ When any of the workers die the cluster module will emit the `'exit'` event.
523523
This can be used to restart the worker by calling `.fork()` again.
524524

525525
```js
526-
cluster.on('exit', (worker, code, signal) => {
527-
console.log('worker %d died (%s). restarting...',
528-
worker.process.pid, signal || code);
529-
cluster.fork();
530-
});
526+
cluster.on(
527+
'exit',
528+
(worker, code, signal) => {
529+
console.log('worker %d died (%s). restarting...',
530+
worker.process.pid, signal || code);
531+
cluster.fork();
532+
}
533+
);
531534
```
532535

533536
See [child_process event: 'exit'][].

doc/api/console.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ the default behavior of `console` in Node.js.
142142
// new impl for assert without monkey-patching.
143143
const myConsole = Object.create(console, {
144144
assert: {
145-
value: function assert(assertion, message, ...args) {
145+
value(assertion, message, ...args) {
146146
try {
147147
console.assert(assertion, message, ...args);
148148
} catch (err) {
@@ -276,9 +276,7 @@ prints the result to `stdout`:
276276

277277
```js
278278
console.time('100-elements');
279-
for (let i = 0; i < 100; i++) {
280-
;
281-
}
279+
for (let i = 0; i < 100; i++) ;
282280
console.timeEnd('100-elements');
283281
// prints 100-elements: 225.438ms
284282
```

doc/api/crypto.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ decipher.on('end', () => {
288288
// Prints: some clear text data
289289
});
290290

291-
const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
291+
const encrypted =
292+
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
292293
decipher.write(encrypted, 'hex');
293294
decipher.end();
294295
```
@@ -312,7 +313,8 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods:
312313
const crypto = require('crypto');
313314
const decipher = crypto.createDecipher('aes192', 'a password');
314315

315-
const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
316+
const encrypted =
317+
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
316318
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
317319
decrypted += decipher.final('utf8');
318320
console.log(decrypted);

doc/api/domain.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function handleRequest(req, res) {
162162
setTimeout(() => {
163163
// Whoops!
164164
flerb.bark();
165-
});
165+
}, timeout);
166166
break;
167167
default:
168168
res.end('ok');

doc/api/http.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ const net = require('net');
309309
const url = require('url');
310310

311311
// Create an HTTP tunneling proxy
312-
const proxy = http.createServer( (req, res) => {
312+
const proxy = http.createServer((req, res) => {
313313
res.writeHead(200, {'Content-Type': 'text/plain'});
314314
res.end('okay');
315315
});
@@ -405,7 +405,7 @@ A client server pair demonstrating how to listen for the `'upgrade'` event.
405405
const http = require('http');
406406

407407
// Create an HTTP server
408-
const srv = http.createServer( (req, res) => {
408+
const srv = http.createServer((req, res) => {
409409
res.writeHead(200, {'Content-Type': 'text/plain'});
410410
res.end('okay');
411411
});
@@ -1570,10 +1570,10 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
15701570

15711571
let error;
15721572
if (statusCode !== 200) {
1573-
error = new Error(`Request Failed.\n` +
1573+
error = new Error('Request Failed.\n' +
15741574
`Status Code: ${statusCode}`);
15751575
} else if (!/^application\/json/.test(contentType)) {
1576-
error = new Error(`Invalid content-type.\n` +
1576+
error = new Error('Invalid content-type.\n' +
15771577
`Expected application/json but received ${contentType}`);
15781578
}
15791579
if (error) {

doc/api/modules.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ When a file is run directly from Node.js, `require.main` is set to its
7070
directly by testing
7171

7272
```js
73-
require.main === module
73+
require.main === module;
7474
```
7575

7676
For a file `foo.js`, this will be `true` if run via `node foo.js`, but
@@ -441,7 +441,7 @@ Before a module's code is executed, Node.js will wrap it with a function
441441
wrapper that looks like the following:
442442

443443
```js
444-
(function (exports, require, module, __filename, __dirname) {
444+
(function(exports, require, module, __filename, __dirname) {
445445
// Your module code actually lives in here
446446
});
447447
```

0 commit comments

Comments
 (0)