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:
Michael Telatynski 2023-01-12 13:25:14 +00:00 committed by GitHub
parent 7a36ba0fde
commit 030b7e90bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
683 changed files with 3459 additions and 3013 deletions

View file

@ -77,7 +77,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
this.voiceRecordingId = VoiceRecordingStore.getVoiceRecordingId(this.props.room, this.props.relation);
}
public componentDidMount() {
public componentDidMount(): void {
const recorder = VoiceRecordingStore.instance.getActiveRecording(this.voiceRecordingId);
if (recorder) {
if (recorder.isRecording || !recorder.hasRecording) {
@ -88,7 +88,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
}
}
public async componentWillUnmount() {
public async componentWillUnmount(): Promise<void> {
// Stop recording, but keep the recording memory (don't dispose it). This is to let the user
// come back and finish working with it.
const recording = VoiceRecordingStore.instance.getActiveRecording(this.voiceRecordingId);
@ -99,7 +99,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
}
// called by composer
public async send() {
public async send(): Promise<void> {
if (!this.state.recorder) {
throw new Error("No recording started - cannot send anything");
}
@ -159,25 +159,25 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
await this.disposeRecording();
}
private async disposeRecording() {
private async disposeRecording(): Promise<void> {
await VoiceRecordingStore.instance.disposeRecording(this.voiceRecordingId);
// Reset back to no recording, which means no phase (ie: restart component entirely)
this.setState({ recorder: null, recordingPhase: null, didUploadFail: false });
}
private onCancel = async () => {
private onCancel = async (): Promise<void> => {
await this.disposeRecording();
};
public onRecordStartEndClick = async () => {
public onRecordStartEndClick = async (): Promise<void> => {
if (this.state.recorder) {
await this.state.recorder.stop();
return;
}
// The "microphone access error" dialogs are used a lot, so let's functionify them
const accessError = () => {
const accessError = (): void => {
Modal.createDialog(ErrorDialog, {
title: _t("Unable to access your microphone"),
description: (
@ -236,7 +236,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
}
};
private bindNewRecorder(recorder: Optional<VoiceMessageRecording>) {
private bindNewRecorder(recorder: Optional<VoiceMessageRecording>): void {
if (this.state.recorder) {
this.state.recorder.off(UPDATE_EVENT, this.onRecordingUpdate);
}
@ -245,7 +245,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
}
}
private onRecordingUpdate = (ev: RecordingState) => {
private onRecordingUpdate = (ev: RecordingState): void => {
if (ev === RecordingState.EndingSoon) return; // ignore this state: it has no UI purpose here
this.setState({ recordingPhase: ev });
};