Skip to content

Commit

Permalink
Fix marker thunks to not ignore eslint directives for the whole file (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
renchap authored Apr 26, 2024
1 parent de4a7bf commit 65093c6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/javascript/mastodon/actions/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { List as ImmutableList } from 'immutable';
import { debounce } from 'lodash';

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 api, { authorizationTokenFromState } from '../api';
Expand Down Expand Up @@ -72,18 +72,21 @@ interface MarkerParam {
}

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 (
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
state
// @ts-expect-error state.timelines is not yet typed
.getIn(['timelines', 'home', 'items'], ImmutableList())
// @ts-expect-error state.timelines is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.find((item) => item !== null)
);
}

function getLastNotificationId(state: RootState): string | undefined {
// @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']);
}

Expand Down Expand Up @@ -131,8 +134,8 @@ export const submitMarkersAction = createAppAsyncThunk<{
});

const debouncedSubmitMarkers = debounce(
(dispatch) => {
dispatch(submitMarkersAction());
(dispatch: AppDispatch) => {
void dispatch(submitMarkersAction());
},
300000,
{
Expand Down

0 comments on commit 65093c6

Please sign in to comment.