Skip to content

Commit 7a4d383

Browse files
committed
tools: enable no-useless-return eslint rule
PR-URL: #12577 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 0084260 commit 7a4d383

File tree

6 files changed

+5
-7
lines changed

6 files changed

+5
-7
lines changed

.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ rules:
5050
no-unused-labels: 2
5151
no-useless-call: 2
5252
no-useless-escape: 2
53+
no-useless-return: 2
5354
no-void: 2
5455
no-with: 2
5556

doc/api/errors.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
6464
argument is not `null` and is an instance of `Error`, then an error occurred
6565
that should be handled.
6666

67+
<!-- eslint-disable no-useless-return -->
6768
```js
6869
const fs = require('fs');
6970
fs.readFile('a file that does not exist', (err, data) => {

doc/api/stream.md

+1
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ unexpected and inconsistent behavior depending on whether the stream is
15661566
operating in flowing or paused mode. Using the `'error'` event ensures
15671567
consistent and predictable handling of errors.
15681568

1569+
<!-- eslint-disable no-useless-return -->
15691570
```js
15701571
const Readable = require('stream').Readable;
15711572

lib/dgram.js

-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ function enqueue(self, toEnqueue) {
307307
self.once('listening', onListenSuccess);
308308
}
309309
self._queue.push(toEnqueue);
310-
return;
311310
}
312311

313312

test/parallel/test-require-symlink.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ if (common.isWindows) {
3030
if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) {
3131
common.skip('insufficient privileges');
3232
return;
33-
} else {
34-
test();
3533
}
34+
35+
test();
3636
});
3737
} else {
3838
test();

tools/doc/json.js

-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ function processList(section) {
243243
current.options.push(n);
244244
current = n;
245245
}
246-
return;
247246
} else if (type === 'list_item_end') {
248247
if (!current) {
249248
throw new Error('invalid list - end without current item\n' +
@@ -516,9 +515,6 @@ function finishSection(section, parent) {
516515
parent[k] = parent[k].concat(section[k]);
517516
} else if (!parent[k]) {
518517
parent[k] = section[k];
519-
} else {
520-
// parent already has, and it's not an array.
521-
return;
522518
}
523519
}
524520
});

0 commit comments

Comments
 (0)