Changelog - 2026-11-08
A new lint rule against calling a method on a new instance inside an await
New Feature Behavior ChangeIn one line. houseConfigs and reactHouseConfigs now include venizia/no-await-new-chain at error: declare the instance first, then await on its own line.
What changed
- The rule.
await new Runner(options).run()andconst text = await new Response(body).text()are reported. Declare the instance, then await:const runner = new Runner(options); await runner.run();. - Builder chains.
await new SignJWT(claims).setIssuer(issuer).sign(key)is reported. Declare the builder up to its last call, then await that call. - What stays allowed.
await new Promise(...)(no method is called on the instance),await new X().prop(not a call), and an instance that is already declared. - A fixer.
eslint --fixanddevz codemod async-styledeclare the instance in aconstnamed after the class, when theawaitis the whole statement or the whole initializer of a declaration, or nothing that does more than read a value runs before it. Other findings are reported and left for you. - It runs in test files too, like the other async rules.
Who is affected
- A project that uses
houseConfigsorreactHouseConfigs. The next lint run reports eachawait new X(...).method(...). Rundevz codemod async-styleto fix them, oreslint --fix. - Everyone else. No action needed.
Details
typescript
// Before: reported
const text = await new Response(body).text();
// After: the fix
const response = new Response(body);
const text = await response.text();| File | Package |
|---|---|
src/linters/house/no-await-new-chain.rule.ts | dev-configs |
src/linters/house/plugin.ts | dev-configs |
src/linters/house/async-rules.ts | dev-configs |
src/cli/codemod/async-style.ts | dev-configs |