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

@ -67,11 +67,11 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
};
}
private getMarkerId = () => {
private getMarkerId = (): string => {
return "mx_MLocationPicker_marker";
};
public componentDidMount() {
public componentDidMount(): void {
this.context.on(ClientEvent.ClientWellKnown, this.updateStyleUrl);
try {
@ -128,14 +128,14 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
}
}
public componentWillUnmount() {
public componentWillUnmount(): void {
this.geolocate?.off("error", this.onGeolocateError);
this.geolocate?.off("geolocate", this.onGeolocate);
this.map?.off("click", this.onClick);
this.context.off(ClientEvent.ClientWellKnown, this.updateStyleUrl);
}
private addMarkerToMap = () => {
private addMarkerToMap = (): void => {
this.marker = new maplibregl.Marker({
element: document.getElementById(this.getMarkerId()) ?? undefined,
anchor: "bottom",
@ -145,14 +145,14 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
.addTo(this.map);
};
private updateStyleUrl = (clientWellKnown: IClientWellKnown) => {
private updateStyleUrl = (clientWellKnown: IClientWellKnown): void => {
const style = tileServerFromWellKnown(clientWellKnown)?.["map_style_url"];
if (style) {
this.map?.setStyle(style);
}
};
private onGeolocate = (position: GeolocationPosition) => {
private onGeolocate = (position: GeolocationPosition): void => {
if (!this.marker) {
this.addMarkerToMap();
}
@ -160,7 +160,7 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
this.marker?.setLngLat(new maplibregl.LngLat(position.coords.longitude, position.coords.latitude));
};
private onClick = (event: MapMouseEvent) => {
private onClick = (event: MapMouseEvent): void => {
if (!this.marker) {
this.addMarkerToMap();
}
@ -174,7 +174,7 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
});
};
private onGeolocateError = (e: GeolocationPositionError) => {
private onGeolocateError = (e: GeolocationPositionError): void => {
logger.error("Could not fetch location", e);
// close the dialog and show an error when trying to share own location
// pin drop location without permissions is ok
@ -195,7 +195,7 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
this.setState({ timeout });
};
private onOk = () => {
private onOk = (): void => {
const { timeout, position } = this.state;
this.props.onChoose(
@ -208,7 +208,7 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
this.props.onFinished();
};
public render() {
public render(): JSX.Element {
if (this.state.error) {
return (
<div className="mx_LocationPicker mx_LocationPicker_hasError">