Skip to content

New rule: Prefer async functions over generator functions #313

@deanmarano

Description

@deanmarano

Hi there!

I was thinking a new rule for ensuring consistent usage of the async syntax:

Bad

default class extends Component {
  @task *fetchUser() {
    let user = yield this.currentUser.fetch();
    // ...
  }
}

Good

default class extends Component {
  fetchUser = task(async() => {
    let user = await this.currentUser.fetch();
    // ...
  }
}

Would something like this fit in your plugin? I'd be happy to take a stab at implementing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions