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
Update/react imports #670
Update/react imports #670
Conversation
🦋 Changeset detectedLatest commit: bcb5c04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
|
That's a good one 😄 It seems like some of the e2e tests are failing. We need to investigate that. Were you able to take a look @nicholasio? |
Noticed that, will investigate that, had some issues yesterday with e2e tests not running but I'll figure it out. |
It looks like the update to React 17 and the new JSX transform is not quite working, frontity is still requiring react to be in scope. |
FYI - I'm still looking into this. |
@nicholasio really sorry for this one. Do you know what fails? Or where exactly is the import needed? 🤔 |
Apparently, the new JSX transform is not being used, I know that babel will only use if it's available (even when you set to |
@nicholasio I've look a bit more into it and applying the codemod on this branch #666 will make everything work smoothly. I believe the problem lies in the React 17 and emotion 10 not working smoothly by default. So, would you mind applying the mods on that branch instead? |
@cristianbote Nice! I'll wait for that branch to get merged then 👍 |
…date/react-imports
@cristianbote I just merged your branch here things seem to be working now, I got a couple of e2e tests failing locally but I think they are unrelated. |
@nicholasio I've just merged in the emotion 11 PR and now things should be smoother. Thank you so much for your contribution! ✌️ |
"@frontity/analytics": minor | ||
"@frontity/components": minor | ||
"@frontity/comscore-analytics": minor | ||
"@frontity/connect": minor | ||
"@frontity/core": minor | ||
"frontity": minor | ||
"@frontity/google-ad-manager": minor | ||
"@frontity/google-analytics": minor | ||
"@frontity/google-tag-manager-analytics": minor | ||
"@frontity/head-tags": minor | ||
"@frontity/hooks": minor | ||
"@frontity/html2react": minor | ||
"@frontity/mars-theme": minor | ||
"@frontity/smart-adserver": minor | ||
"@frontity/twentytwenty-theme": minor | ||
"@frontity/types": minor | ||
"@frontity/yoast": minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicholasio was thinking if these updates require a minor update or rather a patch instead? These are not changing public facing API but rather the environment the code is running on. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, I think I didn't go with a patch because this is not exactly a bug fix, but I'm fine to change it to patch
@nicholasio thank you so much for working on this, but can you try and solve the merge conflicts above? 🙏 afterwards I believe this is gonna be ready to be merged in 🎉 . If there's anything I can do to help, please let me know. Thank you! |
Merge conflicts have been fixed! |
Awesome! Waiting for tests and then we'll approve and merge. Thank you! 😃 |
Boom! 🎉 Thank you @nicholasio! |
What:
Updates React imports as per the new JSX transform (React 17). #668 .
Why:
React does not need to be in scope anymore with React 17 and the new JSX transform.
How:
npx react-codemod update-react-imports
and selecting the Typescript option. ESLint errors were ignored. Also had to update the babel config for jest for the unit tests to pass.Tasks:
Unrelated Tasks
Additional Comments
In some places we have imports like this:
This is basically because in some places we are using
React.FC
instead of importingFC
directly. I noticed we're not very consistent on how we import TypeScript types, it seems like the React codemod prefersReact.FC
as it didn't update them and instead converted the react imports to the new recommended versionimport * as React from 'react'