Skip to content

Commit 258eeaa

Browse files
cjihrigevanlucas
authored andcommitted
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 ac52923 commit 258eeaa

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
@@ -46,6 +46,7 @@ rules:
4646
no-unused-labels: 2
4747
no-useless-call: 2
4848
no-useless-escape: 2
49+
no-useless-return: 2
4950
no-void: 2
5051
no-with: 2
5152

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
@@ -282,7 +282,6 @@ function enqueue(self, toEnqueue) {
282282
self.once('listening', clearQueue);
283283
}
284284
self._queue.push(toEnqueue);
285-
return;
286285
}
287286

288287

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
@@ -222,7 +222,6 @@ function processList(section) {
222222
current.options.push(n);
223223
current = n;
224224
}
225-
return;
226225
} else if (type === 'list_item_end') {
227226
if (!current) {
228227
throw new Error('invalid list - end without current item\n' +
@@ -495,9 +494,6 @@ function finishSection(section, parent) {
495494
parent[k] = parent[k].concat(section[k]);
496495
} else if (!parent[k]) {
497496
parent[k] = section[k];
498-
} else {
499-
// parent already has, and it's not an array.
500-
return;
501497
}
502498
}
503499
});

0 commit comments

Comments
 (0)