chore: clean up ValidationResult for NumericalInput problems#2849
chore: clean up ValidationResult for NumericalInput problems#2849bradenmacdonald merged 1 commit intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
@jesusbalderramawgu could you please review this tiny PR? I'm testing out a new linter and it caught a very minor issue with one of your PRs. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2849 +/- ##
==========================================
- Coverage 95.18% 95.18% -0.01%
==========================================
Files 1318 1318
Lines 30012 30011 -1
Branches 6549 6776 +227
==========================================
- Hits 28566 28565 -1
+ Misses 1387 1375 -12
- Partials 59 71 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jesusbalderramawgu
left a comment
There was a problem hiding this comment.
looks good to me and totally agree with your boolean explanation, thanks!
of course, I reviewed this already, thank you! |
|
@jesusbalderramawgu Thanks, that was fast! |
ChrisChV
left a comment
There was a problem hiding this comment.
Looks good! 👍 I found a bug that is not related to this PR: https://www.loom.com/share/9bfd9025aa944afa8ffc4c1780e9624a
- I tested this: I verified that the numerical verification works
- I read through the code and considered the security, stability and performance implications of the changes.
|
Thanks @ChrisChV. Could you please open a new issue for that bug? |
Description
This fixes a minor issue with the code in the Numerical Input problem editor answer validation.
Specifically, the code
isInvalid={!data?.isValid ?? true}If you think about it:
isValidistrue, then this evaluates to{!true ?? true}which is{false ?? true}which isfalse.isValidisfalse, then this evaluates to{!false ?? true}which is{true ?? true}which istrue.isValidisundefined, then this evaluates to{!undefined ?? true}which is{true ?? true}which istrue.In any case, the
?? truehas absolutely no effect. Andoxlintactually warns about this:As it says, "this expression always evaluates to the constant on the left-hand side", so there is no need for the right-hand side.
I also added a type definition for the validation data.
Supporting information
This follows #2615 and is part of the work to test oxlint in this repo - #2559
Testing instructions
Test that validation of numerical input answers is working the same as it was before.
Other information
Include anything else that will help reviewers and consumers understand the change.
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'