diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 86049b04e587..c2dd66f8252d 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -149,6 +149,7 @@ export default createRule({ 'ArrowFunctionExpression:exit': exitFunction, AwaitExpression: markAsHasAwait, + 'VariableDeclaration[kind = "await using"]': markAsHasAwait, 'ForOfStatement[await = true]': markAsHasAwait, 'YieldExpression[delegate = true]': markAsHasDelegateGen, diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 6e36dcf10c22..7bcb1d6a0b4f 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -232,6 +232,11 @@ async function* foo(): Promise { yield* x; } `, + ` + const fn = async () => { + await using foo = new Bar(); + }; + `, ], invalid: [ @@ -410,6 +415,21 @@ async function* asyncGenerator() { }, ], }, + { + code: ` + const fn = async () => { + using foo = new Bar(); + }; + `, + errors: [ + { + messageId: 'missingAwait', + data: { + name: "Async arrow function 'fn'", + }, + }, + ], + }, ], }); // base eslint tests pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy