-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(null): null strictness for injected/components, /visualizations, deps #6244
Conversation
) | ||
.join(';'); | ||
} | ||
public static getSelectorFromTarget = (target: Target): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this still return undefined
if target
is undefined
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, intentionally; there are still a bunch of indirect usages in non-strict-null files right now (mostly via assessment-builder
) and I haven't analyzed all of them yet, so I wanted to simultaneously:
- keep the original behavior intact to avoid breaking those cases accidentally (that's why there's still unit tests for this behavior as well)
- strengthen the typing so that cases that are strict-null-checked and can verify that they don't pass undefined targets will also understand that they won't get back undefined selectors given that they're using it right.
I'll add a comment to that effect, I agree it isn't obvious enough from just reading the code that this would be intentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and I'll do the same for getTargetFromSelector
, for the same reasons)
Details
This PR continues the work from #6226 and #6223, adding another layer of injected files to the strict null check list.
The only case with a notable behavioral change is that axe-core technically documents in its typings that it's allowed to omit a "how to fix" section from results, but if it were to actually do so, our cards UI would currently crash. I don't think axe-core actually omits that info in practice (I suspect it's there to accomodate custom rules), but now if it were to do so, we'd omit the section from the card rather than crashing (similar to how we handle results with missing snippets).
This ended up enabling a lot of files to be autoadded! It brings us from ~72% null-strict to ~78%
Motivation
#2869
Context
n/a
Pull request checklist
yarn null:autoadd
yarn fastpass
yarn test
)<rootDir>/test-results/unit/coverage
fix:
,chore:
,feat(feature-name):
,refactor:
). SeeCONTRIBUTING.md
.