A class component writes this.state outside the constructor, which does not render
What it finds
this.state.count = 1 in a React class component: changing the state object directly does not schedule a render, so the screen shows the old value, and a later setState may overwrite the change. this.setState({ count: 1 }) updates and renders.
Reported are assignments to this.state or to a member of it, outside the constructor, in classes whose base class has Component in its name, as Component, PureComponent and React.Component do.
From the rule's source, state_write_without_render.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:state-write-without-render" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:state-write-without-render] reason="..."tx0 explain tx0/ts:state-write-without-render shows the same in the terminal. Found a false positive? Report it.