From 450140befd77258d3190fa0a0a6999f05739a553 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Wed, 25 Aug 2021 09:34:16 +0100 Subject: [PATCH] Fix linting issues --- .eslintrc.js | 5 +++++ src/components/structures/RoomDirectory.tsx | 2 +- src/components/views/avatars/MemberAvatar.tsx | 1 + src/components/views/right_panel/UserInfo.tsx | 2 +- src/components/views/rooms/ReadReceiptMarker.tsx | 8 ++++---- src/components/views/rooms/RoomDetailList.tsx | 2 +- src/components/views/rooms/RoomHeader.tsx | 2 +- src/components/views/settings/DevicesPanel.tsx | 10 ++++------ 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 827b373949..9d68942228 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -63,6 +63,11 @@ module.exports = { "@typescript-eslint/ban-ts-comment": "off", }, }], + settings: { + react: { + version: "detect", + } + } }; function buildRestrictedPropertiesOptions(properties, message) { diff --git a/src/components/structures/RoomDirectory.tsx b/src/components/structures/RoomDirectory.tsx index 8d8609d1cf..3c5f99cc7d 100644 --- a/src/components/structures/RoomDirectory.tsx +++ b/src/components/structures/RoomDirectory.tsx @@ -347,7 +347,7 @@ export default class RoomDirectory extends React.Component { }); } - private onRoomClicked = (room: IPublicRoomsChunkRoom, ev: ButtonEvent) => { + private onRoomClicked = (room: IPublicRoomsChunkRoom, ev: React.MouseEvent) => { // If room was shift-clicked, remove it from the room directory if (ev.shiftKey && !this.state.selectedCommunityId) { ev.preventDefault(); diff --git a/src/components/views/avatars/MemberAvatar.tsx b/src/components/views/avatars/MemberAvatar.tsx index 11c24a5981..3c734705b7 100644 --- a/src/components/views/avatars/MemberAvatar.tsx +++ b/src/components/views/avatars/MemberAvatar.tsx @@ -36,6 +36,7 @@ interface IProps extends Omit, "name" | // Whether the onClick of the avatar should be overriden to dispatch `Action.ViewUser` viewUserOnClick?: boolean; title?: string; + style?: any; } interface IState { diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 138f5bf9fe..d15f349d62 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -428,7 +428,7 @@ const UserOptionsSection: React.FC<{ let directMessageButton; if (!isMe) { directMessageButton = ( - openDMForUser(cli, member.userId)} className="mx_UserInfo_field"> + { openDMForUser(cli, member.userId); }} className="mx_UserInfo_field"> { _t('Direct message') } ); diff --git a/src/components/views/rooms/ReadReceiptMarker.tsx b/src/components/views/rooms/ReadReceiptMarker.tsx index c1bd533d39..cfc535b23d 100644 --- a/src/components/views/rooms/ReadReceiptMarker.tsx +++ b/src/components/views/rooms/ReadReceiptMarker.tsx @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, { createRef } from 'react'; +import React, { createRef, RefObject } from 'react'; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; import { _t } from '../../../languageHandler'; @@ -75,7 +75,7 @@ interface IReadReceiptMarkerStyle { @replaceableComponent("views.rooms.ReadReceiptMarker") export default class ReadReceiptMarker extends React.PureComponent { - private avatar: React.RefObject = createRef(); + private avatar: React.RefObject = createRef(); static defaultProps = { leftOffset: 0, @@ -171,7 +171,7 @@ export default class ReadReceiptMarker extends React.PureComponent; + return
} />; } const style = { @@ -210,7 +210,7 @@ export default class ReadReceiptMarker extends React.PureComponent} /> ); diff --git a/src/components/views/rooms/RoomDetailList.tsx b/src/components/views/rooms/RoomDetailList.tsx index cace94ce08..ed2a1fcb44 100644 --- a/src/components/views/rooms/RoomDetailList.tsx +++ b/src/components/views/rooms/RoomDetailList.tsx @@ -31,7 +31,7 @@ interface IProps { @replaceableComponent("views.rooms.RoomDetailList") export default class RoomDetailList extends React.Component { public getRows(): JSX.Element[] { - if (!this.props.rooms) return []; s; + if (!this.props.rooms) return []; return this.props.rooms.map((room, index) => { return ; }); diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 15b25ed64b..d0e438bcda 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -195,7 +195,7 @@ export default class RoomHeader extends React.Component { videoCallButton = ev.shiftKey ? + onClick={(ev: React.MouseEvent) => ev.shiftKey ? this.displayInfoDialogAboutScreensharing() : this.props.onCallPlaced(PlaceCallType.Video)} title={_t("Video call")} />; } diff --git a/src/components/views/settings/DevicesPanel.tsx b/src/components/views/settings/DevicesPanel.tsx index b10820d6a5..4b1fb280a7 100644 --- a/src/components/views/settings/DevicesPanel.tsx +++ b/src/components/views/settings/DevicesPanel.tsx @@ -26,6 +26,9 @@ import Modal from '../../../Modal'; import { SSOAuthEntry } from "../auth/InteractiveAuthEntryComponents"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import InteractiveAuthDialog from "../dialogs/InteractiveAuthDialog"; +import DevicesPanelEntry from "./DevicesPanelEntry"; +import Spinner from "../elements/Spinner"; +import AccessibleButton from "../elements/AccessibleButton"; interface IProps { className?: string; @@ -175,7 +178,6 @@ export default class DevicesPanel extends React.Component { } private renderDevice = (device: IMyDevice): JSX.Element => { - const DevicesPanelEntry = sdk.getComponent('settings.DevicesPanelEntry'); return { }; public render(): JSX.Element { - const Spinner = sdk.getComponent("elements.Spinner"); - const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); - if (this.state.deviceLoadError !== undefined) { const classes = classNames(this.props.className, "error"); return ( @@ -200,8 +199,7 @@ export default class DevicesPanel extends React.Component { const devices = this.state.devices; if (devices === undefined) { // still loading - const classes = this.props.className; - return ; + return ; } devices.sort(this.deviceCompare);