Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 769 Bytes

no-yield-in-race.md

File metadata and controls

34 lines (26 loc) · 769 Bytes

Prevent usage of yield in race entries (no-yield-in-race)

fixable

import { race, call } from "redux-saga"

// Good
function* good() {
  yield race({
    posts: call(fetchApis)
  })
}

function* good() {
  yield race({
    watchers: [call(watcher1), call(watcher2)]
  })
}

// Bad
function* bad() {
  yield race({ posts: yield call(fetchApis) })
}

function* bad() {
  yield race({
    watchers: yield [call(watcher1), call(watcher2)]
  })
}

The --fix option on the command line automatically fixes problems reported by this rule.