Closed samreid closed 2 years ago
I proposed a fix in the commits. @jessegreenberg can you please review?
Good idea, this is a good thing to catch. I tested the lint rule locally and it works. In https://github.com/phetsims/scenery/issues/1408 this helped identify that a legitimate expression missing in one of the assertions. I reviewed the other changes to the assert
usages in this issue and they seem correct.
Thanks! Ready to close?
Thanks, closing.
During https://github.com/phetsims/scenery/issues/1407 I noticed around 10 occurrences like:
Note that the string
'Need an active Node to update line width'
is truthy, so this is equivalent to callingassert && assert(true)
with no error message. Therefore it will never trigger. This can probably be also caught through type checking, but the type signature must allowstring|null
(for cases likeassert(this.myNullableString,'string should not be null by now)
so it may not be trivial. But a bad-text lint rule would be very easy. Here are the current failures: