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: update React examples to match with the new React guidelines #12217

Merged
merged 15 commits into from
Feb 11, 2022

Conversation

charpeni
Copy link
Contributor

@charpeni charpeni commented Jan 5, 2022

Summary

beta.reactjs.org brings new guidelines for code examples. One notable change is that named function expressions are now preferred over arrow functions for top-level functions.

Updating all our React examples to match with the guidelines as well as removing React imports in favor of the new JSX transform. This should reduce some confusion caused by the disparity between Jest docs and React docs.

⚠️ Those changes weren't applied to the versioned_docs as they could be released in the next release.

Test plan

Examples in the docs are showing up nicely on next.

@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2022

Codecov Report

Merging #12217 (f6aa020) into main (11d79ec) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12217      +/-   ##
==========================================
- Coverage   67.51%   67.51%   -0.01%     
==========================================
  Files         328      328              
  Lines       17246    17246              
  Branches     5071     5071              
==========================================
- Hits        11644    11643       -1     
- Misses       5569     5570       +1     
  Partials       33       33              
Impacted Files Coverage Δ
packages/expect/src/utils.ts 96.03% <0.00%> (-0.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11d79ec...f6aa020. Read the comment docs.

@SimenB
Copy link
Member

SimenB commented Jan 5, 2022

Thanks for this @charpeni!

Can we remove the weird .react file name convention you comment on separately (in all versioned docs and examples/tests)? I think that change is 100% correct. Not as sure about making automatic runtime default (although probably a good idea), but easier to evaluate separately 🙂

@SimenB SimenB requested a review from rickhanlonii January 5, 2022 21:47
@charpeni charpeni force-pushed the refactor-to-new-react-style branch from 109be51 to 707f8b1 Compare January 5, 2022 21:58
@charpeni
Copy link
Contributor Author

charpeni commented Jan 5, 2022

Sure thing. I reverted changes to .react.js file convention in 707f8b1 and I'll send this in a separate pull request later.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@SimenB SimenB merged commit e3c84b5 into jestjs:main Feb 11, 2022
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
@charpeni charpeni deleted the refactor-to-new-react-style branch March 14, 2022 14:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants