-
Notifications
You must be signed in to change notification settings - Fork 4.1k
chore: remove usage of deprecated .defaultProps
#4449
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
Conversation
transform.js (WIP) transform.js (WIP) transform.js: get all files (WIP) transform.js: const defaultProps (WIP) transform.js: function + eslint rules (WIP)
|
@layershifter oh I see now, that you'd prefer |
|
@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 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
.defaultProps
This PR:
.defaultPropsfrom all componentsgetElementType()withgetComponentType()asgetElementType()relied on presence of.defaultProps.defaultPropsFixes #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.
.defaultPropsare replaced withfunction getDefaultProps()to ensure minimum code changes. As the linter ruleno-use-before-defineforbids using functions before their declarations, I've taken the rule usingeslint --print-configand modified it to pass the validation._.defaultsas thepropsmay be used in children functions/components.