Closed tourman closed 6 months ago
@layershifter oh I see now, that you'd prefer _.defaults
instead of just defaults
style, using Lodash.
@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 https://github.com/Semantic-Org/Semantic-UI-React/issues/4426#issuecomment-1695396294. To me getDefaultProps()
and _.defaults()
looks like additional complexity and code debt. WDYT?
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e243fa4
) 99.51% compared to head (77f7953
) 99.50%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR:
.defaultProps
from all componentsgetElementType()
withgetComponentType()
asgetElementType()
relied on presence of.defaultProps
.defaultProps
Fixes #4426.
@layershifter please take a look at the basic changes on https://github.com/Semantic-Org/Semantic-UI-React/issues/4426. If you are fine with them, I'll proceed with the tests. You can review it with the hidden whitespace.
.defaultProps
are replaced withfunction getDefaultProps()
to ensure minimum code changes. As the linter ruleno-use-before-define
forbids using functions before their declarations, I've taken the rule usingeslint --print-config
and modified it to pass the validation._.defaults
as theprops
may be used in children functions/components.