Skip to content

Detect awaiting non-invoked functions? #521

@AlCalzone

Description

@AlCalzone

While enabling wotan for a project of mine, I found this gem:

await this.observeGroupsAndScenes; // Unnecessary 'await' of a non-Promise value. [await-only-promise]

where observeGroupsAndScenes is a function that returns a promise. While wotan helped me find this, (and the --fix option removed the await 😨), I think it could be smarter - in this case I forgot the parentheses:

await this.observeGroupsAndScenes(); // correct

Would it be possible to detect this and provide both errors?
Like "Unnecessary 'await' of a non-Promise value" OR "Did you forget parentheses?"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions