doc: fix indentation issues in sample code · nodejs/node@f1d92fb · GitHub
Skip to content

Commit f1d92fb

Browse files
Trottaddaleax
authored andcommitted
doc: fix indentation issues in sample code
In preparation for stricter ESLint indentation checking, fix a few issues in sample code. PR-URL: #13950 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f53bfe4 commit f1d92fb

8 files changed

Lines changed: 108 additions & 104 deletions

File tree

doc/api/crypto.md

Lines changed: 5 additions & 3 deletions

doc/api/errors.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -323,21 +323,22 @@ function makeFaster() {
323323
});
324324
}
325325

326-
makeFaster(); // will throw:
327-
// /home/gbusey/file.js:6
328-
// throw new Error('oh no!');
329-
// ^
330-
// Error: oh no!
331-
// at speedy (/home/gbusey/file.js:6:11)
332-
// at makeFaster (/home/gbusey/file.js:5:3)
333-
// at Object.<anonymous> (/home/gbusey/file.js:10:1)
334-
// at Module._compile (module.js:456:26)
335-
// at Object.Module._extensions..js (module.js:474:10)
336-
// at Module.load (module.js:356:32)
337-
// at Function.Module._load (module.js:312:12)
338-
// at Function.Module.runMain (module.js:497:10)
339-
// at startup (node.js:119:16)
340-
// at node.js:906:3
326+
makeFaster();
327+
// will throw:
328+
// /home/gbusey/file.js:6
329+
// throw new Error('oh no!');
330+
// ^
331+
// Error: oh no!
332+
// at speedy (/home/gbusey/file.js:6:11)
333+
// at makeFaster (/home/gbusey/file.js:5:3)
334+
// at Object.<anonymous> (/home/gbusey/file.js:10:1)
335+
// at Module._compile (module.js:456:26)
336+
// at Object.Module._extensions..js (module.js:474:10)
337+
// at Module.load (module.js:356:32)
338+
// at Function.Module._load (module.js:312:12)
339+
// at Function.Module.runMain (module.js:497:10)
340+
// at startup (node.js:119:16)
341+
// at node.js:906:3
341342
```
342343

343344
The location information will be one of:
@@ -368,7 +369,7 @@ For example:
368369

369370
```js
370371
require('net').connect(-1);
371-
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
372+
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
372373
```
373374

374375
Node.js will generate and throw `RangeError` instances *immediately* as a form
@@ -385,7 +386,7 @@ will do so.
385386

386387
```js
387388
doesNotExist;
388-
// throws ReferenceError, doesNotExist is not a variable in this program.
389+
// throws ReferenceError, doesNotExist is not a variable in this program.
389390
```
390391

391392
Unless an application is dynamically generating and running code,
@@ -419,7 +420,7 @@ string would be considered a TypeError.
419420

420421
```js
421422
require('url').parse(() => { });
422-
// throws TypeError, since it expected a string
423+
// throws TypeError, since it expected a string
423424
```
424425

425426
Node.js will generate and throw `TypeError` instances *immediately* as a form
@@ -640,7 +641,7 @@ const urlSearchParams = new URLSearchParams('foo=bar&baz=new');
640641

641642
const buf = Buffer.alloc(1);
642643
urlSearchParams.has.call(buf, 'foo');
643-
// Throws a TypeError with code 'ERR_INVALID_THIS'
644+
// Throws a TypeError with code 'ERR_INVALID_THIS'
644645
```
645646

646647
<a id="ERR_INVALID_TUPLE"></a>

doc/api/fs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,10 @@ support. If `filename` is provided, it will be provided as a `Buffer` if
235235
```js
236236
// Example when handled through fs.watch listener
237237
fs.watch('./tmp', { encoding: 'buffer' }, (eventType, filename) => {
238-
if (filename)
238+
if (filename) {
239239
console.log(filename);
240240
// Prints: <Buffer ...>
241+
}
241242
});
242243
```
243244

doc/api/net.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ double-backslashes, such as:
4040

4141
```js
4242
net.createServer().listen(
43-
path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
43+
path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
4444
```
4545

4646
## Class: net.Server

doc/api/querystring.md

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)