Skip to content

Rule for async without await #339

@ryanc-bs

Description

@ryanc-bs

Hi, I'm wondering what you think about adding a rule to catch async functions that have no await statements - and which could therefore be changed into sync functions for a small performance and simplicity gain.

It could work in the same way as this no-async-without-await rule in TSLint: https://palantir.github.io/tslint/rules/no-async-without-await/#:~:text=Marking%20a%20function%20as%20async,keyword%20is%20there%20by%20mistake.

Of course there may be instances where a function needs to be async to satisfy some external interface. But in all other cases, it would be useful to have a way to scan for pointless async functions.

I don't think an auto-fix would be very simple since the call sites also need to be updated, but flagging as a warning for manual fixing would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions