When return; is added to the end of a block, intuitively you should expect it to make no difference to behaviour. However, in a redcr reducer, it results in the reducer returning undefined.
I can't think of a reason anyone would sensibly do this (in fact, maybe eslint would remove it?) but it low-hanging fruit so worth fixing anyway.
Describe the bug
When
return;
is added to the end of a block, intuitively you should expect it to make no difference to behaviour. However, in a redcr reducer, it results in the reducer returningundefined
.I can't think of a reason anyone would sensibly do this (in fact, maybe eslint would remove it?) but it low-hanging fruit so worth fixing anyway.
Sample input
Current output
Specify which ES version you're targeting: ES2020
There are 2 returns, and the first should just be removed entirely.