Skip to content

unicorn/no-await-expression-member Style

🚧 An auto-fix is still under development.

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();
}

References

Released under the MIT License.