Closed lijunle closed 5 years ago
This seems pretty difficult to maintain and use in practice as a general rule. We have many examples in our code bases where such a pairing within the same file wouldn't work at all. I'd recommend implementing this as a custom rule in your projects.
If a file calls
ReactDOM.render
, it could better to callReactDOM.unmountComponentAtNode
in this same file when dispose.I have a rule to count the calls to
ReactDOM.render
andReactDOM.unmountComponentAtNode
in the same file. If they are not the same, report an error on it.Besides, if the returning value of
ReactDOM.render
call is captured by a variable, that variable should be unset toundefined
ornull
something in the file to avoid memory leak.Is this project accepting such a rule?