Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: enable no-return-await lint rule #17265

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ rules:
message: __defineGetter__ is deprecated.
- property: __defineSetter__
message: __defineSetter__ is deprecated.
no-return-await: error
no-self-assign: error
no-throw-literal: error
no-unused-labels: error
Expand Down
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For example:
const util = require('util');

async function fn() {
return await Promise.resolve('hello world');
return 'hello world';
}
const callbackFunction = util.callbackify(fn);

Expand Down
2 changes: 1 addition & 1 deletion test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class NodeInstance {
console.log('[test]', 'Connecting to a child Node process');
const response = await this.httpGet(null, '/json/list');
const url = response[0]['webSocketDebuggerUrl'];
return await this.wsHandshake(url);
return this.wsHandshake(url);
}

expectShutdown() {
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-util-callbackify.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const values = [
for (const value of values) {
// Test and `async function`
async function asyncFn() {
return await Promise.resolve(value);
return value;
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -70,7 +70,7 @@ const values = [
for (const value of values) {
// Test an `async function`
async function asyncFn() {
return await Promise.reject(value);
return Promise.reject(value);
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -142,7 +142,7 @@ const values = [
for (const value of values) {
async function asyncFn(arg) {
assert.strictEqual(arg, value);
return await Promise.resolve(arg);
return arg;
}

const cbAsyncFn = callbackify(asyncFn);
Expand Down Expand Up @@ -183,7 +183,7 @@ const values = [
const iAmThat = {
async fn(arg) {
assert.strictEqual(this, iAmThat);
return await Promise.resolve(arg);
return arg;
},
};
iAmThat.cbFn = callbackify(iAmThat.fn);
Expand Down Expand Up @@ -241,7 +241,7 @@ const values = [

{
async function asyncFn() {
return await Promise.resolve(42);
return 42;
}

const cb = callbackify(asyncFn);
Expand Down