-
Notifications
You must be signed in to change notification settings - Fork 172
Refactor frontend part 6 #2800
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
Refactor frontend part 6 #2800
Conversation
Improves type safety.
This was missed during the initial migration.
Dependents include the associated types and tests.
Improves correctness and consistency.
It was causing the tests to fail.
…nto fe-refactor-6
This is now no longer needed since we made the prop optional.
…nto fe-refactor-6
* Standardize to lambda function * Standardize to `React.FC` typing * Remove unnecessary props parameter typing * Destructure props directly in function parameter
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.
Thanks for working on this! However, there are a few slight issues/changes that I would like to see, besides that everything else seems fine to me.
src/pages/academy/gameSimulator/subcomponents/GameSimulatorCheckpointTxtLoader.tsx
Outdated
Show resolved
Hide resolved
src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx
Outdated
Show resolved
Hide resolved
…nto fe-refactor-6
…nto fe-refactor-6
…nto fe-refactor-6
* Use `React.FC` type for components * Type props as `Props` unless exported * Place props type immediately above component * Use lambda functions for components * Destructure props in function parameter * Use types for props, not interfaces * Combine unnecessary `OwnProps` to props type * Remove unused exports of props types Remaining components will be migrated in the future.
* Type props as `Props` unless exported * Place props type immediately above component
Also removed some unnecessary `useState` type arguments.
Also removed some unnecessary `useState` type arguments.
Prefer the more succint `React.FC` instead.
We want to always use `useTypedSelector` for type-safety.
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.
I've looked through the changes on every file one more time and all seems good – almost all the changes are simple typing/convention refactors anyway (not logic refactors) so besides bumping dependencies, there is no concern for a regression.
* Add generic type argument to column definitions Improves type safety. * Migrate bp4 classes to bp5 This was missed during the initial migration. * Remove unused `AcademyReducer` and dependents Dependents include the associated types and tests. * Update imports Improves correctness and consistency. * Fix lint * Undo test import change It was causing the tests to fail. * Remove unnecessay `loadContentDispatch` sometimes This is now no longer needed since we made the prop optional. * Update test snapshots * Make component typings more consistent * Standardize to lambda function * Standardize to `React.FC` typing * Remove unnecessary props parameter typing * Destructure props directly in function parameter * Bump dependencies * Fix class name typo * Change relative import to project-based import * Bump dependencies * Update test snapshots * Standardize typings * Use `React.FC` type for components * Type props as `Props` unless exported * Place props type immediately above component * Use lambda functions for components * Destructure props in function parameter * Use types for props, not interfaces * Combine unnecessary `OwnProps` to props type * Remove unused exports of props types Remaining components will be migrated in the future. * Remove unnecessary generic type arguments * Standardize ControlBar components typings * Type props as `Props` unless exported * Place props type immediately above component * Standardize more component typings Also removed some unnecessary `useState` type arguments. * Fix compile error * Standardize remaining component typings Also removed some unnecessary `useState` type arguments. * Ban `React.FunctionComponent` type Prefer the more succint `React.FC` instead. * Ban `useSelector` import We want to always use `useTypedSelector` for type-safety.
Description
Focuses on fixing bugs (regressions), improving type safety, and removing dead code.
Please refer to commit history for list of changes.
Fixes #2797, though ideally we should not be hardcoding them (i.e., it's not a true "fix" of the root cause).
Also bans the following via ESLint rules (thus technically a breaking change – though the codebase has been updated to ensure everything is compliant):
React.FunctionComponent
→ useReact.FC
for succinctnessuseSelector
→ useuseTypedSelector
for type-safetyType of change
How to test
Checklist