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

Migrate React static components to Flow component syntax #3231

Merged
merged 8 commits into from May 17, 2024

Conversation

reosarevok
Copy link
Member

@reosarevok reosarevok commented Apr 10, 2024

Flow now supports a specific React Component Syntax which reduces the amount of types we need to define manually, and is supposed to be better for type checking as well. I'm converting our React components to this syntax bit by bit with this PR.

This changes all stuff in the static subfolder, except for class components which require a lot more changes and can be done later.

Note: To be reviewed without whitespace changes (since this adds explicit return() calls that require spacing things one more tab in many cases).

On top of #3236

@reosarevok reosarevok added the Refactoring Refactoring-only PRs (eslint fixes etc) label Apr 10, 2024
@reosarevok reosarevok force-pushed the flow-component-syntax-static branch 3 times, most recently from 6b48155 to 41c6844 Compare April 16, 2024 09:10
Instance is optional and defaults to mixed.
See https://flow.org/en/docs/react/types/#toc-react-abstractcomponent

This also causes issues when an input component's type
does not have a void instance.
Modal doesn't actually use its onClick prop at all, so this is dead code.
It seems it's not needed either.
…nent syntax

Except for class components which should be converted
but are less trivial to change.
…nt syntax

Multiselect needs a lot of changes to fix the Flow issues hidden by FlowIgnore,
will look into it in a separate commit.
These are already the default exports
@reosarevok reosarevok force-pushed the flow-component-syntax-static branch from 3d550a1 to 8d66563 Compare May 17, 2024 15:58
@reosarevok reosarevok marked this pull request as ready for review May 17, 2024 15:58
@reosarevok reosarevok changed the title [WIP] Migrate React static components to Flow component syntax Migrate React static components to Flow component syntax May 17, 2024
@reosarevok reosarevok merged commit 16a8d48 into metabrainz:master May 17, 2024
2 checks passed
@reosarevok reosarevok deleted the flow-component-syntax-static branch May 17, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Refactoring-only PRs (eslint fixes etc)
Projects
None yet
2 participants