π Disallow member access from await expression.
πΌπ« This rule is enabled in the β
recommended config. This rule is disabled in the βοΈ unopinionated config.
π§ This rule is automatically fixable by the --fix CLI option.
When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable.
This rule is fixable for simple member access.
// β
const foo = (await import('./foo.js')).default;
// β
const {default: foo} = await import('./foo.js');// β
const secondElement = (await getArray())[1];
// β
const [, secondElement] = await getArray();// β
const property = (await getObject()).property;
// β
const {property} = await getObject();// β
const data = await (await fetch('/foo')).json();
// β
const response = await fetch('/foo');
const data = await response.json();