The no-yield-dispatch ESLint rule is allowing registry-dispatched actions to be returned from generator action functions.
It's only failing if a call to registry.dispatch() is returned directly; returning registry.dispatch().someAction() is not failing, as illustrated below in VSCode.
Steps to reproduce
Return a registry-dispatched action from a generator.
See no lint failure.
Directly return the call to registry.dispatch().
See the lint failure.
Screenshots
This is fine:
This fails:
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The no-yield-dispatch ESLint rule should throw an error when attempting to return the result of dispatching an action via the registry from a generator action.
Update packages/eslint-plugin/rules/no-yield-dispatch.test.js in the invalid array include a function that yields dispatched action, for example yield dispatch( CORE_MODULES ).activateModule( slug )
Bug Description
The
no-yield-dispatch
ESLint rule is allowing registry-dispatched actions to be returned from generator action functions.It's only failing if a call to
registry.dispatch()
is returned directly; returningregistry.dispatch().someAction()
is not failing, as illustrated below in VSCode.Steps to reproduce
registry.dispatch()
.Screenshots
This is fine:
This fails:
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
no-yield-dispatch
ESLint rule should throw an error when attempting to return the result of dispatching an action via the registry from a generator action.Implementation Brief
packages/eslint-plugin/rules/no-yield-dispatch.js
callee?.object?.callee?.name === 'dispatch'
Test Coverage
packages/eslint-plugin/rules/no-yield-dispatch.test.js
in theinvalid
array include a function that yields dispatched action, for exampleyield dispatch( CORE_MODULES ).activateModule( slug )
QA Brief
Changelog entry