1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Fix marker thunks to not ignore eslint directives for the whole file (#30089)

This commit is contained in:
Renaud Chaput 2024-04-26 19:11:27 +02:00 committed by GitHub
parent de4a7bf531
commit 65093c619f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@ import { List as ImmutableList } from 'immutable';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import type { MarkerJSON } from 'mastodon/api_types/markers'; import type { MarkerJSON } from 'mastodon/api_types/markers';
import type { RootState } from 'mastodon/store'; import type { AppDispatch, RootState } from 'mastodon/store';
import { createAppAsyncThunk } from 'mastodon/store/typed_functions'; import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
import api, { authorizationTokenFromState } from '../api'; import api, { authorizationTokenFromState } from '../api';
@ -72,18 +72,21 @@ interface MarkerParam {
} }
function getLastHomeId(state: RootState): string | undefined { function getLastHomeId(state: RootState): string | undefined {
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return ( return (
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
state state
// @ts-expect-error state.timelines is not yet typed // @ts-expect-error state.timelines is not yet typed
.getIn(['timelines', 'home', 'items'], ImmutableList()) .getIn(['timelines', 'home', 'items'], ImmutableList())
// @ts-expect-error state.timelines is not yet typed // @ts-expect-error state.timelines is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.find((item) => item !== null) .find((item) => item !== null)
); );
} }
function getLastNotificationId(state: RootState): string | undefined { function getLastNotificationId(state: RootState): string | undefined {
// @ts-expect-error state.notifications is not yet typed // @ts-expect-error state.notifications is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
return state.getIn(['notifications', 'lastReadId']); return state.getIn(['notifications', 'lastReadId']);
} }
@ -131,8 +134,8 @@ export const submitMarkersAction = createAppAsyncThunk<{
}); });
const debouncedSubmitMarkers = debounce( const debouncedSubmitMarkers = debounce(
(dispatch) => { (dispatch: AppDispatch) => {
dispatch(submitMarkersAction()); void dispatch(submitMarkersAction());
}, },
300000, 300000,
{ {