Skip to content

Commit

Permalink
[WIP] Update Flow to 0.251.1
Browse files Browse the repository at this point in the history
https://github.com/facebook/flow/releases/tag/v0.251.0
https://github.com/facebook/flow/releases/tag/v0.251.1

Most changes are due to the deprecation of React.AbstractComponent.
Replacing it with React.ComponentType where trivial, as suggested by Flow.
Still unsure what to do for non-trivial cases where we pass an instance type.
  • Loading branch information
reosarevok committed Nov 27, 2024
1 parent 7cc03f9 commit 59c6414
Show file tree
Hide file tree
Showing 83 changed files with 105 additions and 108 deletions.
10 changes: 5 additions & 5 deletions flow-typed/npm/@floating-ui/react_v0.26.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ declare module '@floating-ui/react' {
};

declare export const FloatingFocusManager:
React.AbstractComponent<FloatingFocusManagerProps>;
component(...FloatingFocusManagerProps);

/*
* FloatingNode
Expand All @@ -321,7 +321,7 @@ declare module '@floating-ui/react' {
};

declare export const FloatingNode:
React.AbstractComponent<FloatingNodeProps>;
component(...FloatingNodeProps);

/*
* FloatingOverlay
Expand All @@ -334,7 +334,7 @@ declare module '@floating-ui/react' {
};

declare export const FloatingOverlay:
React.AbstractComponent<FloatingOverlayProps>;
component(...FloatingOverlayProps);

/*
* FloatingPortal
Expand All @@ -345,7 +345,7 @@ declare module '@floating-ui/react' {
};

declare export const FloatingPortal:
React.AbstractComponent<FloatingPortalProps>;
component(...FloatingPortalProps);

/*
* FloatingTree
Expand All @@ -355,5 +355,5 @@ declare module '@floating-ui/react' {
};

declare export const FloatingTree:
React.AbstractComponent<FloatingTreeProps>;
component(...FloatingTreeProps);
}
4 changes: 2 additions & 2 deletions flow-typed/npm/react-table_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ declare module 'react-table' {
* `D` contravariant above.
*/
+accessor?: (D) => V,
+Cell?: React.AbstractComponent<CellRenderProps<D, V>, mixed>,
+Cell?: component(...CellRenderProps<D, V>),
+Header?: React.ComponentType<mixed> | React.Node,
+id?: string,
...
};

declare export type ColumnOptionsNoValue<-D> = {
+accessor?: (D) => mixed,
+Cell?: React.AbstractComponent<CellRenderProps<D, empty>, mixed>,
+Cell?: component(...CellRenderProps<D, empty>),
+Header?: React.ComponentType<mixed> | React.Node,
+id?: string,
...
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-simple-import-sort": "^7.0.0",
"flow-bin": "0.250.0",
"flow-bin": "0.251.1",
"gettext-parser": "4.2.0",
"globals": "15.9.0",
"hermes-eslint": "0.23.0",
Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/account/components/ApplicationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ export type ApplicationFormPropsT = Props;
export default (hydrate<Props>(
'div.application-form',
ApplicationForm,
): React.AbstractComponent<Props, void>);
): React.ComponentType<Props>);
2 changes: 1 addition & 1 deletion root/static/scripts/account/components/EditProfileForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,5 @@ export type EditProfileFormPropsT = Props;

export default (
hydrate<Props>('div.edit-profile-form', EditProfileForm):
React.AbstractComponent<Props, void>
React.ComponentType<Props>
);
2 changes: 1 addition & 1 deletion root/static/scripts/account/components/PreferencesForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,4 @@ export type PreferencesFormPropsT = Props;
export default (hydrate<Props>(
'div.preferences-form',
PreferencesForm,
): React.AbstractComponent<Props, void>);
): React.ComponentType<Props>);
2 changes: 1 addition & 1 deletion root/static/scripts/account/components/RegisterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ component RegisterForm(captcha?: string, form: RegisterFormT) {
export default (hydrate<React.PropsOf<RegisterForm>>(
'div.register-form',
RegisterForm,
): React.AbstractComponent<React.PropsOf<RegisterForm>, void>);
): React.ComponentType<React.PropsOf<RegisterForm>>);
2 changes: 1 addition & 1 deletion root/static/scripts/alias/AliasEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,4 @@ const AliasEditForm = ({
export default (hydrate<Props>(
'div.alias-edit-form',
AliasEditForm,
): React.AbstractComponent<Props, void>);
): React.ComponentType<Props>);
2 changes: 1 addition & 1 deletion root/static/scripts/annotation/AnnotationHistoryTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ component AnnotationHistoryTable(
export default (hydrate<React.PropsOf<AnnotationHistoryTable>>(
'div.annotation-history-table',
AnnotationHistoryTable,
): React.AbstractComponent<React.PropsOf<AnnotationHistoryTable>>);
): React.ComponentType<React.PropsOf<AnnotationHistoryTable>>);
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,4 @@ const ArtistCreditRenamer = ({
export default (hydrate<ArtistCreditRenamerPropsT>(
'div.artist-credit-renamer',
ArtistCreditRenamer,
): React.AbstractComponent<ArtistCreditRenamerPropsT, void>);
): React.ComponentType<ArtistCreditRenamerPropsT>);
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const CollaboratorsFormList = (hydrate<CollaboratorsFormListPropsT>(
</div>
);
}),
): React.AbstractComponent<CollaboratorsFormListPropsT, void>);
): React.ComponentType<CollaboratorsFormListPropsT>);

type CollaboratorRowPropsT = {
+collaborator: CollaboratorStateT,
Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/AcoustIdCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ export default (
hydrate<React.PropsOf<AcoustIdCell>>(
'div.acoustids',
AcoustIdCell,
): React.AbstractComponent<React.PropsOf<AcoustIdCell>>
): React.ComponentType<React.PropsOf<AcoustIdCell>>
);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/Annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ export default (hydrate<React.PropsOf<Annotation>>(
newProps.entity = newEntity;
return newProps;
},
): React.AbstractComponent<React.PropsOf<Annotation>>);
): React.ComponentType<React.PropsOf<Annotation>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/ArtistCreditLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ component _MpIcon(artistCredit: ArtistCreditT) {
export const MpIcon = (hydrate<React.PropsOf<_MpIcon>>(
'span.ac-mp',
_MpIcon,
): React.AbstractComponent<React.PropsOf<_MpIcon>>);
): React.ComponentType<React.PropsOf<_MpIcon>>);

component ArtistCreditLink(
artistCredit: ArtistCreditT,
Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/ArtistRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ component ArtistRoles(relations: $ReadOnlyArray<RelationT>) {
export default (hydrate<React.PropsOf<ArtistRoles>>(
'div.artist-roles-container',
ArtistRoles,
): React.AbstractComponent<React.PropsOf<ArtistRoles>>);
): React.ComponentType<React.PropsOf<ArtistRoles>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/AttributeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ component AttributeList(
export default (hydrate<React.PropsOf<AttributeList>>(
'div.entity-attributes-container',
AttributeList,
): React.AbstractComponent<React.PropsOf<AttributeList>>);
): React.ComponentType<React.PropsOf<AttributeList>>);
4 changes: 2 additions & 2 deletions root/static/scripts/common/components/Autocomplete2.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,13 +864,13 @@ component _Autocomplete2<T: EntityItemT>(...props: PropsT<T>) {
}

// $FlowIgnore[unclear-type]
const Autocomplete2: React.AbstractComponent<PropsT<any>, mixed> =
const Autocomplete2: React.ComponentType<PropsT<any>> =
React.memo(_Autocomplete2);

export default Autocomplete2;

// XXX Until Flow supports https://github.com/facebook/flow/issues/7672
export const ArtistAutocomplete:
React.AbstractComponent<PropsT<ArtistT>, void> =
React.ComponentType<PropsT<ArtistT>> =
// $FlowIgnore[unclear-type]
(Autocomplete2: any);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/CommonsImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export default (hydrate<Props>(
'div.commons-image',
CommonsImage,
minimalEntity,
): React.AbstractComponent<Props, void>);
): React.ComponentType<Props>);
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ component CritiqueBrainzReview(review: CritiqueBrainzReviewT, title: string) {
export default (hydrate<React.PropsOf<CritiqueBrainzReview>>(
'div.critiquebrainz-review',
CritiqueBrainzReview,
): React.AbstractComponent<React.PropsOf<CritiqueBrainzReview>>);
): React.ComponentType<React.PropsOf<CritiqueBrainzReview>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ component Filter(ajaxFormUrl: string, initialFilterForm: ?FilterFormT) {

export default (
hydrate<React.PropsOf<Filter>>('div.filter', Filter):
React.AbstractComponent<React.PropsOf<Filter>>
React.ComponentType<React.PropsOf<Filter>>
);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/FingerprintTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ component FingerprintTable(recording: RecordingT) {
export default (hydrate<React.PropsOf<FingerprintTable>>(
'div.acoustid-fingerprints',
FingerprintTable,
): React.AbstractComponent<React.PropsOf<FingerprintTable>>);
): React.ComponentType<React.PropsOf<FingerprintTable>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/IsrcList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ component IsrcList(
export default (hydrate<React.PropsOf<IsrcList>>(
'div.isrc-list-container',
IsrcList,
): React.AbstractComponent<React.PropsOf<IsrcList>>);
): React.ComponentType<React.PropsOf<IsrcList>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/IswcList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ component IswcList(
export default (hydrate<React.PropsOf<IswcList>>(
'div.iswc-list-container',
IswcList,
): React.AbstractComponent<React.PropsOf<IswcList>>);
): React.ComponentType<React.PropsOf<IswcList>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/PostParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ component PostParameters(params: PostParametersT) {
export default (hydrate(
'div.post-parameters',
PostParameters,
): React.AbstractComponent<React.PropsOf<PostParameters>>);
): React.ComponentType<React.PropsOf<PostParameters>>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/Relationships.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ component _Relationship(
);
}

const Relationships: React.AbstractComponent<React.PropsOf<_Relationship>> =
const Relationships: React.ComponentType<React.PropsOf<_Relationship>> =
React.memo(_Relationship);

export default Relationships;
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/ReleaseEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ component ReleaseEvents(
export default (hydrate<React.PropsOf<ReleaseEvents>>(
'div.release-events-container',
ReleaseEvents,
): React.AbstractComponent<React.PropsOf<ReleaseEvents>>);
): React.ComponentType<React.PropsOf<ReleaseEvents>>);
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ component _StaticRelationshipsDisplay(
return tables;
}

const StaticRelationshipsDisplay: React.AbstractComponent<
const StaticRelationshipsDisplay: React.ComponentType<
React.PropsOf<_StaticRelationshipsDisplay>
> = React.memo(_StaticRelationshipsDisplay);

Expand Down
4 changes: 2 additions & 2 deletions root/static/scripts/common/components/TagEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ export const MainTagEditor = (hydrate<TagEditorProps>(
}
},
minimalEntity,
): React.AbstractComponent<TagEditorProps, void>);
): React.ComponentType<TagEditorProps>);

export const SidebarTagEditor = (hydrate<TagEditorProps>(
'div.sidebar-tags',
Expand Down Expand Up @@ -703,7 +703,7 @@ export const SidebarTagEditor = (hydrate<TagEditorProps>(
}
},
minimalEntity,
): React.AbstractComponent<TagEditorProps, void>);
): React.ComponentType<TagEditorProps>);

function createInitialTagState(
aggregatedTags: $ReadOnlyArray<AggregatedTagT>,
Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/TaggerIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ export default (
hydrate<React.PropsOf<TaggerIcon>>(
'span.tagger-icon',
TaggerIcon,
): React.AbstractComponent<React.PropsOf<TaggerIcon>, void>
): React.ComponentType<React.PropsOf<TaggerIcon>>
);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/WikipediaExtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ export default (hydrate<Props>(
'div.wikipedia-extract',
WikipediaExtract,
minimalEntity,
): React.AbstractComponent<Props, void>);
): React.ComponentType<Props>);
2 changes: 1 addition & 1 deletion root/static/scripts/common/components/WorkArtists.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ component WorkArtists(artists: ?$ReadOnlyArray<ArtistCreditT>) {
export default (hydrate<React.PropsOf<WorkArtists>>(
'div.work-artists-container',
WorkArtists,
): React.AbstractComponent<React.PropsOf<WorkArtists>, void>);
): React.ComponentType<React.PropsOf<WorkArtists>>);
2 changes: 1 addition & 1 deletion root/static/scripts/edit/components/ArtistCreditBubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ component _ArtistCreditBubble(
);
}

const ArtistCreditBubble: React.AbstractComponent<
const ArtistCreditBubble: React.ComponentType<
React.PropsOf<_ArtistCreditBubble>
> = React.memo(_ArtistCreditBubble);

Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/edit/components/ArtistCreditEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ component _ArtistCreditEditor(
);
}

const ArtistCreditEditor: React.AbstractComponent<
const ArtistCreditEditor: React.ComponentType<
React.PropsOf<_ArtistCreditEditor>
> = React.memo(_ArtistCreditEditor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ component _ArtistCreditNameEditor(
);
}

const ArtistCreditNameEditor: React.AbstractComponent<
const ArtistCreditNameEditor: React.ComponentType<
React.PropsOf<_ArtistCreditNameEditor>
> = React.memo(_ArtistCreditNameEditor);

Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/edit/components/DateRangeFieldset.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ component _DateRangeFieldset(
);
}

const DateRangeFieldset: React.AbstractComponent<
const DateRangeFieldset: React.ComponentType<
React.PropsOf<_DateRangeFieldset>
> = React.memo(_DateRangeFieldset);

Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/edit/components/FormRowTextList.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ export component NonHydratedFormRowTextList(
export default (hydrate<React.PropsOf<FormRowTextList>>(
'div.row.form-row-text-list-container',
FormRowTextList,
): React.AbstractComponent<React.PropsOf<FormRowTextList>, void>);
): React.ComponentType<React.PropsOf<FormRowTextList>>);
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ component _GuessCaseOptionsPopover(
);
}

const GuessCaseOptionsPopover: React.AbstractComponent<
const GuessCaseOptionsPopover: React.ComponentType<
React.PropsOf<_GuessCaseOptionsPopover>
> = React.memo(_GuessCaseOptionsPopover);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export default (
hydrate<React.PropsOf<NewNotesAlertCheckbox>>(
'span.new-notes-alert-checkbox',
NewNotesAlertCheckbox,
): React.AbstractComponent<React.PropsOf<NewNotesAlertCheckbox>, void>
): React.ComponentType<React.PropsOf<NewNotesAlertCheckbox>>
);
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@ component ReleaseMergeStrategy(
export default (hydrate<React.PropsOf<ReleaseMergeStrategy>>(
'div.release-merge-strategy',
ReleaseMergeStrategy,
): React.AbstractComponent<React.PropsOf<ReleaseMergeStrategy>, void>);
): React.ComponentType<React.PropsOf<ReleaseMergeStrategy>>);
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ component _RelationshipDiff(
);
}

const RelationshipDiff: React.AbstractComponent<
const RelationshipDiff: React.ComponentType<
React.PropsOf<_RelationshipDiff>
> = React.memo(_RelationshipDiff);

Expand Down
2 changes: 1 addition & 1 deletion root/static/scripts/event/components/EventEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,4 @@ component EventEditForm(
export default (hydrate<React.PropsOf<EventEditForm>>(
'div.event-edit-form',
EventEditForm,
): React.AbstractComponent<React.PropsOf<EventEditForm>>);
): React.ComponentType<React.PropsOf<EventEditForm>>);
2 changes: 1 addition & 1 deletion root/static/scripts/genre/components/GenreEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ component GenreEditForm(form as initialForm: GenreFormT) {
export default (hydrate<React.PropsOf<GenreEditForm>>(
'div.genre-edit-form',
GenreEditForm,
): React.AbstractComponent<React.PropsOf<GenreEditForm>, void>);
): React.ComponentType<React.PropsOf<GenreEditForm>>);
2 changes: 1 addition & 1 deletion root/static/scripts/main/components/ConfirmSeedButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ component ConfirmSeedButtons(autoSubmit: boolean) {
export default (hydrate(
'span.buttons.confirm-seed',
ConfirmSeedButtons,
): React.AbstractComponent<React.PropsOf<ConfirmSeedButtons>, void>);
): React.ComponentType<React.PropsOf<ConfirmSeedButtons>>);
2 changes: 1 addition & 1 deletion root/static/scripts/recording/RecordingName.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ export component RecordingName(
export default (hydrate<React.PropsOf<RecordingName>>(
'div.recording-name',
RecordingName,
): React.AbstractComponent<React.PropsOf<RecordingName>, void>);
): React.ComponentType<React.PropsOf<RecordingName>>);
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ component _BooleanAttribute(
);
}

const BooleanAttribute: React.AbstractComponent<
const BooleanAttribute: React.ComponentType<
React.PropsOf<_BooleanAttribute>
> = React.memo(_BooleanAttribute);

Expand Down
Loading

0 comments on commit 59c6414

Please sign in to comment.