Enable @typescript-eslint/explicit-function-return-type
in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier * Enable `@typescript-eslint/explicit-function-return-type` in /src * Fix types * tsc strict fixes * Delint * Fix test * Fix bad merge
This commit is contained in:
parent
7a36ba0fde
commit
030b7e90bf
683 changed files with 3459 additions and 3013 deletions
|
@ -99,7 +99,7 @@ const useImageUrl = ({ url, urls }): [string, () => void] => {
|
|||
return [imageUrl, onError];
|
||||
};
|
||||
|
||||
const BaseAvatar = (props: IProps) => {
|
||||
const BaseAvatar: React.FC<IProps> = (props) => {
|
||||
const {
|
||||
name,
|
||||
idName,
|
||||
|
|
|
@ -62,7 +62,7 @@ enum Icon {
|
|||
PresenceBusy = "BUSY",
|
||||
}
|
||||
|
||||
function tooltipText(variant: Icon) {
|
||||
function tooltipText(variant: Icon): string {
|
||||
switch (variant) {
|
||||
case Icon.Globe:
|
||||
return _t("This room is public");
|
||||
|
@ -91,7 +91,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
|
|||
};
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
this.isUnmounted = true;
|
||||
if (this.isWatchingTimeline) this.props.room.off(RoomEvent.Timeline, this.onRoomTimeline);
|
||||
this.dmUser = null; // clear listeners, if any
|
||||
|
@ -120,7 +120,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
|
|||
}
|
||||
}
|
||||
|
||||
private onRoomTimeline = (ev: MatrixEvent, room: Room | null) => {
|
||||
private onRoomTimeline = (ev: MatrixEvent, room: Room | null): void => {
|
||||
if (this.isUnmounted) return;
|
||||
if (this.props.room.roomId !== room?.roomId) return;
|
||||
|
||||
|
@ -132,7 +132,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
|
|||
}
|
||||
};
|
||||
|
||||
private onPresenceUpdate = () => {
|
||||
private onPresenceUpdate = (): void => {
|
||||
if (this.isUnmounted) return;
|
||||
|
||||
const newIcon = this.getPresenceIcon();
|
||||
|
|
|
@ -54,7 +54,7 @@ export default function MemberAvatar({
|
|||
hideTitle,
|
||||
member: propsMember,
|
||||
...props
|
||||
}: IProps) {
|
||||
}: IProps): JSX.Element {
|
||||
const card = useContext(CardContext);
|
||||
|
||||
const member = useRoomMemberProfile({
|
||||
|
|
|
@ -63,11 +63,11 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
MatrixClientPeg.get().on(RoomStateEvent.Events, this.onRoomStateEvents);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
MatrixClientPeg.get()?.removeListener(RoomStateEvent.Events, this.onRoomStateEvents);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
private onRoomStateEvents = (ev: MatrixEvent) => {
|
||||
private onRoomStateEvents = (ev: MatrixEvent): void => {
|
||||
if (ev.getRoomId() !== this.props.room?.roomId || ev.getType() !== EventType.RoomAvatar) return;
|
||||
|
||||
this.setState({
|
||||
|
@ -108,7 +108,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
|
|||
return Avatar.avatarUrlForRoom(props.room, props.width, props.height, props.resizeMethod);
|
||||
}
|
||||
|
||||
private onRoomAvatarClick = () => {
|
||||
private onRoomAvatarClick = (): void => {
|
||||
const avatarUrl = Avatar.avatarUrlForRoom(this.props.room, null, null, null);
|
||||
const params = {
|
||||
src: avatarUrl,
|
||||
|
@ -135,7 +135,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
|
|||
return this.props.room?.roomId || this.props.oobData?.roomId;
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const { room, oobData, viewAvatarOnClick, onClick, className, ...otherProps } = this.props;
|
||||
const roomName = room?.name ?? oobData.name;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue