
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
52 lines
851 B
Plaintext
52 lines
851 B
Plaintext
== Why is this an issue?
|
|
|
|
An ``++async++`` function always wraps the return value in a ``++Promise++``. Using ``++return await++`` is not required and comes at an extra performance cost.
|
|
However, you might wish to keep it as it preserves the function call in the stack trace in case an error is thrown asynchronously.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
async function foo() {
|
|
// ...
|
|
}
|
|
|
|
async function bar() {
|
|
// ...
|
|
return await foo(); // Noncompliant
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
async function foo() {
|
|
// ...
|
|
}
|
|
|
|
async function bar() {
|
|
// ...
|
|
return foo();
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Remove this "await" keyword.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
the "await statement"
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|