Closed
Description
I don't want to disable the eslint rule "no-param-reassign" globally, because it prevents errors.
So this seems to be the best way to use immer with that rule enabled:
const nextState = produce(baseState, (draftState) => {
/* eslint-disable no-param-reassign */
draftState.test = "New value";
/* eslint-enable no-param-reassign */
});
There is a way to specify "ignorePropertyModificationsFor" for that eslint rule (https://eslint.org/docs/rules/no-param-reassign). So draftState could be ignored. But that would only exclude that name.
Is there a better way without disabling that rule?
Metadata
Metadata
Assignees
Labels
No labels