Closed SaeedZhiany closed 5 years ago
Which rule is reporting that error? You can find out using the verbose or stylish formatter.
I'm currently traveling right now and can't test. I provide all resources to reproduce the error, can you test it yourself, please?
Only a guess, it's probably produced by "no-null-keyword": true
Ok, yeah, it's the no-null-keyword
rule. I think this is part of a broader discussion of null restrictions here https://github.com/palantir/tslint/issues/2798
This rule is fairly extreme and probably not suited for general use until we can sort out a good way to deal with the problems described in the linked issue. Closing as a duplicate for now
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
I got an error with the message
use undefined instead of null
inreturn null
statement ofgetDerivedStateFromProps
.Expected behavior
According to react documentation
getDerivedStateFromProps
must returnnull
when there is no actual state change.I completely understand we must use
undefined
instead ofnull
in any elsewhere and I know I can ignore the error in that line, but I want to ask to add a feature thattslint-react
ignore automatically such special case.