From f1e8e7f1406ab07914f558b581a3dc86ef62bc5b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 16 Dec 2022 12:29:59 +0000 Subject: [PATCH] Enable `@typescript-eslint/explicit-member-accessibility` on /src (#9785) * Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier --- .eslintrc.js | 9 ++- src/@types/polyfill.ts | 2 +- src/@types/worker-loader.d.ts | 2 +- src/AddThreepid.ts | 2 +- src/AsyncWrapper.tsx | 6 +- src/BasePlatform.ts | 2 +- src/BlurhashEncoder.ts | 2 +- src/ContentMessages.ts | 2 +- src/DecryptionFailureTracker.ts | 8 +-- src/HtmlUtils.tsx | 2 +- src/IdentityAuthClient.tsx | 2 +- src/KeyBindingsManager.ts | 18 +++--- src/Login.ts | 2 +- src/Markdown.ts | 8 +-- src/NodeAnimator.tsx | 2 +- src/PasswordReset.ts | 2 +- src/PosthogAnalytics.ts | 2 +- src/PosthogTrackers.ts | 8 +-- src/ScalarAuthClient.ts | 16 ++--- src/SecurityManager.ts | 2 +- src/SendHistoryManager.ts | 16 ++--- src/SlashCommands.tsx | 2 +- src/Terms.ts | 2 +- src/UserActivity.ts | 4 +- .../eventindex/DisableEventIndexDialog.tsx | 2 +- .../eventindex/ManageEventIndexDialog.tsx | 10 +-- .../security/CreateKeyBackupDialog.tsx | 2 +- .../security/CreateSecretStorageDialog.tsx | 2 +- .../dialogs/security/ExportE2eKeysDialog.tsx | 2 +- .../dialogs/security/ImportE2eKeysDialog.tsx | 2 +- src/audio/Playback.ts | 2 +- src/audio/PlaybackQueue.ts | 2 +- src/audio/RecorderWorklet.ts | 2 +- src/audio/VoiceMessageRecording.ts | 2 +- src/autocomplete/AutocompleteProvider.tsx | 16 ++--- src/autocomplete/Autocompleter.ts | 10 +-- src/autocomplete/CommandProvider.tsx | 10 +-- src/autocomplete/EmojiProvider.tsx | 12 ++-- src/autocomplete/NotifProvider.tsx | 13 ++-- src/autocomplete/QueryMatcher.ts | 6 +- src/autocomplete/RoomProvider.tsx | 13 ++-- src/autocomplete/SpaceProvider.tsx | 4 +- src/autocomplete/UserProvider.tsx | 20 +++--- .../structures/AutoHideScrollbar.tsx | 2 +- src/components/structures/ContextMenu.tsx | 6 +- src/components/structures/EmbeddedPage.tsx | 2 +- src/components/structures/FilePanel.tsx | 4 +- .../structures/GenericErrorPage.tsx | 2 +- .../structures/IndicatorScrollbar.tsx | 2 +- src/components/structures/InteractiveAuth.tsx | 6 +- src/components/structures/LeftPanel.tsx | 2 +- .../structures/LegacyCallEventGrouper.ts | 2 +- src/components/structures/LoggedInView.tsx | 10 +-- src/components/structures/MatrixChat.tsx | 12 ++-- src/components/structures/MessagePanel.tsx | 24 +++---- .../structures/NotificationPanel.tsx | 6 +- src/components/structures/RightPanel.tsx | 4 +- src/components/structures/RoomSearch.tsx | 2 +- src/components/structures/RoomStatusBar.tsx | 2 +- src/components/structures/RoomView.tsx | 18 +++--- src/components/structures/ScrollPanel.tsx | 2 +- src/components/structures/SearchBox.tsx | 2 +- src/components/structures/SpaceRoomView.tsx | 10 +-- src/components/structures/TabbedView.tsx | 6 +- src/components/structures/ThreadView.tsx | 4 +- src/components/structures/TimelinePanel.tsx | 12 ++-- src/components/structures/ToastContainer.tsx | 6 +- src/components/structures/UploadBar.tsx | 8 +-- src/components/structures/UserMenu.tsx | 2 +- src/components/structures/UserView.tsx | 2 +- src/components/structures/ViewSource.tsx | 2 +- .../structures/auth/CompleteSecurity.tsx | 2 +- src/components/structures/auth/E2eSetup.tsx | 2 +- .../structures/auth/ForgotPassword.tsx | 12 ++-- src/components/structures/auth/Login.tsx | 24 +++---- .../structures/auth/Registration.tsx | 8 +-- .../structures/auth/SetupEncryptionBody.tsx | 2 +- .../views/audio_messages/AudioPlayerBase.tsx | 2 +- .../audio_messages/LiveRecordingClock.tsx | 4 +- .../audio_messages/LiveRecordingWaveform.tsx | 4 +- .../views/audio_messages/SeekBar.tsx | 2 +- src/components/views/auth/CaptchaForm.tsx | 10 +-- src/components/views/auth/CountryDropdown.tsx | 2 +- src/components/views/auth/EmailField.tsx | 6 +- .../auth/InteractiveAuthEntryComponents.tsx | 62 +++++++++---------- .../views/auth/PassphraseConfirmField.tsx | 4 +- src/components/views/auth/PassphraseField.tsx | 6 +- src/components/views/auth/PasswordLogin.tsx | 6 +- .../views/auth/RegistrationForm.tsx | 12 ++-- .../views/avatars/DecoratedRoomAvatar.tsx | 2 +- src/components/views/avatars/RoomAvatar.tsx | 2 +- .../context_menus/DialpadContextMenu.tsx | 12 ++-- .../GenericElementContextMenu.tsx | 2 +- .../context_menus/LegacyCallContextMenu.tsx | 10 +-- .../context_menus/MessageContextMenu.tsx | 4 +- src/components/views/dialogs/BaseDialog.tsx | 2 +- .../views/dialogs/BugReportDialog.tsx | 2 +- .../views/dialogs/ChangelogDialog.tsx | 2 +- .../dialogs/ConfirmAndWaitRedactDialog.tsx | 2 +- .../views/dialogs/ConfirmRedactDialog.tsx | 2 +- .../views/dialogs/ConfirmUserActionDialog.tsx | 4 +- .../views/dialogs/ConfirmWipeDeviceDialog.tsx | 2 +- .../views/dialogs/CreateRoomDialog.tsx | 6 +- .../views/dialogs/DeactivateAccountDialog.tsx | 2 +- .../views/dialogs/EndPollDialog.tsx | 2 +- .../views/dialogs/HostSignupDialog.tsx | 2 +- .../views/dialogs/IncomingSasDialog.tsx | 2 +- src/components/views/dialogs/InfoDialog.tsx | 4 +- .../views/dialogs/InteractiveAuthDialog.tsx | 2 +- src/components/views/dialogs/InviteDialog.tsx | 14 ++--- src/components/views/dialogs/LogoutDialog.tsx | 6 +- .../dialogs/MessageEditHistoryDialog.tsx | 2 +- .../views/dialogs/ModalWidgetDialog.tsx | 4 +- .../views/dialogs/ReportEventDialog.tsx | 2 +- .../views/dialogs/RoomSettingsDialog.tsx | 4 +- .../views/dialogs/RoomUpgradeDialog.tsx | 6 +- .../dialogs/RoomUpgradeWarningDialog.tsx | 4 +- .../views/dialogs/ServerPickerDialog.tsx | 2 +- .../views/dialogs/SeshatResetDialog.tsx | 2 +- .../views/dialogs/SetEmailDialog.tsx | 2 +- src/components/views/dialogs/ShareDialog.tsx | 6 +- src/components/views/dialogs/TermsDialog.tsx | 4 +- .../views/dialogs/TextInputDialog.tsx | 2 +- .../views/dialogs/UploadConfirmDialog.tsx | 8 +-- .../views/dialogs/UserSettingsDialog.tsx | 4 +- .../dialogs/VerificationRequestDialog.tsx | 4 +- .../WidgetCapabilitiesPromptDialog.tsx | 2 +- .../dialogs/WidgetOpenIDPermissionsDialog.tsx | 2 +- .../security/AccessSecretStorageDialog.tsx | 4 +- .../ConfirmDestroyCrossSigningDialog.tsx | 2 +- .../security/CreateCrossSigningDialog.tsx | 4 +- .../security/RestoreKeyBackupDialog.tsx | 4 +- .../security/SetupEncryptionDialog.tsx | 2 +- .../elements/AccessibleTooltipButton.tsx | 6 +- .../views/elements/AppPermission.tsx | 6 +- src/components/views/elements/AppTile.tsx | 4 +- .../elements/DesktopCapturerSourcePicker.tsx | 14 ++--- .../views/elements/DialPadBackspaceButton.tsx | 2 +- src/components/views/elements/Draggable.tsx | 4 +- src/components/views/elements/Dropdown.tsx | 10 +-- .../views/elements/EditableItemList.tsx | 4 +- .../views/elements/EditableText.tsx | 2 +- .../views/elements/EditableTextContainer.tsx | 2 +- .../views/elements/ErrorBoundary.tsx | 8 +-- .../views/elements/EventListSummary.tsx | 10 +-- .../views/elements/EventTilePreview.tsx | 2 +- src/components/views/elements/Field.tsx | 2 +- .../elements/IRCTimelineProfileResizer.tsx | 6 +- src/components/views/elements/ImageView.tsx | 8 +-- src/components/views/elements/InfoTooltip.tsx | 4 +- .../views/elements/InlineSpinner.tsx | 4 +- .../views/elements/InteractiveTooltip.tsx | 8 +-- .../views/elements/InviteReason.tsx | 6 +- .../views/elements/LanguageDropdown.tsx | 2 +- .../views/elements/LazyRenderList.tsx | 4 +- .../views/elements/LinkWithTooltip.tsx | 2 +- src/components/views/elements/Measured.tsx | 12 ++-- .../views/elements/PersistedElement.tsx | 4 +- .../views/elements/PersistentApp.tsx | 4 +- src/components/views/elements/Pill.tsx | 2 +- .../views/elements/PollCreateDialog.tsx | 2 +- .../views/elements/PowerSelector.tsx | 2 +- src/components/views/elements/ReplyChain.tsx | 12 ++-- .../views/elements/RoomAliasField.tsx | 6 +- .../views/elements/SettingsFlag.tsx | 2 +- src/components/views/elements/Slider.tsx | 6 +- .../elements/SpellCheckLanguagesDropdown.tsx | 6 +- src/components/views/elements/Spoiler.tsx | 2 +- .../views/elements/StyledCheckbox.tsx | 2 +- .../views/elements/TextWithTooltip.tsx | 2 +- src/components/views/elements/Tooltip.tsx | 2 +- .../views/elements/TooltipButton.tsx | 4 +- .../views/elements/TruncatedList.tsx | 2 +- src/components/views/emojipicker/Category.tsx | 2 +- src/components/views/emojipicker/Emoji.tsx | 2 +- .../views/emojipicker/EmojiPicker.tsx | 4 +- src/components/views/emojipicker/Header.tsx | 2 +- src/components/views/emojipicker/Preview.tsx | 2 +- .../views/emojipicker/QuickReactions.tsx | 4 +- .../views/emojipicker/ReactionPicker.tsx | 10 +-- src/components/views/emojipicker/Search.tsx | 4 +- .../views/location/LocationPicker.tsx | 8 +-- .../views/location/LocationViewDialog.tsx | 4 +- .../views/messages/DateSeparator.tsx | 6 +- .../views/messages/DecryptionFailureBody.tsx | 4 +- .../views/messages/DisambiguatedProfile.tsx | 2 +- .../views/messages/EditHistoryMessage.tsx | 2 +- .../views/messages/LegacyCallEvent.tsx | 6 +- src/components/views/messages/MAudioBody.tsx | 4 +- src/components/views/messages/MFileBody.tsx | 4 +- src/components/views/messages/MImageBody.tsx | 12 ++-- .../views/messages/MImageReplyBody.tsx | 2 +- .../views/messages/MJitsiWidgetEvent.tsx | 4 +- .../messages/MKeyVerificationConclusion.tsx | 2 +- .../views/messages/MLocationBody.tsx | 6 +- src/components/views/messages/MPollBody.tsx | 8 +-- src/components/views/messages/MVideoBody.tsx | 6 +- .../views/messages/ReactionsRow.tsx | 12 ++-- .../views/messages/ReactionsRowButton.tsx | 12 ++-- .../messages/ReactionsRowButtonTooltip.tsx | 4 +- src/components/views/messages/TextualBody.tsx | 14 ++--- .../views/messages/TextualEvent.tsx | 2 +- .../views/messages/TileErrorBoundary.tsx | 6 +- .../views/messages/ViewSourceEvent.tsx | 2 +- .../views/right_panel/HeaderButtons.tsx | 2 +- .../views/right_panel/RoomHeaderButtons.tsx | 2 +- .../views/right_panel/TimelineCard.tsx | 4 +- .../views/right_panel/VerificationPanel.tsx | 2 +- .../views/room_settings/AliasSettings.tsx | 10 +-- .../room_settings/RoomProfileSettings.tsx | 2 +- .../room_settings/RoomPublishSetting.tsx | 6 +- src/components/views/rooms/AppsDrawer.tsx | 2 +- src/components/views/rooms/Autocomplete.tsx | 16 ++--- src/components/views/rooms/AuxPanel.tsx | 12 ++-- .../views/rooms/BasicMessageComposer.tsx | 8 +-- .../views/rooms/EditMessageComposer.tsx | 10 +-- src/components/views/rooms/EntityTile.tsx | 6 +- src/components/views/rooms/EventTile.tsx | 16 ++--- src/components/views/rooms/ExtraTile.tsx | 2 +- .../views/rooms/LinkPreviewWidget.tsx | 6 +- src/components/views/rooms/MemberList.tsx | 8 +-- src/components/views/rooms/MemberTile.tsx | 12 ++-- .../views/rooms/MessageComposerFormatBar.tsx | 6 +- .../views/rooms/NotificationBadge.tsx | 2 +- .../views/rooms/PinnedEventTile.tsx | 4 +- src/components/views/rooms/PresenceLabel.tsx | 4 +- .../views/rooms/ReadReceiptMarker.tsx | 2 +- src/components/views/rooms/ReplyTile.tsx | 8 +-- .../views/rooms/RoomBreadcrumbs.tsx | 2 +- src/components/views/rooms/RoomHeader.tsx | 8 +-- src/components/views/rooms/RoomList.tsx | 4 +- src/components/views/rooms/RoomPreviewBar.tsx | 10 +-- src/components/views/rooms/RoomSublist.tsx | 2 +- src/components/views/rooms/RoomTile.tsx | 2 +- .../views/rooms/RoomUpgradeWarningBar.tsx | 4 +- src/components/views/rooms/SearchBar.tsx | 2 +- .../views/rooms/SearchResultTile.tsx | 4 +- .../views/rooms/SendMessageComposer.tsx | 10 +-- src/components/views/rooms/Stickerpicker.tsx | 6 +- .../views/rooms/ThirdPartyMemberInfo.tsx | 14 ++--- .../views/rooms/VoiceRecordComposerTile.tsx | 2 +- .../views/rooms/WhoIsTypingTile.tsx | 12 ++-- src/components/views/settings/BridgeTile.tsx | 2 +- .../views/settings/ChangePassword.tsx | 2 +- .../views/settings/CrossSigningPanel.tsx | 2 +- .../views/settings/CryptographyPanel.tsx | 2 +- .../views/settings/DevicesPanel.tsx | 2 +- .../views/settings/DevicesPanelEntry.tsx | 2 +- .../views/settings/EventIndexPanel.tsx | 12 ++-- .../views/settings/FontScalingPanel.tsx | 6 +- .../views/settings/ImageSizePanel.tsx | 2 +- .../views/settings/LayoutSwitcher.tsx | 2 +- .../views/settings/ProfileSettings.tsx | 2 +- .../views/settings/SecureBackupPanel.tsx | 2 +- src/components/views/settings/SetIdServer.tsx | 8 +-- .../views/settings/SetIntegrationManager.tsx | 2 +- .../views/settings/SpellCheckSettings.tsx | 6 +- .../views/settings/ThemeChoicePanel.tsx | 4 +- .../views/settings/account/EmailAddresses.tsx | 4 +- .../views/settings/account/PhoneNumbers.tsx | 4 +- .../settings/discovery/EmailAddresses.tsx | 2 +- .../views/settings/discovery/PhoneNumbers.tsx | 2 +- .../tabs/room/AdvancedRoomSettingsTab.tsx | 4 +- .../settings/tabs/room/BridgeSettingsTab.tsx | 4 +- .../tabs/room/GeneralRoomSettingsTab.tsx | 4 +- .../tabs/room/NotificationSettingsTab.tsx | 4 +- .../tabs/room/RolesRoomSettingsTab.tsx | 8 +-- .../tabs/room/SecurityRoomSettingsTab.tsx | 10 +-- .../tabs/user/AppearanceUserSettingsTab.tsx | 8 +-- .../tabs/user/GeneralUserSettingsTab.tsx | 2 +- .../tabs/user/HelpUserSettingsTab.tsx | 6 +- .../tabs/user/LabsUserSettingsTab.tsx | 2 +- .../tabs/user/MjolnirUserSettingsTab.tsx | 4 +- .../tabs/user/NotificationUserSettingsTab.tsx | 2 +- .../tabs/user/PreferencesUserSettingsTab.tsx | 4 +- .../tabs/user/SecurityUserSettingsTab.tsx | 2 +- .../tabs/user/VoiceUserSettingsTab.tsx | 6 +- .../views/spaces/SpaceTreeLevel.tsx | 8 +-- .../views/terms/InlineTermsAgreement.tsx | 2 +- .../views/toasts/VerificationRequestToast.tsx | 12 ++-- .../verification/VerificationShowSas.tsx | 4 +- src/components/views/voip/AudioFeed.tsx | 8 +-- .../voip/AudioFeedArrayForLegacyCall.tsx | 10 +-- src/components/views/voip/DialPad.tsx | 6 +- src/components/views/voip/DialPadModal.tsx | 16 ++--- src/components/views/voip/LegacyCallView.tsx | 6 +- .../LegacyCallView/LegacyCallViewButtons.tsx | 2 +- .../views/voip/LegacyCallViewForRoom.tsx | 2 +- .../views/voip/LegacyCallViewSidebar.tsx | 2 +- src/components/views/voip/PipView.tsx | 2 +- src/components/views/voip/VideoFeed.tsx | 12 ++-- src/customisations/Media.ts | 2 +- src/dispatcher/dispatcher.ts | 4 +- src/editor/autocomplete.ts | 2 +- src/editor/model.ts | 2 +- src/editor/offset.ts | 2 +- src/editor/parts.ts | 16 ++--- src/editor/position.ts | 2 +- src/editor/range.ts | 2 +- src/effects/confetti/index.ts | 2 +- src/effects/fireworks/index.ts | 2 +- src/effects/hearts/index.ts | 2 +- src/effects/rainfall/index.ts | 2 +- src/effects/snowfall/index.ts | 2 +- src/effects/spaceinvaders/index.ts | 2 +- src/indexing/BaseEventIndexManager.ts | 38 ++++++------ src/indexing/EventIndexPeg.ts | 18 +++--- .../IntegrationManagerInstance.ts | 10 +-- src/integrations/IntegrationManagers.ts | 20 +++--- src/mjolnir/BanList.ts | 20 +++--- src/mjolnir/ListRule.ts | 22 +++---- src/mjolnir/Mjolnir.ts | 24 +++---- src/models/Call.ts | 2 +- src/models/LocalRoom.ts | 12 ++-- src/models/RoomUpload.ts | 2 +- src/notifications/NotificationUtils.ts | 4 +- src/notifications/PushRuleVectorState.ts | 12 ++-- src/notifications/StandardActions.ts | 14 ++--- .../VectorPushRulesDefinitions.ts | 2 +- src/performance/index.ts | 14 ++--- src/rageshake/rageshake.ts | 2 +- src/resizer/distributors/collapse.ts | 8 +-- src/resizer/distributors/fixed.ts | 6 +- src/resizer/distributors/percentage.ts | 2 +- src/resizer/item.ts | 2 +- src/resizer/resizer.ts | 2 +- src/resizer/sizer.ts | 2 +- .../controllers/FontSizeController.ts | 2 +- .../controllers/OrderedMultiController.ts | 2 +- .../PushToMatrixClientController.ts | 2 +- .../controllers/SystemFontController.ts | 2 +- .../controllers/UseSystemFontController.ts | 2 +- .../handlers/AccountSettingsHandler.ts | 2 +- .../handlers/DefaultSettingsHandler.ts | 2 +- .../handlers/DeviceSettingsHandler.ts | 2 +- src/settings/handlers/LocalEchoWrapper.ts | 2 +- .../handlers/PlatformSettingsHandler.ts | 2 +- .../handlers/RoomAccountSettingsHandler.ts | 2 +- .../handlers/RoomDeviceSettingsHandler.ts | 2 +- src/settings/handlers/RoomSettingsHandler.ts | 2 +- src/settings/watchers/FontWatcher.ts | 2 +- src/settings/watchers/ThemeWatcher.ts | 2 +- src/stores/AsyncStoreWithClient.ts | 2 +- src/stores/LifecycleStore.ts | 2 +- src/stores/ReadyWatchingStore.ts | 2 +- src/stores/RoomScrollStateStore.ts | 2 +- src/stores/ToastStore.ts | 12 ++-- src/stores/TypingStore.ts | 2 +- src/stores/UIStore.ts | 2 +- src/stores/WidgetEchoStore.ts | 12 ++-- src/stores/local-echo/EchoStore.ts | 2 +- src/stores/local-echo/RoomEchoContext.ts | 2 +- .../notifications/ListNotificationState.ts | 2 +- src/stores/notifications/NotificationState.ts | 4 +- .../notifications/RoomNotificationState.ts | 2 +- .../notifications/SpaceNotificationState.ts | 2 +- .../notifications/StaticNotificationState.ts | 2 +- .../SummarizedNotificationState.ts | 2 +- .../notifications/ThreadNotificationState.ts | 2 +- .../ThreadsRoomNotificationState.ts | 2 +- src/stores/room-list/ListLayout.ts | 2 +- src/stores/room-list/RoomListLayoutStore.ts | 2 +- src/stores/room-list/RoomListStore.ts | 2 +- src/stores/room-list/SpaceWatcher.ts | 2 +- .../previews/VoiceBroadcastPreview.ts | 2 +- src/stores/spaces/SpaceStore.ts | 2 +- src/stores/widgets/StopGapWidget.ts | 4 +- src/stores/widgets/StopGapWidgetDriver.ts | 2 +- src/toasts/IncomingLegacyCallToast.tsx | 2 +- src/utils/AutoDiscoveryUtils.tsx | 10 +-- src/utils/DMRoomMap.ts | 2 +- src/utils/DecryptFile.ts | 4 +- src/utils/EditorStateTransfer.ts | 2 +- src/utils/FileDownloader.ts | 2 +- src/utils/FixedRollingArray.ts | 2 +- src/utils/MarkedExecution.ts | 2 +- src/utils/MatrixGlob.ts | 10 +-- src/utils/MultiInviter.ts | 2 +- src/utils/PinningUtils.ts | 4 +- src/utils/Timer.ts | 14 ++--- src/utils/ValidatedServerConfig.ts | 14 ++--- src/utils/WidgetUtils.ts | 50 +++++++-------- src/utils/arrays.ts | 4 +- src/utils/direct-messages.ts | 18 +++--- src/utils/error.ts | 2 +- src/utils/exportUtils/Exporter.ts | 2 +- src/utils/exportUtils/HtmlExport.tsx | 2 +- src/utils/exportUtils/JSONExport.ts | 2 +- src/utils/exportUtils/PlainTextExport.ts | 2 +- .../permalinks/ElementPermalinkConstructor.ts | 18 +++--- .../MatrixSchemePermalinkConstructor.ts | 16 ++--- .../MatrixToPermalinkConstructor.ts | 16 ++--- src/utils/permalinks/PermalinkConstructor.ts | 39 +++++------- src/utils/permalinks/Permalinks.ts | 2 +- .../utils/VoiceBroadcastResumer.ts | 2 +- src/widgets/WidgetType.ts | 4 +- 396 files changed, 1110 insertions(+), 1098 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8cc5890ca4..30e01f86b5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -102,7 +102,6 @@ module.exports = { rules: { // temporary disabled "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-member-accessibility": "off", // Things we do that break the ideal style "prefer-promise-reject-errors": "off", @@ -157,6 +156,14 @@ module.exports = { "@typescript-eslint/no-var-requires": "off", }, }, + { + files: ["test/**/*.{ts,tsx}", "cypress/**/*.ts"], + rules: { + // We don't need super strict typing in test utilities + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + }, + }, ], settings: { react: { diff --git a/src/@types/polyfill.ts b/src/@types/polyfill.ts index 12a201e9c8..d24d2f4463 100644 --- a/src/@types/polyfill.ts +++ b/src/@types/polyfill.ts @@ -48,7 +48,7 @@ export function polyfillTouchEvent() { public get scale(): number { return 0.0; } - constructor(eventType: string, params?: any) { + public constructor(eventType: string, params?: any) { super(eventType, params); } }; diff --git a/src/@types/worker-loader.d.ts b/src/@types/worker-loader.d.ts index a8f5d8e9a4..9eecd59055 100644 --- a/src/@types/worker-loader.d.ts +++ b/src/@types/worker-loader.d.ts @@ -16,7 +16,7 @@ limitations under the License. declare module "*.worker.ts" { class WebpackWorker extends Worker { - constructor(); + public constructor(); } export default WebpackWorker; diff --git a/src/AddThreepid.ts b/src/AddThreepid.ts index eb06169c09..b6ed0d5738 100644 --- a/src/AddThreepid.ts +++ b/src/AddThreepid.ts @@ -47,7 +47,7 @@ export default class AddThreepid { private clientSecret: string; private bind: boolean; - constructor() { + public constructor() { this.clientSecret = MatrixClientPeg.get().generateClientSecret(); } diff --git a/src/AsyncWrapper.tsx b/src/AsyncWrapper.tsx index 95cbc2c518..f6f7edd2c2 100644 --- a/src/AsyncWrapper.tsx +++ b/src/AsyncWrapper.tsx @@ -47,7 +47,7 @@ export default class AsyncWrapper extends React.Component { error: null, }; - componentDidMount() { + public componentDidMount() { // XXX: temporary logging to try to diagnose // https://github.com/vector-im/element-web/issues/3148 logger.log("Starting load of AsyncWrapper for modal"); @@ -69,7 +69,7 @@ export default class AsyncWrapper extends React.Component { }); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -77,7 +77,7 @@ export default class AsyncWrapper extends React.Component { this.props.onFinished(false); }; - render() { + public render() { if (this.state.component) { const Component = this.state.component; return ; diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index ff5d6fafa7..46a406271c 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -69,7 +69,7 @@ export default abstract class BasePlatform { protected notificationCount = 0; protected errorDidOccur = false; - constructor() { + public constructor() { dis.register(this.onAction); this.startUpdateCheck = this.startUpdateCheck.bind(this); } diff --git a/src/BlurhashEncoder.ts b/src/BlurhashEncoder.ts index d9a7ab8504..56e137cc01 100644 --- a/src/BlurhashEncoder.ts +++ b/src/BlurhashEncoder.ts @@ -35,7 +35,7 @@ export class BlurhashEncoder { private seq = 0; private pendingDeferredMap = new Map>(); - constructor() { + public constructor() { this.worker = new BlurhashWorker(); this.worker.onmessage = this.onMessage; } diff --git a/src/ContentMessages.ts b/src/ContentMessages.ts index 47d336dc33..f7e7b5277c 100644 --- a/src/ContentMessages.ts +++ b/src/ContentMessages.ts @@ -598,7 +598,7 @@ export default class ContentMessages { }); } - static sharedInstance() { + public static sharedInstance() { if (window.mxContentMessages === undefined) { window.mxContentMessages = new ContentMessages(); } diff --git a/src/DecryptionFailureTracker.ts b/src/DecryptionFailureTracker.ts index 9756eb3028..c275a176eb 100644 --- a/src/DecryptionFailureTracker.ts +++ b/src/DecryptionFailureTracker.ts @@ -23,7 +23,7 @@ import { PosthogAnalytics } from "./PosthogAnalytics"; export class DecryptionFailure { public readonly ts: number; - constructor(public readonly failedEventId: string, public readonly errorCode: string) { + public constructor(public readonly failedEventId: string, public readonly errorCode: string) { this.ts = Date.now(); } } @@ -87,14 +87,14 @@ export class DecryptionFailureTracker { public trackInterval: number = null; // Spread the load on `Analytics` by tracking at a low frequency, `TRACK_INTERVAL_MS`. - static TRACK_INTERVAL_MS = 60000; + public static TRACK_INTERVAL_MS = 60000; // Call `checkFailures` every `CHECK_INTERVAL_MS`. - static CHECK_INTERVAL_MS = 5000; + public static CHECK_INTERVAL_MS = 5000; // Give events a chance to be decrypted by waiting `GRACE_PERIOD_MS` before counting // the failure in `failureCounts`. - static GRACE_PERIOD_MS = 4000; + public static GRACE_PERIOD_MS = 4000; /** * Create a new DecryptionFailureTracker. diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index 3621d7a601..19da52f45b 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -354,7 +354,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = { }; abstract class BaseHighlighter { - constructor(public highlightClass: string, public highlightLink: string) {} + public constructor(public highlightClass: string, public highlightLink: string) {} /** * apply the highlights to a section of text diff --git a/src/IdentityAuthClient.tsx b/src/IdentityAuthClient.tsx index 8d9040be49..293a3c19a6 100644 --- a/src/IdentityAuthClient.tsx +++ b/src/IdentityAuthClient.tsx @@ -44,7 +44,7 @@ export default class IdentityAuthClient { * When provided, this class will operate solely within memory, refusing to * persist any information such as tokens. Default null (not provided). */ - constructor(identityUrl?: string) { + public constructor(identityUrl?: string) { if (identityUrl) { // XXX: We shouldn't have to create a whole new MatrixClient just to // do identity server auth. The functions don't take an identity URL diff --git a/src/KeyBindingsManager.ts b/src/KeyBindingsManager.ts index ad02f5413c..7720c05166 100644 --- a/src/KeyBindingsManager.ts +++ b/src/KeyBindingsManager.ts @@ -105,7 +105,7 @@ export class KeyBindingsManager { * To overwrite the default key bindings add a new providers before the default provider, e.g. a provider for * customized key bindings. */ - bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider]; + public bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider]; /** * Finds a matching KeyAction for a given KeyboardEvent @@ -124,56 +124,56 @@ export class KeyBindingsManager { return undefined; } - getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getMessageComposerBindings), ev, ); } - getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getAutocompleteBindings), ev, ); } - getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getRoomListBindings), ev, ); } - getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getRoomBindings), ev, ); } - getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getNavigationBindings), ev, ); } - getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getAccessibilityBindings), ev, ); } - getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getCallBindings), ev, ); } - getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getLabsBindings), ev, diff --git a/src/Login.ts b/src/Login.ts index 34cd69dd37..ec769e8cb3 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -37,7 +37,7 @@ export default class Login { private defaultDeviceDisplayName: string; private tempClient: MatrixClient; - constructor(hsUrl: string, isUrl: string, fallbackHsUrl?: string, opts?: ILoginOptions) { + public constructor(hsUrl: string, isUrl: string, fallbackHsUrl?: string, opts?: ILoginOptions) { this.hsUrl = hsUrl; this.isUrl = isUrl; this.fallbackHsUrl = fallbackHsUrl; diff --git a/src/Markdown.ts b/src/Markdown.ts index 196def3816..404da0ca8d 100644 --- a/src/Markdown.ts +++ b/src/Markdown.ts @@ -117,7 +117,7 @@ export default class Markdown { private input: string; private parsed: commonmark.Node; - constructor(input: string) { + public constructor(input: string) { this.input = input; const parser = new commonmark.Parser(); @@ -234,7 +234,7 @@ export default class Markdown { return parsed; } - isPlainText(): boolean { + public isPlainText(): boolean { const walker = this.parsed.walker(); let ev: commonmark.NodeWalkingStep; @@ -257,7 +257,7 @@ export default class Markdown { return true; } - toHTML({ externalLinks = false } = {}): string { + public toHTML({ externalLinks = false } = {}): string { const renderer = new commonmark.HtmlRenderer({ safe: false, @@ -344,7 +344,7 @@ export default class Markdown { * N.B. this does **NOT** render arbitrary MD to plain text - only MD * which has no formatting. Otherwise it emits HTML(!). */ - toPlaintext(): string { + public toPlaintext(): string { const renderer = new commonmark.HtmlRenderer({ safe: false }); renderer.paragraph = function (node: commonmark.Node, entering: boolean) { diff --git a/src/NodeAnimator.tsx b/src/NodeAnimator.tsx index aefb049806..24b4e85ae3 100644 --- a/src/NodeAnimator.tsx +++ b/src/NodeAnimator.tsx @@ -47,7 +47,7 @@ export default class NodeAnimator extends React.Component { startStyles: [], }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.updateChildren(this.props.children); diff --git a/src/PasswordReset.ts b/src/PasswordReset.ts index f4a7771543..f6661a35f1 100644 --- a/src/PasswordReset.ts +++ b/src/PasswordReset.ts @@ -39,7 +39,7 @@ export default class PasswordReset { * @param {string} homeserverUrl The URL to the HS which has the account to reset. * @param {string} identityUrl The URL to the IS which has linked the email -> mxid mapping. */ - constructor(homeserverUrl: string, identityUrl: string) { + public constructor(homeserverUrl: string, identityUrl: string) { this.client = createClient({ baseUrl: homeserverUrl, idBaseUrl: identityUrl, diff --git a/src/PosthogAnalytics.ts b/src/PosthogAnalytics.ts index 2f6b46960b..1f1a018814 100644 --- a/src/PosthogAnalytics.ts +++ b/src/PosthogAnalytics.ts @@ -146,7 +146,7 @@ export class PosthogAnalytics { return this._instance; } - constructor(private readonly posthog: PostHog) { + public constructor(private readonly posthog: PostHog) { const posthogConfig = SdkConfig.getObject("posthog"); if (posthogConfig) { this.posthog.init(posthogConfig.get("project_api_key"), { diff --git a/src/PosthogTrackers.ts b/src/PosthogTrackers.ts index 9aa2561c9f..09c7225a3d 100644 --- a/src/PosthogTrackers.ts +++ b/src/PosthogTrackers.ts @@ -107,20 +107,20 @@ export default class PosthogTrackers { } export class PosthogScreenTracker extends PureComponent<{ screenName: ScreenName }> { - componentDidMount() { + public componentDidMount() { PosthogTrackers.instance.trackOverride(this.props.screenName); } - componentDidUpdate() { + public componentDidUpdate() { // We do not clear the old override here so that we do not send the non-override screen as a transition PosthogTrackers.instance.trackOverride(this.props.screenName); } - componentWillUnmount() { + public componentWillUnmount() { PosthogTrackers.instance.clearOverride(this.props.screenName); } - render() { + public render() { return null; // no need to render anything, we just need to hook into the React lifecycle } } diff --git a/src/ScalarAuthClient.ts b/src/ScalarAuthClient.ts index be7b85eca8..baa6e6f632 100644 --- a/src/ScalarAuthClient.ts +++ b/src/ScalarAuthClient.ts @@ -36,7 +36,7 @@ export default class ScalarAuthClient { private termsInteractionCallback: TermsInteractionCallback; private isDefaultManager: boolean; - constructor(private apiUrl: string, private uiUrl: string) { + public constructor(private apiUrl: string, private uiUrl: string) { this.scalarToken = null; // `undefined` to allow `startTermsFlow` to fallback to a default // callback if this is unset. @@ -72,22 +72,22 @@ export default class ScalarAuthClient { return this.readTokenFromStore(); } - setTermsInteractionCallback(callback) { + public setTermsInteractionCallback(callback) { this.termsInteractionCallback = callback; } - connect(): Promise { + public connect(): Promise { return this.getScalarToken().then((tok) => { this.scalarToken = tok; }); } - hasCredentials(): boolean { + public hasCredentials(): boolean { return this.scalarToken != null; // undef or null } // Returns a promise that resolves to a scalar_token string - getScalarToken(): Promise { + public getScalarToken(): Promise { const token = this.readToken(); if (!token) { @@ -169,7 +169,7 @@ export default class ScalarAuthClient { }); } - registerForToken(): Promise { + public registerForToken(): Promise { // Get openid bearer token from the HS as the first part of our dance return MatrixClientPeg.get() .getOpenIdToken() @@ -256,7 +256,7 @@ export default class ScalarAuthClient { } } - getScalarInterfaceUrlForRoom(room: Room, screen: string, id: string): string { + public getScalarInterfaceUrlForRoom(room: Room, screen: string, id: string): string { const roomId = room.roomId; const roomName = room.name; let url = this.uiUrl; @@ -273,7 +273,7 @@ export default class ScalarAuthClient { return url; } - getStarterLink(starterLinkUrl: string): string { + public getStarterLink(starterLinkUrl: string): string { return starterLinkUrl + "?scalar_token=" + encodeURIComponent(this.scalarToken); } } diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index f0cd6613d6..ed72417ecc 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -67,7 +67,7 @@ export function isSecretStorageBeingAccessed(): boolean { } export class AccessCancelledError extends Error { - constructor() { + public constructor() { super("Secret storage access canceled"); } } diff --git a/src/SendHistoryManager.ts b/src/SendHistoryManager.ts index 3f2e17b9d8..1fd8f839bd 100644 --- a/src/SendHistoryManager.ts +++ b/src/SendHistoryManager.ts @@ -27,12 +27,12 @@ interface IHistoryItem { } export default class SendHistoryManager { - history: Array = []; - prefix: string; - lastIndex = 0; // used for indexing the storage - currentIndex = 0; // used for indexing the loaded validated history Array + public history: Array = []; + public prefix: string; + public lastIndex = 0; // used for indexing the storage + public currentIndex = 0; // used for indexing the loaded validated history Array - constructor(roomId: string, prefix: string) { + public constructor(roomId: string, prefix: string) { this.prefix = prefix + roomId; // TODO: Performance issues? @@ -53,14 +53,14 @@ export default class SendHistoryManager { this.currentIndex = this.lastIndex + 1; } - static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem { + public static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem { return { parts: model.serializeParts(), replyEventId: replyEvent ? replyEvent.getId() : undefined, }; } - save(editorModel: EditorModel, replyEvent?: MatrixEvent) { + public save(editorModel: EditorModel, replyEvent?: MatrixEvent) { const item = SendHistoryManager.createItem(editorModel, replyEvent); this.history.push(item); this.currentIndex = this.history.length; @@ -68,7 +68,7 @@ export default class SendHistoryManager { sessionStorage.setItem(`${this.prefix}[${this.lastIndex}]`, JSON.stringify(item)); } - getItem(offset: number): IHistoryItem { + public getItem(offset: number): IHistoryItem { this.currentIndex = clamp(this.currentIndex + offset, 0, this.history.length - 1); return this.history[this.currentIndex]; } diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index f9d1677847..910c077525 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -138,7 +138,7 @@ export class Command { public readonly analyticsName?: SlashCommandEvent["command"]; private readonly _isEnabled?: () => boolean; - constructor(opts: ICommandOpts) { + public constructor(opts: ICommandOpts) { this.command = opts.command; this.aliases = opts.aliases || []; this.args = opts.args || ""; diff --git a/src/Terms.ts b/src/Terms.ts index 1904154087..101a778a94 100644 --- a/src/Terms.ts +++ b/src/Terms.ts @@ -34,7 +34,7 @@ export class Service { * @param {string} baseUrl The Base URL of the service (ie. before '/_matrix') * @param {string} accessToken The user's access token for the service */ - constructor(public serviceType: SERVICE_TYPES, public baseUrl: string, public accessToken: string) {} + public constructor(public serviceType: SERVICE_TYPES, public baseUrl: string, public accessToken: string) {} } export interface LocalisedPolicy { diff --git a/src/UserActivity.ts b/src/UserActivity.ts index 35301bbe19..0e163564e0 100644 --- a/src/UserActivity.ts +++ b/src/UserActivity.ts @@ -45,12 +45,12 @@ export default class UserActivity { private lastScreenX = 0; private lastScreenY = 0; - constructor(private readonly window: Window, private readonly document: Document) { + public constructor(private readonly window: Window, private readonly document: Document) { this.activeNowTimeout = new Timer(CURRENTLY_ACTIVE_THRESHOLD_MS); this.activeRecentlyTimeout = new Timer(RECENTLY_ACTIVE_THRESHOLD_MS); } - static sharedInstance() { + public static sharedInstance() { if (window.mxUserActivity === undefined) { window.mxUserActivity = new UserActivity(window, document); } diff --git a/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx b/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx index 426987a988..300e67df82 100644 --- a/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx +++ b/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx @@ -38,7 +38,7 @@ interface IState { * Allows the user to disable the Event Index. */ export default class DisableEventIndexDialog extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { disabling: false, diff --git a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx index 04e14422bf..98bbb55069 100644 --- a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx +++ b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx @@ -43,7 +43,7 @@ interface IState { * Allows the user to introspect the event index state and disable it. */ export default class ManageEventIndexDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -56,7 +56,7 @@ export default class ManageEventIndexDialog extends React.Component { + public updateCurrentRoom = async (room) => { const eventIndex = EventIndexPeg.get(); let stats; @@ -84,7 +84,7 @@ export default class ManageEventIndexDialog extends React.Component { + public async componentDidMount(): Promise { let eventIndexSize = 0; let crawlingRoomsCount = 0; let roomCount = 0; @@ -141,7 +141,7 @@ export default class ManageEventIndexDialog extends React.Component(); private passphraseField = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index cf0c16046c..0c976ec599 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -104,7 +104,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent(); private passphraseField = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let passPhraseKeySelected; diff --git a/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx b/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx index 7d451d5529..1998c7c7ed 100644 --- a/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx +++ b/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx @@ -48,7 +48,7 @@ type AnyPassphrase = KeysStartingWith; export default class ExportE2eKeysDialog extends React.Component { private unmounted = false; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx b/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx index c2b7155f66..b546ffc91a 100644 --- a/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx +++ b/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx @@ -57,7 +57,7 @@ export default class ImportE2eKeysDialog extends React.Component private unmounted = false; private file = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/audio/Playback.ts b/src/audio/Playback.ts index f74a1254e5..d5971ad73c 100644 --- a/src/audio/Playback.ts +++ b/src/audio/Playback.ts @@ -83,7 +83,7 @@ export class Playback extends EventEmitter implements IDestroyable, PlaybackInte * @param {number[]} seedWaveform Optional seed waveform to present until the proper waveform * can be calculated. Contains values between zero and one, inclusive. */ - constructor(private buf: ArrayBuffer, seedWaveform = DEFAULT_WAVEFORM) { + public constructor(private buf: ArrayBuffer, seedWaveform = DEFAULT_WAVEFORM) { super(); // Capture the file size early as reading the buffer will result in a 0-length buffer left behind this.fileSize = this.buf.byteLength; diff --git a/src/audio/PlaybackQueue.ts b/src/audio/PlaybackQueue.ts index 78ed653919..1ea8a85fa6 100644 --- a/src/audio/PlaybackQueue.ts +++ b/src/audio/PlaybackQueue.ts @@ -48,7 +48,7 @@ export class PlaybackQueue { private currentPlaybackId: string; // event ID, broken out from above for ease of use private recentFullPlays = new Set(); // event IDs - constructor(private room: Room) { + public constructor(private room: Room) { this.loadClocks(); SdkContextClass.instance.roomViewStore.addRoomListener(this.room.roomId, (isActive) => { diff --git a/src/audio/RecorderWorklet.ts b/src/audio/RecorderWorklet.ts index bd4705ebf2..5079ec58a9 100644 --- a/src/audio/RecorderWorklet.ts +++ b/src/audio/RecorderWorklet.ts @@ -43,7 +43,7 @@ class MxVoiceWorklet extends AudioWorkletProcessor { private nextAmplitudeSecond = 0; private amplitudeIndex = 0; - process(inputs, outputs, parameters) { + public process(inputs, outputs, parameters) { const currentSecond = roundTimeToTargetFreq(currentTime); // We special case the first ping because there's a fairly good chance that we'll miss the zeroth // update. Firefox for instance takes 0.06 seconds (roughly) to call this function for the first diff --git a/src/audio/VoiceMessageRecording.ts b/src/audio/VoiceMessageRecording.ts index c1b98e696f..f27fc36135 100644 --- a/src/audio/VoiceMessageRecording.ts +++ b/src/audio/VoiceMessageRecording.ts @@ -136,7 +136,7 @@ export class VoiceMessageRecording implements IDestroyable { return this.voiceRecording.isSupported; } - destroy(): void { + public destroy(): void { this.playback?.destroy(); this.voiceRecording.destroy(); } diff --git a/src/autocomplete/AutocompleteProvider.tsx b/src/autocomplete/AutocompleteProvider.tsx index ccc3a3c1c8..e76c4f1903 100644 --- a/src/autocomplete/AutocompleteProvider.tsx +++ b/src/autocomplete/AutocompleteProvider.tsx @@ -36,8 +36,8 @@ export interface IAutocompleteOptions { } export default abstract class AutocompleteProvider { - commandRegex: RegExp; - forcedCommandRegex: RegExp; + public commandRegex: RegExp; + public forcedCommandRegex: RegExp; protected renderingType: TimelineRenderingType = TimelineRenderingType.Room; @@ -59,7 +59,7 @@ export default abstract class AutocompleteProvider { } } - destroy() { + public destroy() { // stub } @@ -70,7 +70,7 @@ export default abstract class AutocompleteProvider { * @param {boolean} force True if the user is forcing completion * @return {object} { command, range } where both objects fields are null if no match */ - getCurrentCommand(query: string, selection: ISelectionRange, force = false) { + public getCurrentCommand(query: string, selection: ISelectionRange, force = false) { let commandRegex = this.commandRegex; if (force && this.shouldForceComplete()) { @@ -106,19 +106,19 @@ export default abstract class AutocompleteProvider { }; } - abstract getCompletions( + public abstract getCompletions( query: string, selection: ISelectionRange, force: boolean, limit: number, ): Promise; - abstract getName(): string; + public abstract getName(): string; - abstract renderCompletions(completions: React.ReactNode[]): React.ReactNode | null; + public abstract renderCompletions(completions: React.ReactNode[]): React.ReactNode | null; // Whether we should provide completions even if triggered forcefully, without a sigil. - shouldForceComplete(): boolean { + public shouldForceComplete(): boolean { return false; } } diff --git a/src/autocomplete/Autocompleter.ts b/src/autocomplete/Autocompleter.ts index 212cefdc18..67a40db158 100644 --- a/src/autocomplete/Autocompleter.ts +++ b/src/autocomplete/Autocompleter.ts @@ -59,23 +59,23 @@ export interface IProviderCompletions { } export default class Autocompleter { - room: Room; - providers: AutocompleteProvider[]; + public room: Room; + public providers: AutocompleteProvider[]; - constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) { + public constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) { this.room = room; this.providers = PROVIDERS.map((Prov) => { return new Prov(room, renderingType); }); } - destroy() { + public destroy() { this.providers.forEach((p) => { p.destroy(); }); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force = false, diff --git a/src/autocomplete/CommandProvider.tsx b/src/autocomplete/CommandProvider.tsx index 061f5f223d..68850a9a15 100644 --- a/src/autocomplete/CommandProvider.tsx +++ b/src/autocomplete/CommandProvider.tsx @@ -31,9 +31,9 @@ import { TimelineRenderingType } from "../contexts/RoomContext"; const COMMAND_RE = /(^\/\w*)(?: .*)?/g; export default class CommandProvider extends AutocompleteProvider { - matcher: QueryMatcher; + public matcher: QueryMatcher; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: COMMAND_RE, renderingType }); this.matcher = new QueryMatcher(Commands, { keys: ["command", "args", "description"], @@ -42,7 +42,7 @@ export default class CommandProvider extends AutocompleteProvider { }); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force?: boolean, @@ -100,11 +100,11 @@ export default class CommandProvider extends AutocompleteProvider { }); } - getName() { + public getName() { return "*️⃣ " + _t("Commands"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
; - nameMatcher: QueryMatcher; + public matcher: QueryMatcher; + public nameMatcher: QueryMatcher; private readonly recentlyUsed: IEmoji[]; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: EMOJI_REGEX, renderingType }); this.matcher = new QueryMatcher(SORTED_EMOJI, { keys: [], @@ -93,7 +93,7 @@ export default class EmojiProvider extends AutocompleteProvider { this.recentlyUsed = Array.from(new Set(recent.get().map(getEmojiFromUnicode).filter(Boolean))); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force?: boolean, @@ -154,11 +154,11 @@ export default class EmojiProvider extends AutocompleteProvider { return []; } - getName() { + public getName() { return "😃 " + _t("Emoji"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
{ + public async getCompletions( + query: string, + selection: ISelectionRange, + force = false, + limit = -1, + ): Promise { const client = MatrixClientPeg.get(); if (!this.room.currentState.mayTriggerNotifOfType("room", client.credentials.userId)) return []; @@ -60,11 +65,11 @@ export default class NotifProvider extends AutocompleteProvider { return []; } - getName() { + public getName() { return "❗️ " + _t("Room Notification"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
{ private _options: IOptions; private _items: Map; - constructor(objects: T[], options: IOptions = { keys: [] }) { + public constructor(objects: T[], options: IOptions = { keys: [] }) { this._options = options; this.setObjects(objects); @@ -61,7 +61,7 @@ export default class QueryMatcher { } } - setObjects(objects: T[]) { + public setObjects(objects: T[]) { this._items = new Map(); for (const object of objects) { @@ -96,7 +96,7 @@ export default class QueryMatcher { } } - match(query: string, limit = -1): T[] { + public match(query: string, limit = -1): T[] { query = this.processQuery(query); if (this._options.shouldMatchWordsOnly) { query = query.replace(/[^\w]/g, ""); diff --git a/src/autocomplete/RoomProvider.tsx b/src/autocomplete/RoomProvider.tsx index 596ef113b0..a225676898 100644 --- a/src/autocomplete/RoomProvider.tsx +++ b/src/autocomplete/RoomProvider.tsx @@ -48,7 +48,7 @@ function matcherObject(room: Room, displayedAlias: string, matchName = "") { export default class RoomProvider extends AutocompleteProvider { protected matcher: QueryMatcher; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: ROOM_REGEX, renderingType }); this.matcher = new QueryMatcher([], { keys: ["displayedAlias", "matchName"], @@ -62,7 +62,12 @@ export default class RoomProvider extends AutocompleteProvider { return cli.getVisibleRooms().filter((r) => !r.isSpaceRoom()); } - async getCompletions(query: string, selection: ISelectionRange, force = false, limit = -1): Promise { + public async getCompletions( + query: string, + selection: ISelectionRange, + force = false, + limit = -1, + ): Promise { let completions = []; const { command, range } = this.getCurrentCommand(query, selection, force); if (command) { @@ -118,11 +123,11 @@ export default class RoomProvider extends AutocompleteProvider { return completions; } - getName() { + public getName() { return _t("Rooms"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
r.isSpaceRoom()); } - getName() { + public getName() { return _t("Spaces"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
; - users: RoomMember[]; - room: Room; + public matcher: QueryMatcher; + public users: RoomMember[]; + public room: Room; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: USER_REGEX, forcedCommandRegex: FORCED_USER_REGEX, @@ -64,7 +64,7 @@ export default class UserProvider extends AutocompleteProvider { MatrixClientPeg.get().on(RoomStateEvent.Update, this.onRoomStateUpdate); } - destroy() { + public destroy() { if (MatrixClientPeg.get()) { MatrixClientPeg.get().removeListener(RoomEvent.Timeline, this.onRoomTimeline); MatrixClientPeg.get().removeListener(RoomStateEvent.Update, this.onRoomStateUpdate); @@ -101,7 +101,7 @@ export default class UserProvider extends AutocompleteProvider { this.users = null; }; - async getCompletions( + public async getCompletions( rawQuery: string, selection: ISelectionRange, force = false, @@ -146,7 +146,7 @@ export default class UserProvider extends AutocompleteProvider { return completions; } - getName(): string { + public getName(): string { return _t("Users"); } @@ -167,7 +167,7 @@ export default class UserProvider extends AutocompleteProvider { this.matcher.setObjects(this.users); } - onUserSpoke(user: RoomMember) { + public onUserSpoke(user: RoomMember) { if (!this.users) return; if (!user) return; if (user.userId === MatrixClientPeg.get().credentials.userId) return; @@ -182,7 +182,7 @@ export default class UserProvider extends AutocompleteProvider { this.matcher.setObjects(this.users); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
= DynamicHtmlElementPr }; export default class AutoHideScrollbar extends React.Component> { - static defaultProps = { + public static defaultProps = { element: "div" as keyof ReactHTML, }; diff --git a/src/components/structures/ContextMenu.tsx b/src/components/structures/ContextMenu.tsx index ddee8bf116..6dbdc4a7eb 100644 --- a/src/components/structures/ContextMenu.tsx +++ b/src/components/structures/ContextMenu.tsx @@ -112,12 +112,12 @@ interface IState { export default class ContextMenu extends React.PureComponent { private readonly initialFocus: HTMLElement; - static defaultProps = { + public static defaultProps = { hasBackground: true, managed: true, }; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -447,7 +447,7 @@ export default class ContextMenu extends React.PureComponent { ); } - render(): React.ReactChild { + public render(): React.ReactChild { if (this.props.mountAsChild) { // Render as a child of the current parent return this.renderMenu(); diff --git a/src/components/structures/EmbeddedPage.tsx b/src/components/structures/EmbeddedPage.tsx index 0b862b7f1d..d531e4fcc4 100644 --- a/src/components/structures/EmbeddedPage.tsx +++ b/src/components/structures/EmbeddedPage.tsx @@ -48,7 +48,7 @@ export default class EmbeddedPage extends React.PureComponent { private unmounted = false; private dispatcherRef: string = null; - constructor(props: IProps, context: typeof MatrixClientContext) { + public constructor(props: IProps, context: typeof MatrixClientContext) { super(props, context); this.state = { diff --git a/src/components/structures/FilePanel.tsx b/src/components/structures/FilePanel.tsx index 9c46e8861b..6efa4f857a 100644 --- a/src/components/structures/FilePanel.tsx +++ b/src/components/structures/FilePanel.tsx @@ -51,7 +51,7 @@ interface IState { * Component which shows the filtered file using a TimelinePanel */ class FilePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; // This is used to track if a decrypted event was a live event and should be // added to the timeline. @@ -59,7 +59,7 @@ class FilePanel extends React.Component { public noRoom: boolean; private card = createRef(); - state = { + public state = { timelineSet: null, narrow: false, }; diff --git a/src/components/structures/GenericErrorPage.tsx b/src/components/structures/GenericErrorPage.tsx index 5e5da9c10a..4179abe7fd 100644 --- a/src/components/structures/GenericErrorPage.tsx +++ b/src/components/structures/GenericErrorPage.tsx @@ -22,7 +22,7 @@ interface IProps { } export default class GenericErrorPage extends React.PureComponent { - render() { + public render() { return (
diff --git a/src/components/structures/IndicatorScrollbar.tsx b/src/components/structures/IndicatorScrollbar.tsx index 206d18fb4a..1476198239 100644 --- a/src/components/structures/IndicatorScrollbar.tsx +++ b/src/components/structures/IndicatorScrollbar.tsx @@ -47,7 +47,7 @@ export default class IndicatorScrollbar e private likelyTrackpadUser: boolean = null; private checkAgainForTrackpad = 0; // ts in milliseconds to recheck this._likelyTrackpadUser - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/InteractiveAuth.tsx b/src/components/structures/InteractiveAuth.tsx index d788377bff..b5582323bf 100644 --- a/src/components/structures/InteractiveAuth.tsx +++ b/src/components/structures/InteractiveAuth.tsx @@ -99,7 +99,7 @@ export default class InteractiveAuthComponent extends React.Component { private focusedElement = null; private isDoingStickyHeaders = false; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/LegacyCallEventGrouper.ts b/src/components/structures/LegacyCallEventGrouper.ts index 3bc9abd3f4..9a4d82a9f8 100644 --- a/src/components/structures/LegacyCallEventGrouper.ts +++ b/src/components/structures/LegacyCallEventGrouper.ts @@ -75,7 +75,7 @@ export default class LegacyCallEventGrouper extends EventEmitter { private call: MatrixCall; public state: CallState | CustomCallState; - constructor() { + public constructor() { super(); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallsChanged, this.setCall); diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 40bb394980..f0e48f44be 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -125,7 +125,7 @@ interface IState { * Components mounted below us can access the matrix client via the react context. */ class LoggedInView extends React.Component { - static displayName = "LoggedInView"; + public static displayName = "LoggedInView"; protected readonly _matrixClient: MatrixClient; protected readonly _roomView: React.RefObject; @@ -136,7 +136,7 @@ class LoggedInView extends React.Component { protected backgroundImageWatcherRef: string; protected resizer: Resizer; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -159,7 +159,7 @@ class LoggedInView extends React.Component { this.resizeHandler = React.createRef(); } - componentDidMount() { + public componentDidMount() { document.addEventListener("keydown", this.onNativeKeyDown, false); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallState, this.onCallState); @@ -191,7 +191,7 @@ class LoggedInView extends React.Component { this.refreshBackgroundImage(); } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("keydown", this.onNativeKeyDown, false); LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallState, this.onCallState); this._matrixClient.removeListener(ClientEvent.AccountData, this.onAccountData); @@ -621,7 +621,7 @@ class LoggedInView extends React.Component { } }; - render() { + public render() { let pageElement; switch (this.props.page_type) { diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 97d623a173..536626f270 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -210,9 +210,9 @@ interface IState { } export default class MatrixChat extends React.PureComponent { - static displayName = "MatrixChat"; + public static displayName = "MatrixChat"; - static defaultProps = { + public static defaultProps = { realQueryParams: {}, startingFragmentQueryParams: {}, config: {}, @@ -237,7 +237,7 @@ export default class MatrixChat extends React.PureComponent { private readonly fontWatcher: FontWatcher; private readonly stores: SdkContextClass; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.stores = SdkContextClass.instance; this.stores.constructEagerStores(); @@ -417,7 +417,7 @@ export default class MatrixChat extends React.PureComponent { window.addEventListener("resize", this.onWindowResized); } - componentDidUpdate(prevProps, prevState) { + public componentDidUpdate(prevProps, prevState) { if (this.shouldTrackPageChange(prevState, this.state)) { const durationMs = this.stopPageChangeTimer(); PosthogTrackers.instance.trackPageChange(this.state.view, this.state.page_type, durationMs); @@ -428,7 +428,7 @@ export default class MatrixChat extends React.PureComponent { } } - componentWillUnmount() { + public componentWillUnmount() { Lifecycle.stopMatrixClient(); dis.unregister(this.dispatcherRef); this.themeWatcher.stop(); @@ -2016,7 +2016,7 @@ export default class MatrixChat extends React.PureComponent { return fragmentAfterLogin; } - render() { + public render() { const fragmentAfterLogin = this.getFragmentAfterLogin(); let view = null; diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index 16cdabc2a1..8942f0abd4 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -214,10 +214,10 @@ interface IReadReceiptForUser { /* (almost) stateless UI component which builds the event tiles in the room timeline. */ export default class MessagePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; - static defaultProps = { + public static defaultProps = { disableGrouping: false, }; @@ -272,7 +272,7 @@ export default class MessagePanel extends React.Component { // A map to allow groupers to maintain consistent keys even if their first event is uprooted due to back-pagination. public grouperKeyMap = new WeakMap(); - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -296,19 +296,19 @@ export default class MessagePanel extends React.Component { ); } - componentDidMount() { + public componentDidMount() { this.calculateRoomMembersCount(); this.props.room?.currentState.on(RoomStateEvent.Update, this.calculateRoomMembersCount); this.isMounted = true; } - componentWillUnmount() { + public componentWillUnmount() { this.isMounted = false; this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount); SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef); } - componentDidUpdate(prevProps, prevState) { + public componentDidUpdate(prevProps, prevState) { if (prevProps.layout !== this.props.layout) { this.calculateRoomMembersCount(); } @@ -982,7 +982,7 @@ export default class MessagePanel extends React.Component { } } - render() { + public render() { let topSpinner; let bottomSpinner; if (this.props.backPaginating) { @@ -1057,14 +1057,14 @@ export default class MessagePanel extends React.Component { } abstract class BaseGrouper { - static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true; + public static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true; public events: MatrixEvent[] = []; // events that we include in the group but then eject out and place above the group. public ejectedEvents: MatrixEvent[] = []; public readMarker: ReactNode; - constructor( + public constructor( public readonly panel: MessagePanel, public readonly event: MatrixEvent, public readonly prevEvent: MatrixEvent, @@ -1097,7 +1097,7 @@ abstract class BaseGrouper { // Grouping only events sent by the same user that sent the `m.room.create` and only until // the first non-state event, beacon_info event or membership event which is not regarding the sender of the `m.room.create` event class CreationGrouper extends BaseGrouper { - static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { + public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { return ev.getType() === EventType.RoomCreate; }; @@ -1231,7 +1231,7 @@ class CreationGrouper extends BaseGrouper { // Wrap consecutive grouped events in a ListSummary class MainGrouper extends BaseGrouper { - static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { + public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { if (!panel.shouldShowEvent(ev)) return false; if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) { @@ -1249,7 +1249,7 @@ class MainGrouper extends BaseGrouper { return false; }; - constructor( + public constructor( public readonly panel: MessagePanel, public readonly event: MatrixEvent, public readonly prevEvent: MatrixEvent, diff --git a/src/components/structures/NotificationPanel.tsx b/src/components/structures/NotificationPanel.tsx index c43d125e66..cf3f3e0fba 100644 --- a/src/components/structures/NotificationPanel.tsx +++ b/src/components/structures/NotificationPanel.tsx @@ -38,11 +38,11 @@ interface IState { * Component which shows the global notification list using a TimelinePanel */ export default class NotificationPanel extends React.PureComponent { - static contextType = RoomContext; + public static contextType = RoomContext; private card = React.createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -54,7 +54,7 @@ export default class NotificationPanel extends React.PureComponent

{_t("You're all caught up")}

diff --git a/src/components/structures/RightPanel.tsx b/src/components/structures/RightPanel.tsx index 3d5295391c..8759160057 100644 --- a/src/components/structures/RightPanel.tsx +++ b/src/components/structures/RightPanel.tsx @@ -60,10 +60,10 @@ interface IState { } export default class RightPanel extends React.Component { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { diff --git a/src/components/structures/RoomSearch.tsx b/src/components/structures/RoomSearch.tsx index 1f8c95134b..6c7ddbe755 100644 --- a/src/components/structures/RoomSearch.tsx +++ b/src/components/structures/RoomSearch.tsx @@ -33,7 +33,7 @@ interface IProps { export default class RoomSearch extends React.PureComponent { private readonly dispatcherRef: string; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.dispatcherRef = defaultDispatcher.register(this.onAction); diff --git a/src/components/structures/RoomStatusBar.tsx b/src/components/structures/RoomStatusBar.tsx index 2ce359c686..7d621afc5d 100644 --- a/src/components/structures/RoomStatusBar.tsx +++ b/src/components/structures/RoomStatusBar.tsx @@ -89,7 +89,7 @@ export default class RoomStatusBar extends React.PureComponent { private unmounted = false; public static contextType = MatrixClientContext; - constructor(props: IProps, context: typeof MatrixClientContext) { + public constructor(props: IProps, context: typeof MatrixClientContext) { super(props, context); this.state = { diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 24b049a16b..3de552d1d0 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -371,10 +371,10 @@ export class RoomView extends React.Component { private messagePanel: TimelinePanel; private roomViewBody = createRef(); - static contextType = SDKContext; + public static contextType = SDKContext; public context!: React.ContextType; - constructor(props: IRoomProps, context: React.ContextType) { + public constructor(props: IRoomProps, context: React.ContextType) { super(props, context); const llMembers = context.client.hasLazyLoadMembersEnabled(); @@ -838,7 +838,7 @@ export class RoomView extends React.Component { return isManuallyShown && widgets.length > 0; } - componentDidMount() { + public componentDidMount() { this.onRoomViewStoreUpdate(true); const call = this.getCallForRoom(); @@ -851,7 +851,7 @@ export class RoomView extends React.Component { window.addEventListener("beforeunload", this.onPageUnload); } - shouldComponentUpdate(nextProps, nextState) { + public shouldComponentUpdate(nextProps, nextState) { const hasPropsDiff = objectHasDiff(this.props, nextProps); const { upgradeRecommendation, ...state } = this.state; @@ -864,7 +864,7 @@ export class RoomView extends React.Component { return hasPropsDiff || hasStateDiff; } - componentDidUpdate() { + public componentDidUpdate() { // Note: We check the ref here with a flag because componentDidMount, despite // documentation, does not define our messagePanel ref. It looks like our spinner // in render() prevents the ref from being set on first mount, so we try and @@ -877,7 +877,7 @@ export class RoomView extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { // set a boolean to say we've been unmounted, which any pending // promises can use to throw away their results. // @@ -1804,13 +1804,13 @@ export class RoomView extends React.Component { return this.context.client.getRoom(createEvent.getContent()["predecessor"]["room_id"]); } - getHiddenHighlightCount() { + public getHiddenHighlightCount() { const oldRoom = this.getOldRoom(); if (!oldRoom) return 0; return oldRoom.getUnreadNotificationCount(NotificationCountType.Highlight); } - onHiddenHighlightsClick = () => { + public onHiddenHighlightsClick = () => { const oldRoom = this.getOldRoom(); if (!oldRoom) return; dis.dispatch({ @@ -1869,7 +1869,7 @@ export class RoomView extends React.Component { ); } - render() { + public render() { if (this.state.room instanceof LocalRoom) { if (this.state.room.state === LocalRoomState.CREATING) { return this.renderLocalRoomCreateLoader(); diff --git a/src/components/structures/ScrollPanel.tsx b/src/components/structures/ScrollPanel.tsx index 966627d42b..66676666df 100644 --- a/src/components/structures/ScrollPanel.tsx +++ b/src/components/structures/ScrollPanel.tsx @@ -195,7 +195,7 @@ export default class ScrollPanel extends React.Component { private heightUpdateInProgress: boolean; private divScroll: HTMLDivElement; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.props.resizeNotifier?.on("middlePanelResizedNoisy", this.onResize); diff --git a/src/components/structures/SearchBox.tsx b/src/components/structures/SearchBox.tsx index 314fc051d3..a0777f2d52 100644 --- a/src/components/structures/SearchBox.tsx +++ b/src/components/structures/SearchBox.tsx @@ -45,7 +45,7 @@ interface IState { export default class SearchBox extends React.Component { private search = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx index b2de0363fc..6b7929695b 100644 --- a/src/components/structures/SpaceRoomView.tsx +++ b/src/components/structures/SpaceRoomView.tsx @@ -611,13 +611,13 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => { }; export default class SpaceRoomView extends React.PureComponent { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; private readonly creator: string; private readonly dispatcherRef: string; - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); let phase = Phase.Landing; @@ -642,11 +642,11 @@ export default class SpaceRoomView extends React.PureComponent { RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate); } - componentDidMount() { + public componentDidMount() { this.context.on(RoomEvent.MyMembership, this.onMyMembership); } - componentWillUnmount() { + public componentWillUnmount() { defaultDispatcher.unregister(this.dispatcherRef); RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate); this.context.off(RoomEvent.MyMembership, this.onMyMembership); @@ -794,7 +794,7 @@ export default class SpaceRoomView extends React.PureComponent { } } - render() { + public render() { const rightPanel = this.state.showRightPanel && this.state.phase === Phase.Landing ? ( diff --git a/src/components/structures/TabbedView.tsx b/src/components/structures/TabbedView.tsx index a84c72691e..7446ab73b3 100644 --- a/src/components/structures/TabbedView.tsx +++ b/src/components/structures/TabbedView.tsx @@ -37,7 +37,7 @@ export class Tab { * @param {React.ReactNode} body The JSX for the tab container. * @param {string} screenName The screen name to report to Posthog. */ - constructor( + public constructor( public readonly id: string, public readonly label: string, public readonly icon: string, @@ -64,7 +64,7 @@ interface IState { } export default class TabbedView extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId); @@ -73,7 +73,7 @@ export default class TabbedView extends React.Component { }; } - static defaultProps = { + public static defaultProps = { tabLocation: TabLocation.LEFT, }; diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index 292cd394d8..b65a14b3c5 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -76,7 +76,7 @@ interface IState { } export default class ThreadView extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private dispatcherRef: string; @@ -84,7 +84,7 @@ export default class ThreadView extends React.Component { private timelinePanel = createRef(); private card = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const thread = this.props.room.getThread(this.props.mxEvent.getId()); diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index 743a409834..214e252fbc 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -227,13 +227,13 @@ interface IEventIndexOpts { * Also responsible for handling and sending read receipts. */ class TimelinePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; // a map from room id to read marker event timestamp - static roomReadMarkerTsMap: Record = {}; + public static roomReadMarkerTsMap: Record = {}; - static defaultProps = { + public static defaultProps = { // By default, disable the timelineCap in favour of unpaginating based on // event tile heights. (See _unpaginateEvents) timelineCap: Number.MAX_VALUE, @@ -257,7 +257,7 @@ class TimelinePanel extends React.Component { // A map of private callEventGroupers = new Map(); - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); this.context = context; @@ -360,7 +360,7 @@ class TimelinePanel extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { // set a boolean to say we've been unmounted, which any pending // promises can use to throw away their results. // @@ -1883,7 +1883,7 @@ class TimelinePanel extends React.Component { this.callEventGroupers = buildLegacyCallEventGroupers(this.callEventGroupers, events); } - render() { + public render() { // just show a spinner while the timeline loads. // // put it in a div of the right class (mx_RoomView_messagePanel) so diff --git a/src/components/structures/ToastContainer.tsx b/src/components/structures/ToastContainer.tsx index 85699ef1fb..42d552928f 100644 --- a/src/components/structures/ToastContainer.tsx +++ b/src/components/structures/ToastContainer.tsx @@ -25,7 +25,7 @@ interface IState { } export default class ToastContainer extends React.Component<{}, IState> { - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { toasts: ToastStore.sharedInstance().getToasts(), @@ -39,7 +39,7 @@ export default class ToastContainer extends React.Component<{}, IState> { ToastStore.sharedInstance().on("update", this.onToastStoreUpdate); } - componentWillUnmount() { + public componentWillUnmount() { ToastStore.sharedInstance().removeListener("update", this.onToastStoreUpdate); } @@ -50,7 +50,7 @@ export default class ToastContainer extends React.Component<{}, IState> { }); }; - render() { + public render() { const totalCount = this.state.toasts.length; const isStacked = totalCount > 1; let toast; diff --git a/src/components/structures/UploadBar.tsx b/src/components/structures/UploadBar.tsx index c48325561b..c92994cdef 100644 --- a/src/components/structures/UploadBar.tsx +++ b/src/components/structures/UploadBar.tsx @@ -57,7 +57,7 @@ export default class UploadBar extends React.PureComponent { private dispatcherRef: Optional; private mounted = false; - constructor(props) { + public constructor(props) { super(props); // Set initial state to any available upload in this room - we might be mounting @@ -65,12 +65,12 @@ export default class UploadBar extends React.PureComponent { this.state = this.calculateState(); } - componentDidMount() { + public componentDidMount() { this.dispatcherRef = dis.register(this.onAction); this.mounted = true; } - componentWillUnmount() { + public componentWillUnmount() { this.mounted = false; dis.unregister(this.dispatcherRef!); } @@ -103,7 +103,7 @@ export default class UploadBar extends React.PureComponent { ContentMessages.sharedInstance().cancelUpload(this.state.currentUpload!); }; - render() { + public render() { if (!this.state.currentFile) { return null; } diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 5e6970f85b..86f1d38deb 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -93,7 +93,7 @@ export default class UserMenu extends React.Component { private buttonRef: React.RefObject = createRef(); private voiceBroadcastRecordingStore = VoiceBroadcastRecordingsStore.instance(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/UserView.tsx b/src/components/structures/UserView.tsx index 47ba1172b2..226de3e233 100644 --- a/src/components/structures/UserView.tsx +++ b/src/components/structures/UserView.tsx @@ -41,7 +41,7 @@ interface IState { } export default class UserView extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { loading: true, diff --git a/src/components/structures/ViewSource.tsx b/src/components/structures/ViewSource.tsx index 7fd75904f5..b87194f251 100644 --- a/src/components/structures/ViewSource.tsx +++ b/src/components/structures/ViewSource.tsx @@ -40,7 +40,7 @@ interface IState { } export default class ViewSource extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/auth/CompleteSecurity.tsx b/src/components/structures/auth/CompleteSecurity.tsx index 8da8e5c535..b5d07e5396 100644 --- a/src/components/structures/auth/CompleteSecurity.tsx +++ b/src/components/structures/auth/CompleteSecurity.tsx @@ -33,7 +33,7 @@ interface IState { } export default class CompleteSecurity extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const store = SetupEncryptionStore.sharedInstance(); store.on("update", this.onStoreUpdate); diff --git a/src/components/structures/auth/E2eSetup.tsx b/src/components/structures/auth/E2eSetup.tsx index c3ee905150..f1fc6378e3 100644 --- a/src/components/structures/auth/E2eSetup.tsx +++ b/src/components/structures/auth/E2eSetup.tsx @@ -27,7 +27,7 @@ interface IProps { } export default class E2eSetup extends React.Component { - render() { + public render() { return ( diff --git a/src/components/structures/auth/ForgotPassword.tsx b/src/components/structures/auth/ForgotPassword.tsx index 208c29115e..eef3962e7f 100644 --- a/src/components/structures/auth/ForgotPassword.tsx +++ b/src/components/structures/auth/ForgotPassword.tsx @@ -350,7 +350,7 @@ export default class ForgotPassword extends React.Component { } as any); }; - renderEnterEmail(): JSX.Element { + public renderEnterEmail(): JSX.Element { return ( { ); } - async renderConfirmLogoutDevicesDialog(): Promise { + public async renderConfirmLogoutDevicesDialog(): Promise { const { finished } = Modal.createDialog<[boolean]>(QuestionDialog, { title: _t("Warning!"), description: ( @@ -395,7 +395,7 @@ export default class ForgotPassword extends React.Component { return confirmed; } - renderCheckEmail(): JSX.Element { + public renderCheckEmail(): JSX.Element { return ( { ); } - renderSetPassword(): JSX.Element { + public renderSetPassword(): JSX.Element { const submitButtonChild = this.state.phase === Phase.ResettingPassword ? : _t("Reset password"); @@ -460,7 +460,7 @@ export default class ForgotPassword extends React.Component { ); } - renderDone() { + public renderDone() { return ( <> @@ -484,7 +484,7 @@ export default class ForgotPassword extends React.Component { ); } - render() { + public render() { let resetPasswordJsx: JSX.Element; switch (this.state.phase) { diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index a8612d7a18..49d826c74a 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -110,7 +110,7 @@ export default class LoginComponent extends React.PureComponent private readonly stepRendererMap: Record ReactNode>; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -148,7 +148,7 @@ export default class LoginComponent extends React.PureComponent this.initLoginLogic(this.props.serverConfig); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -162,9 +162,9 @@ export default class LoginComponent extends React.PureComponent } } - isBusy = () => this.state.busy || this.props.busy; + public isBusy = () => this.state.busy || this.props.busy; - onPasswordLogin = async (username, phoneCountry, phoneNumber, password) => { + public onPasswordLogin = async (username, phoneCountry, phoneNumber, password) => { if (!this.state.serverIsAlive) { this.setState({ busy: true }); // Do a quick liveliness check on the URLs @@ -264,11 +264,11 @@ export default class LoginComponent extends React.PureComponent ); }; - onUsernameChanged = (username) => { + public onUsernameChanged = (username) => { this.setState({ username: username }); }; - onUsernameBlur = async (username) => { + public onUsernameBlur = async (username) => { const doWellknownLookup = username[0] === "@"; this.setState({ username: username, @@ -315,23 +315,23 @@ export default class LoginComponent extends React.PureComponent } }; - onPhoneCountryChanged = (phoneCountry) => { + public onPhoneCountryChanged = (phoneCountry) => { this.setState({ phoneCountry: phoneCountry }); }; - onPhoneNumberChanged = (phoneNumber) => { + public onPhoneNumberChanged = (phoneNumber) => { this.setState({ phoneNumber: phoneNumber, }); }; - onRegisterClick = (ev) => { + public onRegisterClick = (ev) => { ev.preventDefault(); ev.stopPropagation(); this.props.onRegisterClick(); }; - onTryRegisterClick = (ev) => { + public onTryRegisterClick = (ev) => { const hasPasswordFlow = this.state.flows?.find((flow) => flow.type === "m.login.password"); const ssoFlow = this.state.flows?.find((flow) => flow.type === "m.login.sso" || flow.type === "m.login.cas"); // If has no password flow but an SSO flow guess that the user wants to register with SSO. @@ -502,7 +502,7 @@ export default class LoginComponent extends React.PureComponent return errorText; } - renderLoginComponentForFlows() { + public renderLoginComponentForFlows() { if (!this.state.flows) return null; // this is the ideal order we want to show the flows in @@ -553,7 +553,7 @@ export default class LoginComponent extends React.PureComponent ); }; - render() { + public render() { const loader = this.isBusy() && !this.state.busyLoggingIn ? (
diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 5a7a61e1ea..d65cfd7828 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -125,7 +125,7 @@ export default class Registration extends React.Component { // `replaceClient` tracks latest serverConfig to spot when it changes under the async method which fetches flows private latestServerConfig: ValidatedServerConfig; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -148,13 +148,13 @@ export default class Registration extends React.Component { }); } - componentDidMount() { + public componentDidMount() { this.replaceClient(this.props.serverConfig); //triggers a confirmation dialog for data loss before page unloads/refreshes window.addEventListener("beforeunload", this.unloadCallback); } - componentWillUnmount() { + public componentWillUnmount() { window.removeEventListener("beforeunload", this.unloadCallback); } @@ -565,7 +565,7 @@ export default class Registration extends React.Component { } } - render() { + public render() { let errorText; const err = this.state.errorText; if (err) { diff --git a/src/components/structures/auth/SetupEncryptionBody.tsx b/src/components/structures/auth/SetupEncryptionBody.tsx index 3f2fb26481..a356b548f1 100644 --- a/src/components/structures/auth/SetupEncryptionBody.tsx +++ b/src/components/structures/auth/SetupEncryptionBody.tsx @@ -45,7 +45,7 @@ interface IState { } export default class SetupEncryptionBody extends React.Component { - constructor(props) { + public constructor(props) { super(props); const store = SetupEncryptionStore.sharedInstance(); store.on("update", this.onStoreUpdate); diff --git a/src/components/views/audio_messages/AudioPlayerBase.tsx b/src/components/views/audio_messages/AudioPlayerBase.tsx index 4c078c9d86..c054cca573 100644 --- a/src/components/views/audio_messages/AudioPlayerBase.tsx +++ b/src/components/views/audio_messages/AudioPlayerBase.tsx @@ -42,7 +42,7 @@ export default abstract class AudioPlayerBase extends protected seekRef: RefObject = createRef(); protected playPauseRef: RefObject = createRef(); - constructor(props: T) { + public constructor(props: T) { super(props); // Playback instances can be reused in the composer diff --git a/src/components/views/audio_messages/LiveRecordingClock.tsx b/src/components/views/audio_messages/LiveRecordingClock.tsx index 10005d8b9a..04bc89e4eb 100644 --- a/src/components/views/audio_messages/LiveRecordingClock.tsx +++ b/src/components/views/audio_messages/LiveRecordingClock.tsx @@ -39,14 +39,14 @@ export default class LiveRecordingClock extends React.PureComponent requestAnimationFrame(() => this.scheduledUpdate.trigger()), ); - constructor(props) { + public constructor(props) { super(props); this.state = { seconds: 0, }; } - componentDidMount() { + public componentDidMount() { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { this.seconds = update.timeSeconds; this.scheduledUpdate.mark(); diff --git a/src/components/views/audio_messages/LiveRecordingWaveform.tsx b/src/components/views/audio_messages/LiveRecordingWaveform.tsx index 3a546c2a6d..9cb6d30c36 100644 --- a/src/components/views/audio_messages/LiveRecordingWaveform.tsx +++ b/src/components/views/audio_messages/LiveRecordingWaveform.tsx @@ -44,14 +44,14 @@ export default class LiveRecordingWaveform extends React.PureComponent requestAnimationFrame(() => this.scheduledUpdate.trigger()), ); - constructor(props) { + public constructor(props) { super(props); this.state = { waveform: arraySeed(0, RECORDING_PLAYBACK_SAMPLES), }; } - componentDidMount() { + public componentDidMount() { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { // The incoming data is between zero and one, so we don't need to clamp/rescale it. this.waveform = arrayFastResample(Array.from(update.waveform), RECORDING_PLAYBACK_SAMPLES); diff --git a/src/components/views/audio_messages/SeekBar.tsx b/src/components/views/audio_messages/SeekBar.tsx index 423c1a7ccd..9006016b14 100644 --- a/src/components/views/audio_messages/SeekBar.tsx +++ b/src/components/views/audio_messages/SeekBar.tsx @@ -56,7 +56,7 @@ export default class SeekBar extends React.PureComponent { disabled: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index f7acc67c32..14a2073d27 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -34,14 +34,14 @@ interface ICaptchaFormState { * A pure UI component which displays a captcha form. */ export default class CaptchaForm extends React.Component { - static defaultProps = { + public static defaultProps = { onCaptchaResponse: () => {}, }; private captchaWidgetId?: string; private recaptchaContainer = createRef(); - constructor(props: ICaptchaFormProps) { + public constructor(props: ICaptchaFormProps) { super(props); this.state = { @@ -49,7 +49,7 @@ export default class CaptchaForm extends React.Component{this.state.errorText}
; diff --git a/src/components/views/auth/CountryDropdown.tsx b/src/components/views/auth/CountryDropdown.tsx index 691e49e39a..ae155696c0 100644 --- a/src/components/views/auth/CountryDropdown.tsx +++ b/src/components/views/auth/CountryDropdown.tsx @@ -53,7 +53,7 @@ interface IState { } export default class CountryDropdown extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0]; diff --git a/src/components/views/auth/EmailField.tsx b/src/components/views/auth/EmailField.tsx index 02595e17ca..4af61eaaf0 100644 --- a/src/components/views/auth/EmailField.tsx +++ b/src/components/views/auth/EmailField.tsx @@ -39,7 +39,7 @@ interface IProps extends Omit { } class EmailField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Email"), labelRequired: _td("Enter email address"), labelInvalid: _td("Doesn't look like a valid email address"), @@ -60,7 +60,7 @@ class EmailField extends PureComponent { ], }); - onValidate = async (fieldState: IFieldState) => { + public onValidate = async (fieldState: IFieldState) => { let validate = this.validate; if (this.props.validationRules) { validate = this.props.validationRules; @@ -74,7 +74,7 @@ class EmailField extends PureComponent { return result; }; - render() { + public render() { return ( { - static LOGIN_TYPE = AuthType.Password; + public static LOGIN_TYPE = AuthType.Password; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -108,7 +108,7 @@ export class PasswordAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Recaptcha; + public static LOGIN_TYPE = AuthType.Recaptcha; - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } @@ -207,7 +207,7 @@ export class RecaptchaAuthEntry extends React.Component; } @@ -262,9 +262,9 @@ interface ITermsAuthEntryState { } export class TermsAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Terms; + public static LOGIN_TYPE = AuthType.Terms; - constructor(props) { + public constructor(props) { super(props); // example stageParams: @@ -320,7 +320,7 @@ export class TermsAuthEntry extends React.Component; } @@ -423,9 +423,9 @@ export class EmailIdentityAuthEntry extends React.Component< IEmailIdentityAuthEntryProps, IEmailIdentityAuthEntryState > { - static LOGIN_TYPE = AuthType.Email; + public static LOGIN_TYPE = AuthType.Email; - constructor(props: IEmailIdentityAuthEntryProps) { + public constructor(props: IEmailIdentityAuthEntryProps) { super(props); this.state = { @@ -434,11 +434,11 @@ export class EmailIdentityAuthEntry extends React.Component< }; } - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } - render() { + public render() { let errorSection; // ignore the error when errcode is M_UNAUTHORIZED as we expect that error until the link is clicked. if (this.props.errorText && this.props.errorCode !== "M_UNAUTHORIZED") { @@ -549,13 +549,13 @@ interface IMsisdnAuthEntryState { } export class MsisdnAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Msisdn; + public static LOGIN_TYPE = AuthType.Msisdn; private submitUrl: string; private sid: string; private msisdn: string; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -565,7 +565,7 @@ export class MsisdnAuthEntry extends React.Component; } else { @@ -704,16 +704,16 @@ interface ISSOAuthEntryState { } export class SSOAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Sso; - static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable; + public static LOGIN_TYPE = AuthType.Sso; + public static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable; - static PHASE_PREAUTH = 1; // button to start SSO - static PHASE_POSTAUTH = 2; // button to confirm SSO completed + public static PHASE_PREAUTH = 1; // button to start SSO + public static PHASE_POSTAUTH = 2; // button to confirm SSO completed private ssoUrl: string; private popupWindow: Window; - constructor(props) { + public constructor(props) { super(props); // We actually send the user through fallback auth so we don't have to @@ -729,11 +729,11 @@ export class SSOAuthEntry extends React.Component { private popupWindow: Window; private fallbackButton = createRef(); - constructor(props) { + public constructor(props) { super(props); // we have to make the user click a button, as browsers will block @@ -834,11 +834,11 @@ export class FallbackAuthEntry extends React.Component { window.addEventListener("message", this.onReceiveMessage); } - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } - componentWillUnmount() { + public componentWillUnmount() { window.removeEventListener("message", this.onReceiveMessage); if (this.popupWindow) { this.popupWindow.close(); @@ -865,7 +865,7 @@ export class FallbackAuthEntry extends React.Component { } }; - render() { + public render() { let errorSection; if (this.props.errorText) { errorSection = ( diff --git a/src/components/views/auth/PassphraseConfirmField.tsx b/src/components/views/auth/PassphraseConfirmField.tsx index 38c7c03c77..85aa43d1a1 100644 --- a/src/components/views/auth/PassphraseConfirmField.tsx +++ b/src/components/views/auth/PassphraseConfirmField.tsx @@ -35,7 +35,7 @@ interface IProps extends Omit { } class PassphraseConfirmField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Confirm password"), labelRequired: _td("Confirm password"), labelInvalid: _td("Passwords don't match"), @@ -65,7 +65,7 @@ class PassphraseConfirmField extends PureComponent { return result; }; - render() { + public render() { return ( { } class PassphraseField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Password"), labelEnterPassword: _td("Enter password"), labelStrongPassword: _td("Nice, strong password!"), @@ -94,7 +94,7 @@ class PassphraseField extends PureComponent { ], }); - onValidate = async (fieldState: IFieldState) => { + public onValidate = async (fieldState: IFieldState) => { const result = await this.validate(fieldState); if (this.props.onValidate) { this.props.onValidate(result); @@ -102,7 +102,7 @@ class PassphraseField extends PureComponent { return result; }; - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { onUsernameChanged: function () {}, onUsernameBlur: function () {}, onPhoneCountryChanged: function () {}, @@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent { disableSubmit: false, }; - constructor(props) { + public constructor(props) { super(props); this.state = { // Field error codes by field ID @@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent { } } - render() { + public render() { let forgotPasswordJsx; if (this.props.onForgotPasswordClick) { diff --git a/src/components/views/auth/RegistrationForm.tsx b/src/components/views/auth/RegistrationForm.tsx index 366ff3a1d4..3cb305bea0 100644 --- a/src/components/views/auth/RegistrationForm.tsx +++ b/src/components/views/auth/RegistrationForm.tsx @@ -95,12 +95,12 @@ interface IState { * A pure UI component which displays a registration form. */ export default class RegistrationForm extends React.PureComponent { - static defaultProps = { + public static defaultProps = { onValidationChange: logger.error, canSubmit: true, }; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -468,7 +468,7 @@ export default class RegistrationForm extends React.PureComponent ); diff --git a/src/components/views/avatars/DecoratedRoomAvatar.tsx b/src/components/views/avatars/DecoratedRoomAvatar.tsx index 59618da263..9022ed5881 100644 --- a/src/components/views/avatars/DecoratedRoomAvatar.tsx +++ b/src/components/views/avatars/DecoratedRoomAvatar.tsx @@ -82,7 +82,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent { oobData: {}, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/context_menus/DialpadContextMenu.tsx b/src/components/views/context_menus/DialpadContextMenu.tsx index 8e05532430..1f520cd3d3 100644 --- a/src/components/views/context_menus/DialpadContextMenu.tsx +++ b/src/components/views/context_menus/DialpadContextMenu.tsx @@ -34,7 +34,7 @@ interface IState { export default class DialpadContextMenu extends React.Component { private numberEntryFieldRef: React.RefObject = createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -42,7 +42,7 @@ export default class DialpadContextMenu extends React.Component }; } - onDigitPress = (digit: string, ev: ButtonEvent) => { + public onDigitPress = (digit: string, ev: ButtonEvent) => { this.props.call.sendDtmfDigit(digit); this.setState({ value: this.state.value + digit }); @@ -54,22 +54,22 @@ export default class DialpadContextMenu extends React.Component } }; - onCancelClick = () => { + public onCancelClick = () => { this.props.onFinished(); }; - onKeyDown = (ev) => { + public onKeyDown = (ev) => { // Prevent Backspace and Delete keys from functioning in the entry field if (ev.code === "Backspace" || ev.code === "Delete") { ev.preventDefault(); } }; - onChange = (ev) => { + public onChange = (ev) => { this.setState({ value: ev.target.value }); }; - render() { + public render() { return (
diff --git a/src/components/views/context_menus/GenericElementContextMenu.tsx b/src/components/views/context_menus/GenericElementContextMenu.tsx index 9e90d3dc72..e4b5203acc 100644 --- a/src/components/views/context_menus/GenericElementContextMenu.tsx +++ b/src/components/views/context_menus/GenericElementContextMenu.tsx @@ -29,7 +29,7 @@ interface IProps { * menu. */ export default class GenericElementContextMenu extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/context_menus/LegacyCallContextMenu.tsx b/src/components/views/context_menus/LegacyCallContextMenu.tsx index 49231a7b68..cb97d09537 100644 --- a/src/components/views/context_menus/LegacyCallContextMenu.tsx +++ b/src/components/views/context_menus/LegacyCallContextMenu.tsx @@ -26,27 +26,27 @@ interface IProps extends IContextMenuProps { } export default class LegacyCallContextMenu extends React.Component { - constructor(props) { + public constructor(props) { super(props); } - onHoldClick = () => { + public onHoldClick = () => { this.props.call.setRemoteOnHold(true); this.props.onFinished(); }; - onUnholdClick = () => { + public onUnholdClick = () => { LegacyCallHandler.instance.setActiveCallRoomId(this.props.call.roomId); this.props.onFinished(); }; - onTransferClick = () => { + public onTransferClick = () => { LegacyCallHandler.instance.showTransferDialog(this.props.call); this.props.onFinished(); }; - render() { + public render() { const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold"); const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick; diff --git a/src/components/views/context_menus/MessageContextMenu.tsx b/src/components/views/context_menus/MessageContextMenu.tsx index f0c27defde..ed4c2ab4cb 100644 --- a/src/components/views/context_menus/MessageContextMenu.tsx +++ b/src/components/views/context_menus/MessageContextMenu.tsx @@ -135,12 +135,12 @@ interface IState { } export default class MessageContextMenu extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private reactButtonRef = createRef(); // XXX Ref to a functional component - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/BaseDialog.tsx b/src/components/views/dialogs/BaseDialog.tsx index a3fa9b3362..2eb5234caa 100644 --- a/src/components/views/dialogs/BaseDialog.tsx +++ b/src/components/views/dialogs/BaseDialog.tsx @@ -88,7 +88,7 @@ export default class BaseDialog extends React.Component { fixedWidth: true, }; - constructor(props) { + public constructor(props) { super(props); this.matrixClient = MatrixClientPeg.get(); diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 9f88040c6d..9827f2e7de 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -54,7 +54,7 @@ interface IState { export default class BugReportDialog extends React.Component { private unmounted: boolean; - constructor(props) { + public constructor(props) { super(props); this.state = { sendLogs: true, diff --git a/src/components/views/dialogs/ChangelogDialog.tsx b/src/components/views/dialogs/ChangelogDialog.tsx index 8d5d05e7dc..971a952e9c 100644 --- a/src/components/views/dialogs/ChangelogDialog.tsx +++ b/src/components/views/dialogs/ChangelogDialog.tsx @@ -30,7 +30,7 @@ interface IProps { const REPOS = ["vector-im/element-web", "matrix-org/matrix-react-sdk", "matrix-org/matrix-js-sdk"]; export default class ChangelogDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx index a8947cfebd..51c8b03973 100644 --- a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx @@ -45,7 +45,7 @@ interface IState { * To avoid this, we keep the dialog open as long as /redact is in progress. */ export default class ConfirmAndWaitRedactDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { isRedacting: false, diff --git a/src/components/views/dialogs/ConfirmRedactDialog.tsx b/src/components/views/dialogs/ConfirmRedactDialog.tsx index 29a2e476a4..e1052e8d36 100644 --- a/src/components/views/dialogs/ConfirmRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmRedactDialog.tsx @@ -31,7 +31,7 @@ interface IProps { * A dialog for confirming a redaction. */ export default class ConfirmRedactDialog extends React.Component { - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { danger: false, askReason: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx b/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx index c4796f7e34..86af07c4e2 100644 --- a/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx +++ b/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx @@ -33,7 +33,7 @@ export default class ConfirmWipeDeviceDialog extends React.Component { this.props.onFinished(false); }; - render() { + public render() { return ( { private nameField = createRef(); private aliasField = createRef(); - constructor(props) { + public constructor(props) { super(props); this.supportsRestricted = !!this.props.parentSpace; @@ -124,7 +124,7 @@ export default class CreateRoomDialog extends React.Component { return opts; } - componentDidMount() { + public componentDidMount() { // move focus to first field when showing dialog this.nameField.current.focus(); } @@ -216,7 +216,7 @@ export default class CreateRoomDialog extends React.Component { ], }); - render() { + public render() { const isVideoRoom = this.props.type === RoomType.ElementVideo; let aliasField: JSX.Element; diff --git a/src/components/views/dialogs/DeactivateAccountDialog.tsx b/src/components/views/dialogs/DeactivateAccountDialog.tsx index bb56a440a3..78b7068484 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.tsx +++ b/src/components/views/dialogs/DeactivateAccountDialog.tsx @@ -46,7 +46,7 @@ interface IState { } export default class DeactivateAccountDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { diff --git a/src/components/views/dialogs/EndPollDialog.tsx b/src/components/views/dialogs/EndPollDialog.tsx index e6e190a667..6729cc5d75 100644 --- a/src/components/views/dialogs/EndPollDialog.tsx +++ b/src/components/views/dialogs/EndPollDialog.tsx @@ -59,7 +59,7 @@ export default class EndPollDialog extends React.Component { this.props.onFinished(endPoll); }; - render() { + public render() { return ( = React.createRef(); private readonly config: SnakedObject; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/IncomingSasDialog.tsx b/src/components/views/dialogs/IncomingSasDialog.tsx index 68cb728bf8..097fbd39a8 100644 --- a/src/components/views/dialogs/IncomingSasDialog.tsx +++ b/src/components/views/dialogs/IncomingSasDialog.tsx @@ -56,7 +56,7 @@ interface IState { export default class IncomingSasDialog extends React.Component { private showSasEvent: ISasEvent; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let phase = PHASE_START; diff --git a/src/components/views/dialogs/InfoDialog.tsx b/src/components/views/dialogs/InfoDialog.tsx index 922d1608ae..d88a82f554 100644 --- a/src/components/views/dialogs/InfoDialog.tsx +++ b/src/components/views/dialogs/InfoDialog.tsx @@ -34,7 +34,7 @@ interface IProps extends IDialogProps { } export default class InfoDialog extends React.Component { - static defaultProps = { + public static defaultProps = { title: "", description: "", hasCloseButton: false, @@ -44,7 +44,7 @@ export default class InfoDialog extends React.Component { this.props.onFinished(); }; - render() { + public render() { return ( { - constructor(props: InteractiveAuthDialogProps) { + public constructor(props: InteractiveAuthDialogProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/InviteDialog.tsx b/src/components/views/dialogs/InviteDialog.tsx index 6ed866416b..02dba9091a 100644 --- a/src/components/views/dialogs/InviteDialog.tsx +++ b/src/components/views/dialogs/InviteDialog.tsx @@ -100,7 +100,7 @@ class DMUserTile extends React.PureComponent { this.props.onRemove(this.props.member); }; - render() { + public render() { const avatarSize = 20; const avatar = ; @@ -187,7 +187,7 @@ class DMRoomTile extends React.PureComponent { return result; } - render() { + public render() { let timestamp = null; if (this.props.lastActiveTs) { const humanTs = humanizeTime(this.props.lastActiveTs); @@ -301,7 +301,7 @@ interface IInviteDialogState { } export default class InviteDialog extends React.PureComponent { - static defaultProps = { + public static defaultProps = { kind: KIND_DM, initialText: "", }; @@ -311,7 +311,7 @@ export default class InviteDialog extends React.PureComponent = createRef(); private unmounted = false; - constructor(props) { + public constructor(props) { super(props); if (props.kind === KIND_INVITE && !props.roomId) { @@ -351,13 +351,13 @@ export default class InviteDialog extends React.PureComponent; diff --git a/src/components/views/dialogs/LogoutDialog.tsx b/src/components/views/dialogs/LogoutDialog.tsx index 3f321e18da..9a22121c3b 100644 --- a/src/components/views/dialogs/LogoutDialog.tsx +++ b/src/components/views/dialogs/LogoutDialog.tsx @@ -41,11 +41,11 @@ interface IState { } export default class LogoutDialog extends React.Component { - static defaultProps = { + public static defaultProps = { onFinished: function () {}, }; - constructor(props) { + public constructor(props) { super(props); const cli = MatrixClientPeg.get(); @@ -127,7 +127,7 @@ export default class LogoutDialog extends React.Component { this.props.onFinished(true); }; - render() { + public render() { if (this.state.shouldLoadBackupStatus) { const description = (
diff --git a/src/components/views/dialogs/MessageEditHistoryDialog.tsx b/src/components/views/dialogs/MessageEditHistoryDialog.tsx index f3e25fd921..943e7f58d2 100644 --- a/src/components/views/dialogs/MessageEditHistoryDialog.tsx +++ b/src/components/views/dialogs/MessageEditHistoryDialog.tsx @@ -48,7 +48,7 @@ interface IState { } export default class MessageEditHistoryDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { originalEvent: null, diff --git a/src/components/views/dialogs/ModalWidgetDialog.tsx b/src/components/views/dialogs/ModalWidgetDialog.tsx index 92a447532f..a91f617cbb 100644 --- a/src/components/views/dialogs/ModalWidgetDialog.tsx +++ b/src/components/views/dialogs/ModalWidgetDialog.tsx @@ -61,11 +61,11 @@ export default class ModalWidgetDialog extends React.PureComponent = React.createRef(); - state: IState = { + public state: IState = { disabledButtonIds: (this.props.widgetDefinition.buttons || []).filter((b) => b.disabled).map((b) => b.id), }; - constructor(props) { + public constructor(props) { super(props); this.widget = new ElementWidget({ diff --git a/src/components/views/dialogs/ReportEventDialog.tsx b/src/components/views/dialogs/ReportEventDialog.tsx index 3e4cde9d99..77640c2732 100644 --- a/src/components/views/dialogs/ReportEventDialog.tsx +++ b/src/components/views/dialogs/ReportEventDialog.tsx @@ -96,7 +96,7 @@ export default class ReportEventDialog extends React.Component { // If the room supports moderation, the moderation information. private moderation?: Moderation; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let moderatedByRoomId = null; diff --git a/src/components/views/dialogs/RoomSettingsDialog.tsx b/src/components/views/dialogs/RoomSettingsDialog.tsx index 35519a2bec..a10d54f4d0 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.tsx +++ b/src/components/views/dialogs/RoomSettingsDialog.tsx @@ -55,7 +55,7 @@ interface IState { export default class RoomSettingsDialog extends React.Component { private dispatcherRef: string; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { roomName: "" }; } @@ -180,7 +180,7 @@ export default class RoomSettingsDialog extends React.Component return tabs; } - render() { + public render() { const roomName = this.state.roomName; return ( { private targetVersion: string; - state = { + public state = { busy: true, }; - async componentDidMount() { + public async componentDidMount() { const recommended = await this.props.room.getRecommendedVersion(); this.targetVersion = recommended.version; this.setState({ busy: false }); @@ -68,7 +68,7 @@ export default class RoomUpgradeDialog extends React.Component { }); }; - render() { + public render() { let buttons; if (this.state.busy) { buttons = ; diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx b/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx index 6f5391d8b7..0fd44dfbcf 100644 --- a/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx +++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx @@ -53,7 +53,7 @@ export default class RoomUpgradeWarningDialog extends React.Component(); private validatedConf: ValidatedServerConfig; - constructor(props) { + public constructor(props) { super(props); const config = SdkConfig.get(); diff --git a/src/components/views/dialogs/SeshatResetDialog.tsx b/src/components/views/dialogs/SeshatResetDialog.tsx index f075ae7b19..caa243c340 100644 --- a/src/components/views/dialogs/SeshatResetDialog.tsx +++ b/src/components/views/dialogs/SeshatResetDialog.tsx @@ -22,7 +22,7 @@ import DialogButtons from "../elements/DialogButtons"; import { IDialogProps } from "./IDialogProps"; export default class SeshatResetDialog extends React.PureComponent { - render() { + public render() { return ( { private addThreepid: AddThreepid; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/ShareDialog.tsx b/src/components/views/dialogs/ShareDialog.tsx index 683e90a73b..05e25a9d15 100644 --- a/src/components/views/dialogs/ShareDialog.tsx +++ b/src/components/views/dialogs/ShareDialog.tsx @@ -75,7 +75,7 @@ interface IState { } export default class ShareDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); let permalinkCreator: RoomPermalinkCreator = null; @@ -91,7 +91,7 @@ export default class ShareDialog extends React.PureComponent { }; } - static onLinkClick(e) { + public static onLinkClick(e) { e.preventDefault(); selectText(e.target); } @@ -124,7 +124,7 @@ export default class ShareDialog extends React.PureComponent { return matrixToUrl; } - render() { + public render() { let title; let checkbox; diff --git a/src/components/views/dialogs/TermsDialog.tsx b/src/components/views/dialogs/TermsDialog.tsx index e69587aef1..078aaa10db 100644 --- a/src/components/views/dialogs/TermsDialog.tsx +++ b/src/components/views/dialogs/TermsDialog.tsx @@ -33,7 +33,7 @@ class TermsCheckbox extends React.PureComponent { this.props.onChange(this.props.url, ev.currentTarget.checked); }; - render() { + public render() { return ; } } @@ -63,7 +63,7 @@ interface IState { } export default class TermsDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { // url -> boolean diff --git a/src/components/views/dialogs/TextInputDialog.tsx b/src/components/views/dialogs/TextInputDialog.tsx index bf812a24f8..da9a2c4f58 100644 --- a/src/components/views/dialogs/TextInputDialog.tsx +++ b/src/components/views/dialogs/TextInputDialog.tsx @@ -54,7 +54,7 @@ export default class TextInputDialog extends React.Component { hasCancel: true, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/UploadConfirmDialog.tsx b/src/components/views/dialogs/UploadConfirmDialog.tsx index aeaf85bbbb..309638e786 100644 --- a/src/components/views/dialogs/UploadConfirmDialog.tsx +++ b/src/components/views/dialogs/UploadConfirmDialog.tsx @@ -35,11 +35,11 @@ export default class UploadConfirmDialog extends React.Component { private readonly objectUrl: string; private readonly mimeType: string; - static defaultProps = { + public static defaultProps = { totalFiles: 1, }; - constructor(props) { + public constructor(props) { super(props); // Create a fresh `Blob` for previewing (even though `File` already is @@ -49,7 +49,7 @@ export default class UploadConfirmDialog extends React.Component { this.objectUrl = URL.createObjectURL(blob); } - componentWillUnmount() { + public componentWillUnmount() { if (this.objectUrl) URL.revokeObjectURL(this.objectUrl); } @@ -65,7 +65,7 @@ export default class UploadConfirmDialog extends React.Component { this.props.onFinished(true, true); }; - render() { + public render() { let title: string; if (this.props.totalFiles > 1 && this.props.currentIndex !== undefined) { title = _t("Upload files (%(current)s of %(total)s)", { diff --git a/src/components/views/dialogs/UserSettingsDialog.tsx b/src/components/views/dialogs/UserSettingsDialog.tsx index c7b0de80ab..6f1531e15d 100644 --- a/src/components/views/dialogs/UserSettingsDialog.tsx +++ b/src/components/views/dialogs/UserSettingsDialog.tsx @@ -50,7 +50,7 @@ interface IState { export default class UserSettingsDialog extends React.Component { private settingsWatchers: string[] = []; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -210,7 +210,7 @@ export default class UserSettingsDialog extends React.Component return tabs; } - render() { + public render() { return ( { - constructor(props) { + public constructor(props) { super(props); this.state = { verificationRequest: this.props.verificationRequest, @@ -47,7 +47,7 @@ export default class VerificationRequestDialog extends React.Component { private eventPermissionsMap = new Map(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const parsedEvents = WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities); diff --git a/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx b/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx index 68c4342e8b..f33e392443 100644 --- a/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx +++ b/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx @@ -38,7 +38,7 @@ interface IState { } export default class WidgetOpenIDPermissionsDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx index 586ce4a662..0461aba408 100644 --- a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx +++ b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx @@ -62,7 +62,7 @@ interface IState { export default class AccessSecretStorageDialog extends React.PureComponent { private fileUpload = React.createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -268,7 +268,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -167,7 +167,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent { - static defaultProps = { + public static defaultProps = { showSummary: true, }; - constructor(props) { + public constructor(props) { super(props); this.state = { backupInfo: null, diff --git a/src/components/views/dialogs/security/SetupEncryptionDialog.tsx b/src/components/views/dialogs/security/SetupEncryptionDialog.tsx index 0be9544261..01f2a7045c 100644 --- a/src/components/views/dialogs/security/SetupEncryptionDialog.tsx +++ b/src/components/views/dialogs/security/SetupEncryptionDialog.tsx @@ -38,7 +38,7 @@ interface IState { export default class SetupEncryptionDialog extends React.Component { private store: SetupEncryptionStore; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.store = SetupEncryptionStore.sharedInstance(); diff --git a/src/components/views/elements/AccessibleTooltipButton.tsx b/src/components/views/elements/AccessibleTooltipButton.tsx index ce1d2ca69f..4c4c710465 100644 --- a/src/components/views/elements/AccessibleTooltipButton.tsx +++ b/src/components/views/elements/AccessibleTooltipButton.tsx @@ -36,14 +36,14 @@ interface IState { } export default class AccessibleTooltipButton extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { hover: false, }; } - componentDidUpdate(prevProps: Readonly) { + public componentDidUpdate(prevProps: Readonly) { if (!prevProps.forceHide && this.props.forceHide && this.state.hover) { this.setState({ hover: false, @@ -73,7 +73,7 @@ export default class AccessibleTooltipButton extends React.PureComponent { - static defaultProps: Partial = { + public static defaultProps: Partial = { onPermissionGranted: () => {}, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // The first step is to pick apart the widget so we can render information about it @@ -88,7 +88,7 @@ export default class AppPermission extends React.Component { } } - render() { + public render() { const brand = SdkConfig.get().brand; const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId; diff --git a/src/components/views/elements/AppTile.tsx b/src/components/views/elements/AppTile.tsx index d9abe52e42..bb44a2940e 100644 --- a/src/components/views/elements/AppTile.tsx +++ b/src/components/views/elements/AppTile.tsx @@ -104,7 +104,7 @@ interface IState { export default class AppTile extends React.Component { public static contextType = MatrixClientContext; - context: ContextType; + public context: ContextType; public static defaultProps: Partial = { waitForIframeLoad: true, @@ -126,7 +126,7 @@ export default class AppTile extends React.Component { private dispatcherRef: string; private unmounted: boolean; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // Tiles in miniMode are floating, and therefore not docked diff --git a/src/components/views/elements/DesktopCapturerSourcePicker.tsx b/src/components/views/elements/DesktopCapturerSourcePicker.tsx index c372eb2a36..c93701cd91 100644 --- a/src/components/views/elements/DesktopCapturerSourcePicker.tsx +++ b/src/components/views/elements/DesktopCapturerSourcePicker.tsx @@ -47,7 +47,7 @@ export interface ExistingSourceIProps { } export class ExistingSource extends React.Component { - constructor(props: ExistingSourceIProps) { + public constructor(props: ExistingSourceIProps) { super(props); } @@ -55,7 +55,7 @@ export class ExistingSource extends React.Component { this.props.onSelect(this.props.source); }; - render() { + public render() { const thumbnailClasses = classNames({ mx_desktopCapturerSourcePicker_source_thumbnail: true, mx_desktopCapturerSourcePicker_source_thumbnail_selected: this.props.selected, @@ -84,9 +84,9 @@ export interface PickerIProps { } export default class DesktopCapturerSourcePicker extends React.Component { - interval: number; + public interval: number; - constructor(props: PickerIProps) { + public constructor(props: PickerIProps) { super(props); this.state = { @@ -96,7 +96,7 @@ export default class DesktopCapturerSourcePicker extends React.Component{sources}
); } - render() { + public render() { const tabs = [ this.getTab("screen", _t("Share entire screen")), this.getTab("window", _t("Application window")), diff --git a/src/components/views/elements/DialPadBackspaceButton.tsx b/src/components/views/elements/DialPadBackspaceButton.tsx index 4e40cfa906..d877cfde50 100644 --- a/src/components/views/elements/DialPadBackspaceButton.tsx +++ b/src/components/views/elements/DialPadBackspaceButton.tsx @@ -25,7 +25,7 @@ interface IProps { } export default class DialPadBackspaceButton extends React.PureComponent { - render() { + public render() { return (
{ - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -73,7 +73,7 @@ export default class Draggable extends React.Component { }); } - render() { + public render() { return
; } } diff --git a/src/components/views/elements/Dropdown.tsx b/src/components/views/elements/Dropdown.tsx index 960c4387cd..82348dd793 100644 --- a/src/components/views/elements/Dropdown.tsx +++ b/src/components/views/elements/Dropdown.tsx @@ -35,7 +35,7 @@ interface IMenuOptionProps { } class MenuOption extends React.Component { - static defaultProps = { + public static defaultProps = { disabled: false, }; @@ -49,7 +49,7 @@ class MenuOption extends React.Component { this.props.onClick(this.props.dropdownKey); }; - render() { + public render() { const optClasses = classnames({ mx_Dropdown_option: true, mx_Dropdown_option_highlight: this.props.highlighted, @@ -117,7 +117,7 @@ export default class Dropdown extends React.Component { private ignoreEvent: MouseEvent = null; private childrenByKey: Record = {}; - constructor(props: DropdownProps) { + public constructor(props: DropdownProps) { super(props); this.reindexChildren(this.props.children); @@ -149,7 +149,7 @@ export default class Dropdown extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("click", this.onDocumentClick, false); } @@ -327,7 +327,7 @@ export default class Dropdown extends React.Component { return options; } - render() { + public render() { let currentValue; const menuStyle: CSSProperties = {}; diff --git a/src/components/views/elements/EditableItemList.tsx b/src/components/views/elements/EditableItemList.tsx index 140707dcf2..40b1a62ab6 100644 --- a/src/components/views/elements/EditableItemList.tsx +++ b/src/components/views/elements/EditableItemList.tsx @@ -57,7 +57,7 @@ export class EditableItem extends React.Component { this.setState({ verifyRemove: false }); }; - render() { + public render() { if (this.state.verifyRemove) { return (
@@ -148,7 +148,7 @@ export default class EditableItemList

extends React.PureComponent { if (!this.props.canRemove) { return

  • {item}
  • ; diff --git a/src/components/views/elements/EditableText.tsx b/src/components/views/elements/EditableText.tsx index b850a76a4a..89d4220bca 100644 --- a/src/components/views/elements/EditableText.tsx +++ b/src/components/views/elements/EditableText.tsx @@ -62,7 +62,7 @@ export default class EditableText extends React.Component { blurToSubmit: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/EditableTextContainer.tsx b/src/components/views/elements/EditableTextContainer.tsx index 1487ab4532..1468b24e54 100644 --- a/src/components/views/elements/EditableTextContainer.tsx +++ b/src/components/views/elements/EditableTextContainer.tsx @@ -66,7 +66,7 @@ export default class EditableTextContainer extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -42,13 +42,13 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> { }; } - static getDerivedStateFromError(error: Error): Partial { + public static getDerivedStateFromError(error: Error): Partial { // Side effects are not permitted here, so we only update the state so // that the next render shows an error message. return { error }; } - componentDidCatch(error: Error, { componentStack }: ErrorInfo): void { + public componentDidCatch(error: Error, { componentStack }: ErrorInfo): void { // Browser consoles are better at formatting output when native errors are passed // in their own `console.error` invocation. logger.error(error); @@ -73,7 +73,7 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> { }); }; - render() { + public render() { if (this.state.error) { const newIssueUrl = "https://github.com/vector-im/element-web/issues/new/choose"; diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index 715f08ad57..7294059bae 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -79,17 +79,17 @@ enum TransitionType { const SEP = ","; export default class EventListSummary extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; - static defaultProps = { + public static defaultProps = { summaryLength: 1, threshold: 3, avatarsMaxLength: 5, layout: Layout.Group, }; - shouldComponentUpdate(nextProps: IProps): boolean { + public shouldComponentUpdate(nextProps: IProps): boolean { // Update if // - The number of summarised events has changed // - or if the summary is about to toggle to become collapsed @@ -451,7 +451,7 @@ export default class EventListSummary extends React.Component { } } - getAggregate(userEvents: Record) { + public getAggregate(userEvents: Record) { // A map of aggregate type to arrays of display names. Each aggregate type // is a comma-delimited string of transitions, e.g. "joined,left,kicked". // The array of display names is the array of users who went through that @@ -489,7 +489,7 @@ export default class EventListSummary extends React.Component { }; } - render() { + public render() { const eventsToRender = this.props.events; // Map user IDs to latest Avatar Member. ES6 Maps are ordered by when the key was created, diff --git a/src/components/views/elements/EventTilePreview.tsx b/src/components/views/elements/EventTilePreview.tsx index a492a60e8d..828680b870 100644 --- a/src/components/views/elements/EventTilePreview.tsx +++ b/src/components/views/elements/EventTilePreview.tsx @@ -63,7 +63,7 @@ interface IState { const AVATAR_SIZE = 32; export default class EventTilePreview extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { message: props.message, diff --git a/src/components/views/elements/Field.tsx b/src/components/views/elements/Field.tsx index 1a43003232..31a6e88897 100644 --- a/src/components/views/elements/Field.tsx +++ b/src/components/views/elements/Field.tsx @@ -145,7 +145,7 @@ export default class Field extends React.PureComponent { }); }, VALIDATION_THROTTLE_MS); - constructor(props) { + public constructor(props) { super(props); this.state = { valid: undefined, diff --git a/src/components/views/elements/IRCTimelineProfileResizer.tsx b/src/components/views/elements/IRCTimelineProfileResizer.tsx index 8eb87837a7..5c941be955 100644 --- a/src/components/views/elements/IRCTimelineProfileResizer.tsx +++ b/src/components/views/elements/IRCTimelineProfileResizer.tsx @@ -33,7 +33,7 @@ interface IState { } export default class IRCTimelineProfileResizer extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -42,7 +42,7 @@ export default class IRCTimelineProfileResizer extends React.Component; } } diff --git a/src/components/views/elements/ImageView.tsx b/src/components/views/elements/ImageView.tsx index 227082cea8..4c8e6e5bcd 100644 --- a/src/components/views/elements/ImageView.tsx +++ b/src/components/views/elements/ImageView.tsx @@ -91,7 +91,7 @@ interface IState { } export default class ImageView extends React.Component { - constructor(props) { + public constructor(props) { super(props); const { thumbnailInfo } = this.props; @@ -126,7 +126,7 @@ export default class ImageView extends React.Component { private animatingLoading = false; private imageIsLoaded = false; - componentDidMount() { + public componentDidMount() { // We have to use addEventListener() because the listener // needs to be passive in order to work with Chromium this.focusLock.current.addEventListener("wheel", this.onWheel, { passive: false }); @@ -136,7 +136,7 @@ export default class ImageView extends React.Component { this.image.current.addEventListener("load", this.imageLoaded); } - componentWillUnmount() { + public componentWillUnmount() { this.focusLock.current.removeEventListener("wheel", this.onWheel); window.removeEventListener("resize", this.recalculateZoom); this.image.current.removeEventListener("load", this.imageLoaded); @@ -411,7 +411,7 @@ export default class ImageView extends React.Component { return {contextMenu}; } - render() { + public render() { const showEventMeta = !!this.props.mxEvent; let transitionClassName; diff --git a/src/components/views/elements/InfoTooltip.tsx b/src/components/views/elements/InfoTooltip.tsx index 3808b249a3..818781bff4 100644 --- a/src/components/views/elements/InfoTooltip.tsx +++ b/src/components/views/elements/InfoTooltip.tsx @@ -35,11 +35,11 @@ interface ITooltipProps { } export default class InfoTooltip extends React.PureComponent { - constructor(props: ITooltipProps) { + public constructor(props: ITooltipProps) { super(props); } - render() { + public render() { const { tooltip, children, tooltipClassName, className, kind } = this.props; const title = _t("Information"); const iconClassName = diff --git a/src/components/views/elements/InlineSpinner.tsx b/src/components/views/elements/InlineSpinner.tsx index a3f31def28..398144a5be 100644 --- a/src/components/views/elements/InlineSpinner.tsx +++ b/src/components/views/elements/InlineSpinner.tsx @@ -25,12 +25,12 @@ interface IProps { } export default class InlineSpinner extends React.PureComponent { - static defaultProps = { + public static defaultProps = { w: 16, h: 16, }; - render() { + public render() { return (
    side: Direction.Top, }; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -317,7 +317,7 @@ export default class InteractiveTooltip extends React.Component }; } - componentDidUpdate() { + public componentDidUpdate() { // Whenever this passthrough component updates, also render the tooltip // in a separate DOM tree. This allows the tooltip content to participate // the normal React rendering cycle: when this component re-renders, the @@ -327,7 +327,7 @@ export default class InteractiveTooltip extends React.Component this.renderTooltip(); } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("mousemove", this.onMouseMove); } @@ -486,7 +486,7 @@ export default class InteractiveTooltip extends React.Component ReactDOM.render(tooltip, getOrCreateContainer()); } - render() { + public render() { return this.props.children({ ref: this.collectTarget, onMouseOver: this.onTargetMouseOver, diff --git a/src/components/views/elements/InviteReason.tsx b/src/components/views/elements/InviteReason.tsx index c3f676786f..5307bfc940 100644 --- a/src/components/views/elements/InviteReason.tsx +++ b/src/components/views/elements/InviteReason.tsx @@ -30,7 +30,7 @@ interface IState { } export default class InviteReason extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { // We hide the reason for invitation by default, since it can be a @@ -39,13 +39,13 @@ export default class InviteReason extends React.PureComponent { }; } - onViewClick = () => { + public onViewClick = () => { this.setState({ hidden: false, }); }; - render() { + public render() { const classes = classNames({ mx_InviteReason: true, mx_InviteReason_hidden: this.state.hidden, diff --git a/src/components/views/elements/LanguageDropdown.tsx b/src/components/views/elements/LanguageDropdown.tsx index 7023fcaeaf..35697c53e4 100644 --- a/src/components/views/elements/LanguageDropdown.tsx +++ b/src/components/views/elements/LanguageDropdown.tsx @@ -42,7 +42,7 @@ interface IState { } export default class LanguageDropdown extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/LazyRenderList.tsx b/src/components/views/elements/LazyRenderList.tsx index 71071c8709..492cff95c9 100644 --- a/src/components/views/elements/LazyRenderList.tsx +++ b/src/components/views/elements/LazyRenderList.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; class ItemRange { - constructor(public topCount: number, public renderCount: number, public bottomCount: number) {} + public constructor(public topCount: number, public renderCount: number, public bottomCount: number) {} public contains(range: ItemRange): boolean { // don't contain empty ranges @@ -85,7 +85,7 @@ export default class LazyRenderList extends React.Component, overflowMargin: 5, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/LinkWithTooltip.tsx b/src/components/views/elements/LinkWithTooltip.tsx index dd14eb505a..d682f34e46 100644 --- a/src/components/views/elements/LinkWithTooltip.tsx +++ b/src/components/views/elements/LinkWithTooltip.tsx @@ -21,7 +21,7 @@ import TextWithTooltip from "./TextWithTooltip"; interface IProps extends Omit, "tabIndex" | "onClick"> {} export default class LinkWithTooltip extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/elements/Measured.tsx b/src/components/views/elements/Measured.tsx index 903cec7921..1c27150510 100644 --- a/src/components/views/elements/Measured.tsx +++ b/src/components/views/elements/Measured.tsx @@ -28,21 +28,21 @@ export default class Measured extends React.PureComponent { private static instanceCount = 0; private readonly instanceId: number; - static defaultProps = { + public static defaultProps = { breakpoint: 500, }; - constructor(props) { + public constructor(props) { super(props); this.instanceId = Measured.instanceCount++; } - componentDidMount() { + public componentDidMount() { UIStore.instance.on(`Measured${this.instanceId}`, this.onResize); } - componentDidUpdate(prevProps: Readonly) { + public componentDidUpdate(prevProps: Readonly) { const previous = prevProps.sensor; const current = this.props.sensor; if (previous === current) return; @@ -54,7 +54,7 @@ export default class Measured extends React.PureComponent { } } - componentWillUnmount() { + public componentWillUnmount() { UIStore.instance.off(`Measured${this.instanceId}`, this.onResize); UIStore.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`); } @@ -64,7 +64,7 @@ export default class Measured extends React.PureComponent { this.props.onMeasurement(entry.contentRect.width <= this.props.breakpoint); }; - render() { + public render() { return null; } } diff --git a/src/components/views/elements/PersistedElement.tsx b/src/components/views/elements/PersistedElement.tsx index e1613e57c0..cfe5f24f96 100644 --- a/src/components/views/elements/PersistedElement.tsx +++ b/src/components/views/elements/PersistedElement.tsx @@ -78,7 +78,7 @@ export default class PersistedElement extends React.Component { private childContainer: HTMLDivElement; private child: HTMLDivElement; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.resizeObserver = new ResizeObserver(this.repositionChild); @@ -107,7 +107,7 @@ export default class PersistedElement extends React.Component { } } - static isMounted(persistKey) { + public static isMounted(persistKey) { return Boolean(getContainer("mx_persistedElement_" + persistKey)); } diff --git a/src/components/views/elements/PersistentApp.tsx b/src/components/views/elements/PersistentApp.tsx index 3a85b32d44..fc24b2b8c6 100644 --- a/src/components/views/elements/PersistentApp.tsx +++ b/src/components/views/elements/PersistentApp.tsx @@ -32,10 +32,10 @@ interface IProps { export default class PersistentApp extends React.Component { public static contextType = MatrixClientContext; - context: ContextType; + public context: ContextType; private room: Room; - constructor(props: IProps, context: ContextType) { + public constructor(props: IProps, context: ContextType) { super(props, context); this.room = context.getRoom(this.props.persistentRoomId)!; } diff --git a/src/components/views/elements/Pill.tsx b/src/components/views/elements/Pill.tsx index 3c18cb1b3e..8107560c05 100644 --- a/src/components/views/elements/Pill.tsx +++ b/src/components/views/elements/Pill.tsx @@ -75,7 +75,7 @@ export default class Pill extends React.Component { return "@room".length; } - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/PollCreateDialog.tsx b/src/components/views/elements/PollCreateDialog.tsx index 3889fa1f1f..3d987c3d96 100644 --- a/src/components/views/elements/PollCreateDialog.tsx +++ b/src/components/views/elements/PollCreateDialog.tsx @@ -256,7 +256,7 @@ export default class PollCreateDialog extends ScrollableBaseModal) => { + public onPollTypeChange = (e: ChangeEvent) => { this.setState({ kind: M_POLL_KIND_DISCLOSED.matches(e.target.value) ? M_POLL_KIND_DISCLOSED : M_POLL_KIND_UNDISCLOSED, }); diff --git a/src/components/views/elements/PowerSelector.tsx b/src/components/views/elements/PowerSelector.tsx index c6b42462ef..74fc35be9e 100644 --- a/src/components/views/elements/PowerSelector.tsx +++ b/src/components/views/elements/PowerSelector.tsx @@ -60,7 +60,7 @@ export default class PowerSelector extends React.Component { usersDefault: 0, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/ReplyChain.tsx b/src/components/views/elements/ReplyChain.tsx index 9168426fbf..f0b6f48b7a 100644 --- a/src/components/views/elements/ReplyChain.tsx +++ b/src/components/views/elements/ReplyChain.tsx @@ -74,14 +74,14 @@ interface IState { // craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would // be low as each event being loaded (after the first) is triggered by an explicit user action. export default class ReplyChain extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private unmounted = false; private room: Room; private blockquoteRef = React.createRef(); - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); this.state = { @@ -98,17 +98,17 @@ export default class ReplyChain extends React.Component { return MatrixClientPeg.get(); } - componentDidMount() { + public componentDidMount() { this.initialize(); this.trySetExpandableQuotes(); } - componentDidUpdate() { + public componentDidUpdate() { this.props.onHeightChanged(); this.trySetExpandableQuotes(); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -199,7 +199,7 @@ export default class ReplyChain extends React.Component { return getUserNameColorClass(ev.getSender()).replace("Username", "ReplyChain"); } - render() { + public render() { let header = null; if (this.state.err) { header = ( diff --git a/src/components/views/elements/RoomAliasField.tsx b/src/components/views/elements/RoomAliasField.tsx index e31daf32aa..d894fb1e0d 100644 --- a/src/components/views/elements/RoomAliasField.tsx +++ b/src/components/views/elements/RoomAliasField.tsx @@ -39,12 +39,12 @@ interface IState { // Controlled form component wrapping Field for inputting a room alias scoped to a given domain export default class RoomAliasField extends React.PureComponent { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; private fieldRef = createRef(); - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -72,7 +72,7 @@ export default class RoomAliasField extends React.PureComponent return { prefix, postfix, value, maxlength }; } - render() { + public render() { const { prefix, postfix, value, maxlength } = this.domainProps; return ( { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/Slider.tsx b/src/components/views/elements/Slider.tsx index 0e1a0b32a4..ab34e114ba 100644 --- a/src/components/views/elements/Slider.tsx +++ b/src/components/views/elements/Slider.tsx @@ -70,7 +70,7 @@ export default class Slider extends React.Component { return 100 * (closest - 1 + linearInterpolation) * intervalWidth; } - render(): React.ReactNode { + public render(): React.ReactNode { const dots = this.props.values.map((v) => ( { ); } - onClick(event: React.MouseEvent) { + public onClick(event: React.MouseEvent) { const width = (event.target as HTMLElement).clientWidth; // nativeEvent is safe to use because https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX // is supported by all modern browsers @@ -133,7 +133,7 @@ interface IDotProps { } class Dot extends React.PureComponent { - render(): React.ReactNode { + public render(): React.ReactNode { let className = "mx_Slider_dot"; if (!this.props.disabled && this.props.active) { className += " mx_Slider_dotActive"; diff --git a/src/components/views/elements/SpellCheckLanguagesDropdown.tsx b/src/components/views/elements/SpellCheckLanguagesDropdown.tsx index e9f75da21e..026b7e3409 100644 --- a/src/components/views/elements/SpellCheckLanguagesDropdown.tsx +++ b/src/components/views/elements/SpellCheckLanguagesDropdown.tsx @@ -43,7 +43,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< SpellCheckLanguagesDropdownIProps, SpellCheckLanguagesDropdownIState > { - constructor(props) { + public constructor(props) { super(props); this.onSearchChange = this.onSearchChange.bind(this); @@ -53,7 +53,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< }; } - componentDidMount() { + public componentDidMount() { const plaf = PlatformPeg.get(); if (plaf) { plaf.getAvailableSpellCheckLanguages() @@ -82,7 +82,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< this.setState({ searchQuery }); } - render() { + public render() { if (this.state.languages === null) { return ; } diff --git a/src/components/views/elements/Spoiler.tsx b/src/components/views/elements/Spoiler.tsx index cb41ddef22..839272451b 100644 --- a/src/components/views/elements/Spoiler.tsx +++ b/src/components/views/elements/Spoiler.tsx @@ -26,7 +26,7 @@ interface IState { } export default class Spoiler extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { visible: false, diff --git a/src/components/views/elements/StyledCheckbox.tsx b/src/components/views/elements/StyledCheckbox.tsx index 33328275cb..56ba1faefe 100644 --- a/src/components/views/elements/StyledCheckbox.tsx +++ b/src/components/views/elements/StyledCheckbox.tsx @@ -38,7 +38,7 @@ export default class StyledCheckbox extends React.PureComponent className: "", }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // 56^10 so unlikely chance of collision. this.id = this.props.id || "checkbox_" + randomString(10); diff --git a/src/components/views/elements/TextWithTooltip.tsx b/src/components/views/elements/TextWithTooltip.tsx index bbcbcd58a5..f009f8c526 100644 --- a/src/components/views/elements/TextWithTooltip.tsx +++ b/src/components/views/elements/TextWithTooltip.tsx @@ -28,7 +28,7 @@ interface IProps extends HTMLAttributes { } export default class TextWithTooltip extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/elements/Tooltip.tsx b/src/components/views/elements/Tooltip.tsx index c08983def4..1bb9ab66bf 100644 --- a/src/components/views/elements/Tooltip.tsx +++ b/src/components/views/elements/Tooltip.tsx @@ -68,7 +68,7 @@ export default class Tooltip extends React.PureComponent { alignment: Alignment.Natural, }; - constructor(props) { + public constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/elements/TooltipButton.tsx b/src/components/views/elements/TooltipButton.tsx index 7fdaabd8fe..1c5fb08bf2 100644 --- a/src/components/views/elements/TooltipButton.tsx +++ b/src/components/views/elements/TooltipButton.tsx @@ -24,11 +24,11 @@ interface IProps { } export default class TooltipButton extends React.Component { - constructor(props) { + public constructor(props) { super(props); } - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { truncateAt: 2, createOverflowElement(overflowCount, totalCount) { return
    {_t("And %(count)s more...", { count: overflowCount })}
    ; diff --git a/src/components/views/emojipicker/Category.tsx b/src/components/views/emojipicker/Category.tsx index 6157d366f0..8ecbd6e913 100644 --- a/src/components/views/emojipicker/Category.tsx +++ b/src/components/views/emojipicker/Category.tsx @@ -69,7 +69,7 @@ class Category extends React.PureComponent { ); }; - render() { + public render() { const { emojis, name, heightBefore, viewportHeight, scrollTop } = this.props; if (!emojis || emojis.length === 0) { return null; diff --git a/src/components/views/emojipicker/Emoji.tsx b/src/components/views/emojipicker/Emoji.tsx index 19cdc05126..7ae00ae50d 100644 --- a/src/components/views/emojipicker/Emoji.tsx +++ b/src/components/views/emojipicker/Emoji.tsx @@ -30,7 +30,7 @@ interface IProps { } class Emoji extends React.PureComponent { - render() { + public render() { const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props; const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode); return ( diff --git a/src/components/views/emojipicker/EmojiPicker.tsx b/src/components/views/emojipicker/EmojiPicker.tsx index 76857012c4..320f0f185e 100644 --- a/src/components/views/emojipicker/EmojiPicker.tsx +++ b/src/components/views/emojipicker/EmojiPicker.tsx @@ -57,7 +57,7 @@ class EmojiPicker extends React.Component { private scrollRef = React.createRef>(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -249,7 +249,7 @@ class EmojiPicker extends React.Component { return CATEGORY_HEADER_HEIGHT + Math.ceil(count / EMOJIS_PER_ROW) * EMOJI_HEIGHT; } - render() { + public render() { let heightBefore = 0; return (
    diff --git a/src/components/views/emojipicker/Header.tsx b/src/components/views/emojipicker/Header.tsx index a203397eea..83c0eeb932 100644 --- a/src/components/views/emojipicker/Header.tsx +++ b/src/components/views/emojipicker/Header.tsx @@ -82,7 +82,7 @@ class Header extends React.PureComponent { } }; - render() { + public render() { return (