Skip to content
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: remove usage of deprecated .defaultProps #4449

Merged
merged 17 commits into from Dec 30, 2023

Conversation

tourman
Copy link
Contributor

@tourman tourman commented Dec 11, 2023

This PR:

  • removes usage of deprecated .defaultProps from all components
  • replaces getElementType() with getComponentType() as getElementType() relied on presence of .defaultProps
  • updates unit tests to not use .defaultProps

Fixes #4426.


@layershifter please take a look at the basic changes on #4426. If you are fine with them, I'll proceed with the tests. You can review it with the hidden whitespace.

  • The entries of .defaultProps are replaced with function getDefaultProps() to ensure minimum code changes. As the linter rule no-use-before-define forbids using functions before their declarations, I've taken the rule using eslint --print-config and modified it to pass the validation.
  • Instead of using the default arguments, I've suggested the solution with _.defaults as the props may be used in children functions/components.

transform.js (WIP)

transform.js (WIP)

transform.js: get all files (WIP)

transform.js: const defaultProps (WIP)

transform.js: function + eslint rules (WIP)
@tourman
Copy link
Contributor Author

tourman commented Dec 11, 2023

@layershifter oh I see now, that you'd prefer _.defaults instead of just defaults style, using Lodash.

@tourman tourman changed the title 4426 #4426: no defaultProps Dec 11, 2023
@layershifter
Copy link
Member

@tourman thanks for contributing ❤️ It's one of the issue that prevents me from shipping the next beta. However, I am more leaning towards changes proposed in #4426 (comment). To me getDefaultProps() and _.defaults() looks like additional complexity and code debt. WDYT?

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e243fa4) 99.51% compared to head (77f7953) 99.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4449      +/-   ##
==========================================
- Coverage   99.51%   99.50%   -0.01%     
==========================================
  Files         186      186              
  Lines        3512     3466      -46     
==========================================
- Hits         3495     3449      -46     
  Misses         17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@layershifter layershifter marked this pull request as ready for review December 30, 2023 09:48
@layershifter layershifter changed the title #4426: no defaultProps chore: remove usage of deprecated .defaultProps Dec 30, 2023
@layershifter layershifter merged commit 5646905 into Semantic-Org:master Dec 30, 2023
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormInput: Support for defaultProps will be removed [v3]
2 participants