Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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 packages/eslint-plugin/src/rules/require-await.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
20 changes: 20 additions & 0 deletions packages/eslint-plugin/tests/rules/require-await.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ async function* foo(): Promise<string> {
yield* x;
}
`,
`
const fn = async () => {
await using foo = new Bar();
};
`,
],

invalid: [
Expand Down Expand Up @@ -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
Expand Down