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
|
@ -41,7 +41,7 @@ const DeviceNameEditor: React.FC<Props & { stopEditing: () => void }> = ({ devic
|
|||
|
||||
const onInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => setDeviceName(event.target.value);
|
||||
|
||||
const onSubmit = async (event: FormEvent<HTMLFormElement>) => {
|
||||
const onSubmit = async (event: FormEvent<HTMLFormElement>): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
event.preventDefault();
|
||||
|
|
|
@ -51,15 +51,17 @@ interface Props {
|
|||
supportsMSC3881?: boolean | undefined;
|
||||
}
|
||||
|
||||
const isDeviceSelected = (deviceId: ExtendedDevice["device_id"], selectedDeviceIds: ExtendedDevice["device_id"][]) =>
|
||||
selectedDeviceIds.includes(deviceId);
|
||||
const isDeviceSelected = (
|
||||
deviceId: ExtendedDevice["device_id"],
|
||||
selectedDeviceIds: ExtendedDevice["device_id"][],
|
||||
): boolean => selectedDeviceIds.includes(deviceId);
|
||||
|
||||
// devices without timestamp metadata should be sorted last
|
||||
const sortDevicesByLatestActivityThenDisplayName = (left: ExtendedDevice, right: ExtendedDevice) =>
|
||||
const sortDevicesByLatestActivityThenDisplayName = (left: ExtendedDevice, right: ExtendedDevice): number =>
|
||||
(right.last_seen_ts || 0) - (left.last_seen_ts || 0) ||
|
||||
(left.display_name || left.device_id).localeCompare(right.display_name || right.device_id);
|
||||
|
||||
const getFilteredSortedDevices = (devices: DevicesDictionary, filter?: FilterVariation) =>
|
||||
const getFilteredSortedDevices = (devices: DevicesDictionary, filter?: FilterVariation): ExtendedDevice[] =>
|
||||
filterDevicesBySecurityRecommendation(Object.values(devices), filter ? [filter] : []).sort(
|
||||
sortDevicesByLatestActivityThenDisplayName,
|
||||
);
|
||||
|
@ -280,12 +282,12 @@ export const FilteredDeviceList = forwardRef(
|
|||
},
|
||||
];
|
||||
|
||||
const onFilterOptionChange = (filterId: DeviceFilterKey) => {
|
||||
const onFilterOptionChange = (filterId: DeviceFilterKey): void => {
|
||||
onFilterChange(filterId === ALL_FILTER_ID ? undefined : (filterId as FilterVariation));
|
||||
};
|
||||
|
||||
const isAllSelected = selectedDeviceIds.length >= sortedDevices.length;
|
||||
const toggleSelectAll = () => {
|
||||
const toggleSelectAll = (): void => {
|
||||
if (isAllSelected) {
|
||||
setSelectedDeviceIds([]);
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ export const deleteDevicesWithInteractiveAuth = async (
|
|||
matrixClient: MatrixClient,
|
||||
deviceIds: string[],
|
||||
onFinished?: InteractiveAuthCallback,
|
||||
) => {
|
||||
): Promise<void> => {
|
||||
if (!deviceIds.length) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ const filters: Record<FilterVariation, DeviceFilterCondition> = {
|
|||
export const filterDevicesBySecurityRecommendation = (
|
||||
devices: ExtendedDevice[],
|
||||
securityVariations: FilterVariation[],
|
||||
) => {
|
||||
): ExtendedDevice[] => {
|
||||
const activeFilters = securityVariations.map((variation) => filters[variation]);
|
||||
if (!activeFilters.length) {
|
||||
return devices;
|
||||
|
|
|
@ -135,7 +135,7 @@ export const useOwnDevices = (): DevicesState => {
|
|||
});
|
||||
}, [matrixClient]);
|
||||
|
||||
const refreshDevices = useCallback(async () => {
|
||||
const refreshDevices = useCallback(async (): Promise<void> => {
|
||||
setIsLoadingDeviceList(true);
|
||||
try {
|
||||
const devices = await fetchDevicesWithVerification(matrixClient, userId);
|
||||
|
@ -200,7 +200,7 @@ export const useOwnDevices = (): DevicesState => {
|
|||
|
||||
const requestDeviceVerification =
|
||||
isCurrentDeviceVerified && userId
|
||||
? async (deviceId: ExtendedDevice["device_id"]) => {
|
||||
? async (deviceId: ExtendedDevice["device_id"]): Promise<VerificationRequest> => {
|
||||
return await matrixClient.requestVerification(userId, [deviceId]);
|
||||
}
|
||||
: undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue