asyncIifeInConstructorRefactor this asynchronous operation outside of the constructor. Async IIFEs create unhandled promises and incomplete object state.small-rules/no-async-constructorDisallow asynchronous operations inside class constructors. Constructors return immediately, so async work causes race conditions, unhandled rejections, and incomplete object states.
asyncIifeInConstructorRefactor this asynchronous operation outside of the constructor. Async IIFEs create unhandled promises and incomplete object state.awaitInConstructorRefactor this asynchronous operation outside of the constructor. Using 'await' in a constructor causes the class to be instantiated before the async operation completes.orphanedPromiseRefactor this asynchronous operation outside of the constructor. Promise assigned to '{{variableName}}' is never consumed - errors will be silently swallowed.promiseChainInConstructorRefactor this asynchronous operation outside of the constructor. Promise chains (.then/.catch/.finally) in constructors lead to race conditions.unhandledAsyncCallRefactor this asynchronous operation outside of the constructor. Calling async method '{{methodName}}' without handling its result creates uncontrolled async behavior.This rule does not accept options.
class BadThen { constructor() { fetch('/api').then(r => { this.data = r; }); }}class GoodFactory { private constructor(private data: string) {} static async create(): Promise<GoodFactory> { const data = await fetchData(); return new GoodFactory(data); }}