unicorn/no-await-expression-member Style
What it does
Disallows member access from await
expressions.
Why is this bad?
When accessing a member from an await
expression, the await
expression has to be parenthesized, which is not readable.
Example
javascript
async function bad() {
const secondElement = (await getArray())[1];
}
async function good() {
const [, secondElement] = await getArray();
}
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny unicorn/no-await-expression-member
json
{
"rules": {
"unicorn/no-await-expression-member": "error"
}
}