Skip to content

Commit a256482

Browse files
TrottMylesBorins
authored andcommitted
doc,test: remove unnecessary await with return instances
Remove unnecessary `await` in combination with `return` in preparation for enabling lint rule. PR-URL: #17265 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 78592a3 commit a256482

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

doc/api/util.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For example:
3131
const util = require('util');
3232

3333
async function fn() {
34-
return await Promise.resolve('hello world');
34+
return 'hello world';
3535
}
3636
const callbackFunction = util.callbackify(fn);
3737

test/common/inspector-helper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class NodeInstance {
390390
console.log('[test]', 'Connecting to a child Node process');
391391
const response = await this.httpGet(null, '/json/list');
392392
const url = response[0]['webSocketDebuggerUrl'];
393-
return await this.wsHandshake(url);
393+
return this.wsHandshake(url);
394394
}
395395

396396
expectShutdown() {

test/parallel/test-util-callbackify.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const values = [
2828
for (const value of values) {
2929
// Test and `async function`
3030
async function asyncFn() {
31-
return await Promise.resolve(value);
31+
return value;
3232
}
3333

3434
const cbAsyncFn = callbackify(asyncFn);
@@ -70,7 +70,7 @@ const values = [
7070
for (const value of values) {
7171
// Test an `async function`
7272
async function asyncFn() {
73-
return await Promise.reject(value);
73+
return Promise.reject(value);
7474
}
7575

7676
const cbAsyncFn = callbackify(asyncFn);
@@ -142,7 +142,7 @@ const values = [
142142
for (const value of values) {
143143
async function asyncFn(arg) {
144144
assert.strictEqual(arg, value);
145-
return await Promise.resolve(arg);
145+
return arg;
146146
}
147147

148148
const cbAsyncFn = callbackify(asyncFn);
@@ -183,7 +183,7 @@ const values = [
183183
const iAmThat = {
184184
async fn(arg) {
185185
assert.strictEqual(this, iAmThat);
186-
return await Promise.resolve(arg);
186+
return arg;
187187
},
188188
};
189189
iAmThat.cbFn = callbackify(iAmThat.fn);
@@ -241,7 +241,7 @@ const values = [
241241

242242
{
243243
async function asyncFn() {
244-
return await Promise.resolve(42);
244+
return 42;
245245
}
246246

247247
const cb = callbackify(asyncFn);

0 commit comments

Comments
 (0)