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

npx react-codemod pure-component src/ #825

Merged
merged 2 commits into from May 14, 2020
Merged

npx react-codemod pure-component src/ #825

merged 2 commits into from May 14, 2020

Conversation

mshwery
Copy link
Contributor

@mshwery mshwery commented May 13, 2020

Overview

This PR codemods a bunch of PureComponents -> React.FC + memo + forwardRef where it could be done automatically. I had to manually switch from withTheme to useTheme.

Testing

  • Updated Typescript types and/or component PropTypes
  • Added / modified component docs
  • Added / modified Storybook stories

Screenshots (if applicable)

Screen Shot 2020-05-13 at 1 53 32 PM
Screen Shot 2020-05-13 at 1 57 15 PM
Screen Shot 2020-05-13 at 1 57 08 PM
Screen Shot 2020-05-13 at 1 57 01 PM
Screen Shot 2020-05-13 at 1 56 54 PM
Screen Shot 2020-05-13 at 1 56 49 PM
Screen Shot 2020-05-13 at 1 56 42 PM
Screen Shot 2020-05-13 at 1 56 20 PM
Screen Shot 2020-05-13 at 1 56 06 PM
Screen Shot 2020-05-13 at 1 55 52 PM
Screen Shot 2020-05-13 at 1 55 40 PM
Screen Shot 2020-05-13 at 1 55 25 PM
Screen Shot 2020-05-13 at 1 55 13 PM
Screen Shot 2020-05-13 at 1 54 47 PM
Screen Shot 2020-05-13 at 1 54 30 PM
Screen Shot 2020-05-13 at 1 54 28 PM
Screen Shot 2020-05-13 at 1 54 26 PM
Screen Shot 2020-05-13 at 1 54 21 PM
Screen Shot 2020-05-13 at 1 53 37 PM

@mshwery mshwery merged commit ed7ab9c into v5 May 14, 2020
@mshwery mshwery deleted the v5-fc-codemod branch May 14, 2020 15:53
colinlohner added a commit that referenced this pull request Aug 3, 2020
* Downshift v5 (#792)

* v5.0.0-alpha-0

* Migrates Spinner component to hooks (#724)

* Converts Pane component to hooks (#727)

* vv5.0.0-alpha-1

* rm side effects in v5 (#799)

* move codemod deps to own package.json (#817)

* fully tree-shakeable icons (#818)

* removed unused setId (#816)

Co-authored-by: Shirley Doan <shirleydoan@Shirleys-MacBook-Air.local>

* reintroduce namespaced autogenerated id for TextInputFields

* fix prerelease versioning

* include generated icons

* remove v3->v4 color mapping (#821)

* switch component-template script to function components (#822)

* switch component-template script to function components

* update pr template

* convert Alert and InlineAlert to React.FC (#823)

* fix exported types for React.FC components

* convert badge and pill to react.fc (#824)

* update docgen and theme styles (#826)

* npx react-codemod pure-component src/ (#825)

* convert autocomplete to react.fc (#828)

* Convert <Radio />, <Checkbox />, and <Card /> to FC + Hooks (#829)

* Convert <Radio />, <Checkbox />, and <Card /> to FC + Hooks

* export card

* updates

* rm optional chaining syntax

* Convert <Dialog /> and <CornerDialog /> to FC + memo + forwardRef (#830)

* Convert <Dialog /> and <CornerDialog /> to FC + memo + forwardRef

* updates

* rm ref support

* Convert <Image /> to React.FC + forwardRef + memo (#831)

* Convert image to hooks + forwardRef + memo

* update types

* export

* Convert <FilePicker /> and <FormField* /> to fc + forwardref + memo (#832)

* wip

* Convert <FilePicker /> and <FormField /> to fc + forwardref + memo

* a few more

* update types

* Convert <Switch />, <SelectMenu /> to hooks + memo + forwardRef (#836)

* Convert <Switch />, <SelectMenu /> to hooks + memo + forwardRef

* updates

* bump selectmenu content to memo

* updates

* Align Checkbox and Switch props a little more closely (#838)

* Align Checkbox and Switch props a little more closely

* fixup

* Bump storybook and storybook-related packages to latest (#844)

* Bump storybook@latest, and update existing defaults

* dedup yarn.lock

* rm setClassNamePrefix (#841)

* Convert <Menu /> and its subcomponents to fc + hooks (#839)

* Convert <Menu /> and its sub-components to hooks

* update types

* update types

* update types

* Convert <Combobox />, <RadioGroup />, <(Un)orderedList /> to fc + memo + forwardRef (#837)

* Combobox, Radiogroup, (Un)orderedList to fc + memo + hooks

* update combobox typedef

* fixup

* convert Popover components to hooks + fc (#846)

* convert Overlay components to hooks + fc (#847)

* Convert Segmented Control to Hooks/FC (#863)

* Segmented Control to FC/Hooks

* Fix default value, accept booleans as default value

* Add ref support to Segmented Control

Update groupName to use state, as to not create new ids on repaint

* Convert Positioner component to Hooks/FC (#864)

* Convert Positioner component to Hooks/FC

* Update index.d.ts

Co-authored-by: Matt Shwery <matthew.shwery@segment.com>

* Remove innerRef from Positioner

Co-authored-by: Matt Shwery <matthew.shwery@segment.com>

* Updated Icons (#867)

* Convert portal to fc (#849)

* Converts avatar component to hooks (#723)

* update avatar type to forwardrefcomponent

* convert stack to react.fc (#868)

* fix overlay

* upgrade react-transition-group (#873)

* move defaultProps into default values (#874)

* convert tab components to FC (#872)

* add todos and update types (#871)

* add todos and update types

* update snap

* undo react import sorting

* Update all Cell components (#876)

* Update Table Head to use hooks and be a fc (#879)

* Update TableBody to use hooks/be a fc (#880)

* Update ScrollbarSize to be FC and use Hooks (#881)

* Bump ui-box@4.0.0 & dogfood ref support throughout Evergreen (#843)

* [WIP] Dogfood ui-box `ref` support everywhere in Evergreen

* clean up some more instances

* update tablebody ref support

* Update Table Row to FC/Hooks (#878)

* Update Table Row to FC/Hooks

* Fix type

* V5 virtual body fc (#877)

* Virtual body to hooks/fc

* update variable name to reduce confusion

* Remove ts-ignore

* Update useForceUpdate to be a little more robust

* Fix linting errors

- Capitalize comment
- Add ignore for no-unused-vars

* Update Table to be FC/use hooks (#882)

* Update Table to be FC/use hooks

* Update types :)

* V5 bubble ref (#884)

* cleanup remnants of innerRef and fix bubbling (#885)

* update np to latest

* fix current version to match npm

* bump to latest release

* Update TagInput to be FC and use hooks (#888)

* Update TagInput to be FC and use hooks

* minor tweak

* rm console.log

* V5 toaster fc (#886)

* Update ToastManager to use hooks and be a FC

* Update Toast to use hooks and be a FC

* Minor tweak

* Quick clean up

- rm isRequired from prop
- move clearCloseTimeout def higher in file

* Update Tooltip Component to use hooks and to be a FC (#887)

* Update Tooltip Component to use hooks and to be a FC

* minor tweak

* minor tweaks

- rm setCloseTimeout in component unmount
- simplify some logic
- rm anonymous fn in ref
- rm .isRequired from props that now have values set

* Revert logic change

* upgrade to node 10.18 min, add esm size-limit for tree-shaking

* build some custom hooks (#889)

* build some custom hooks

* join `-` in case of missing prefix

* wip

* fix debounce binds (#890)

* move storybook stuff to devdeps (#891)

* V5 box types (#896)

* bump version to match npm

* bump version to match npm

* update types

* remove circular deps

* release 5.0.0-6

* update ui-box and some types

* Update popover to forward ref (#897)

* Update popover to forward ref

* update ref to be what was previously exposed

* Add forwardRef to serach table header cell (#898)

* Add forwardRef to serach table header cell

* tiny update

* version mismatch fix

* rm misc .isRequired prop types no longer needed (#899)

* version number mismatch

* v5.0.0-9

* readd default value for icons

* update table type

* more type fixes

* release 5.0.0-10

* add useMergedRef hook (#902)

* Fix body click handler for popover (#903)

* V5 docs (#904)

* WIP

- Created What’s New page
- Created v5 migration page
- Updated DocsMDXProvider to generate ids for headings

* rm roadmap link

* fix linting

* Downshift docs

* update v5 migration docs (#905)

* update v5 migration docs

* update language

* Start toggle docs

* revert back to class component Portal to fix autofocus

* fix popover animate-in

* fix autocomplete ref complaint (#910)

* fix focus ref

* fix overlay and ref usage

* fix radiogroup id

* update RadioGroup docs

* bump version to match npm

* bump version to match npm

* fix release process on non-mainline branches

* but make it deploy docs on `master`

* V5 master merge (#912)

* update language (#870)

* Fix typo in PositionerProps and PopoverProps (#869)

* fix linting error

* v4.28.1

* Docs(positioner): update type comments (getPosition) (#883)

* update contributors (#909)

* use icon element types instead of strings internally (#908)

* v4.29.0

Co-authored-by: Kelly <kelly.trinh@segment.com>
Co-authored-by: Lee Siong Chan <leesiongchan@users.noreply.github.com>
Co-authored-by: colinlohner <colin@colinlohner.com>
Co-authored-by: Dave <wangcch.cc@gmail.com>

* update migration docs

* include displayNames for devmode (#913)

* include displayNames for devmode

* wip

* expose *OwnProps and polymorphic *Props separately (#914)

* update types and docs

* update docs and types

* v5.0.0-13

* export more utility types

* support forwardRef on TagInput container

* v5.0.0-14

* upgrade ui-box to stable

* update v5 docs location

* loosen proptype requirements for IconWrapper

* render optimizations (#916)

* v5.0.0-15

* render optimizations

* moaaaar

* wip

Co-authored-by: Chris <chrischuck35@gmail.com>
Co-authored-by: sdoan16 <36022099+sdoan16@users.noreply.github.com>
Co-authored-by: Shirley Doan <shirleydoan@Shirleys-MacBook-Air.local>
Co-authored-by: Allen Kleiner <akleiner24@gmail.com>
Co-authored-by: Colin Lohner <colin@colinlohner.com>
Co-authored-by: Kelly <kelly.trinh@segment.com>
Co-authored-by: Lee Siong Chan <leesiongchan@users.noreply.github.com>
Co-authored-by: Dave <wangcch.cc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants