Pattern: Member access from await
expression
Issue: -
Accessing members directly from an await
expression requires parentheses, which reduces code readability. Use destructuring or intermediate variables instead.
Example of incorrect code:
async function bad() {
const secondElement = (await getArray())[1];
}
Example of correct code:
async function good() {
const [, secondElement] = await getArray();
}