Skip to content

Generators-Should-Yield

Sourcery rule id: generators-should-yield

Description

Avoid writing generators that don't yield any values.

Match

function* wrongGen(x) {
  let val = 0;
  val += x;
}

Explanation

Generators without yield statements are confusing, since they defy a reader's expectations.