react
react copied to clipboard
FIO-7733: type the form component
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-7733
Description
General Updates
- Updates the build system to use tsc rather than babel
- Removes unused dependencies
- Removes test runner dependencies (updated tests to follow!)
- Updates eslint ergonomics to ensure React best practices
- Pulls EventEmitter from @formio/js
- Updates documentation
- Removes stale types
- Removes stale tests
- Adds jest and @testing-library/react so we can write and maintain a modern test suite
Updates to <Form />
- Fully types the component and its props
- Reorgs the code so as not to instantiate utility functions in the render function
- Updates the
src
prop to resemble thecreateForm
API (i.e. it takes either a form definition or a form url) - Renames some props to conform to idiomatic prop names (see below)
- Consolidates effect functions
- Updates the render element ref to use
useRef
Breaking Changes / Backwards Compatibility
Generally speaking the goal is to be backwards compatible here (see e.g. the getEffectiveProps
function), but I would point the reviewer specifically towards the EventEmitter change and broadly towards testing this PR in your own existing application so we can be sure that everything works properly.
Dependencies
How has this PR been tested?
I've loaded this PR into a simple Next.js application to ensure everything works as expected. Also, now that we've moved away from karma, I expect to add more tests in the next major PR to this library.
Checklist:
- [x] I have completed the above PR template
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation (if applicable)
- [x] My changes generate no new warnings
- [ ] My changes include tests that prove my fix is effective (or that my feature works as intended)
- [x] New and existing unit/integration tests pass locally with my changes
- [x] Any dependent changes have corresponding PRs that are listed above
@brendanbond Do we need PR to type the FormBuilder ? I do have experience with it.
@gyanendrasinghpanwar I started that today, perhaps since i'm going from top to bottom you could go bottom to top and meet in the middle, maybe you could start typing FormGrid?
@brendanbond Absolutely, sounds like a solid plan! I'm ready to collaborate on getting the builder ready. Going from bottom to top works for me. Once we've got that sorted, we can dive into FormGrid or FormEdit. Feel free to share any suggestions or preferences along the way.