Skip to content

Commit b920c5d

Browse files
cjihrigMylesBorins
authored andcommitted
tools: enable no-useless-return eslint rule
PR-URL: #12577 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
1 parent 3cce181 commit b920c5d

File tree

7 files changed

+5
-8
lines changed

7 files changed

+5
-8
lines changed

.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ rules:
4545
no-unused-labels: 2
4646
no-useless-call: 2
4747
no-useless-escape: 2
48+
no-useless-return: 2
4849
no-void: 2
4950
no-with: 2
5051

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
@@ -1548,6 +1548,7 @@ unexpected and inconsistent behavior depending on whether the stream is
15481548
operating in flowing or paused mode. Using the `'error'` event ensures
15491549
consistent and predictable handling of errors.
15501550

1551+
<!-- eslint-disable no-useless-return -->
15511552
```js
15521553
const Readable = require('stream').Readable;
15531554

lib/dgram.js

-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ function enqueue(self, toEnqueue) {
286286
self.once('listening', clearQueue);
287287
}
288288
self._queue.push(toEnqueue);
289-
return;
290289
}
291290

292291

test/parallel/test-fs-symlink.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ if (common.isWindows) {
1414
exec('whoami /priv', function(err, o) {
1515
if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) {
1616
common.skip('insufficient privileges');
17-
return;
1817
}
1918
});
2019
}

test/parallel/test-require-symlink.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ if (common.isWindows) {
2929
if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) {
3030
common.skip('insufficient privileges');
3131
return;
32-
} else {
33-
test();
3432
}
33+
34+
test();
3535
});
3636
} else {
3737
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' +
@@ -499,9 +498,6 @@ function finishSection(section, parent) {
499498
parent[k] = parent[k].concat(section[k]);
500499
} else if (!parent[k]) {
501500
parent[k] = section[k];
502-
} else {
503-
// parent already has, and it's not an array.
504-
return;
505501
}
506502
}
507503
});

0 commit comments

Comments
 (0)