formio / react

JSON powered forms for React.js
https://form.io
MIT License
305 stars 269 forks source link

FIO-7733: type the form component #558

Closed brendanbond closed 4 months ago

brendanbond commented 7 months ago

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-7733

Description

General Updates

  1. Updates the build system to use tsc rather than babel
  2. Removes unused dependencies
  3. Removes test runner dependencies (updated tests to follow!)
  4. Updates eslint ergonomics to ensure React best practices
  5. Pulls EventEmitter from @formio/js
  6. Updates documentation
  7. Removes stale types
  8. Removes stale tests
  9. Adds jest and @testing-library/react so we can write and maintain a modern test suite

Updates to <Form />

  1. Fully types the component and its props
  2. Reorgs the code so as not to instantiate utility functions in the render function
  3. Updates the src prop to resemble the createForm API (i.e. it takes either a form definition or a form url)
  4. Renames some props to conform to idiomatic prop names (see below)
  5. Consolidates effect functions
  6. 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:

gyanendrasinghpanwar commented 6 months ago

@brendanbond Do we need PR to type the FormBuilder ? I do have experience with it.

brendanbond commented 6 months ago

@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?

gyanendrasinghpanwar commented 6 months ago

@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.