Rules
no-direct-mutation-state
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Presets
xrecommendedrecommended-typescriptrecommended-type-checked
Description
Disallow direct mutation of this.state.
NEVER mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.
The only place that's acceptable to assign this.state is in a class component's constructor.