As discovered in !4497, we have a ton of PropType violations in unit tests.
There is no static analysis for PropTypes, and long-term we should move to TypeScript.
React at best does console.error(); we had code in src/setupTests.ts to intercept that in unit tests and throw exceptions on violations, so they would fail tests.
At some point we were down to <5 test files with violations, but the error matching logic got broken and many console.errors were not printing at all, so over a hundred violations in ~36 test files crept in...
At present stage, I'm making them print out but not fail tests => this card is to clean them up.
Acceptance criteria
- Re-enable throw() for PropType errors in src/setupTests.ts and CI passes.
- grep the full CI output — no type-related console.error messages anywhere.
(ideally these 2 bullets are equivalent, but I'm seeing some printed without corresponding test failure?)
Tips: Ways to fix an error
- Note that some errors reflect issue in the type declaration and not usage e.g.:
- Warning: UpgradeAcknowledgeModal: type specification of prop `modalData` is invalid; the type checker function must return `null` or an `Error` but returned a function. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).
- Invalid prop `fromVersion` of type `string` supplied to `UpgradeAcknowledgeWarning`, expected `function`
- Most errors are isRequired props that tests omit. Either pass in test or decide it's not really isRequired...
- It's also fine to convert to TypeScript, if you want
There are no Sub-Tasks for this issue.