Update lint rules

This commit is contained in:
schroda
2026-03-11 00:11:29 +01:00
parent 5dda4304d9
commit 72af9d52d1
377 changed files with 1132 additions and 1048 deletions

View File

@@ -6,15 +6,16 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { MessageDescriptor } from '@lingui/core';
import type { MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
import { MangaStatus } from '@/lib/graphql/generated/graphql.ts';
import { MangaAction, MangaIdInfo, MangaType } from '@/features/manga/Manga.types.ts';
import type { MangaAction, MangaIdInfo } from '@/features/manga/Manga.types.ts';
import { MangaType } from '@/features/manga/Manga.types.ts';
import {
CHAPTER_ACTION_TO_CONFIRMATION_REQUIRED,
CHAPTER_ACTION_TO_TRANSLATION,
} from '@/features/chapter/Chapter.constants.ts';
import { GqlMetaHolder } from '@/features/metadata/Metadata.types.ts';
import type { GqlMetaHolder } from '@/features/metadata/Metadata.types.ts';
export const FALLBACK_MANGA: MangaIdInfo & GqlMetaHolder = { id: -1 };

View File

@@ -6,12 +6,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { LongPressPointerHandlers, LongPressResult } from 'use-long-press';
import { PopupState } from 'material-ui-popup-state/hooks';
import type { LongPressPointerHandlers, LongPressResult } from 'use-long-press';
import type { PopupState } from 'material-ui-popup-state/hooks';
import type { JSX } from 'react';
import { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import { useManageMangaLibraryState } from '@/features/manga/hooks/useManageMangaLibraryState.tsx';
import {
import type { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import type { useManageMangaLibraryState } from '@/features/manga/hooks/useManageMangaLibraryState.tsx';
import type {
ChapterType,
MangaReaderFieldsFragment,
MangaType as MangaTypeGql,
@@ -19,9 +19,9 @@ import {
SourceType,
TrackRecordType,
} from '@/lib/graphql/generated/graphql.ts';
import { SingleModeProps } from '@/features/manga/components/MangaActionMenuItems.tsx';
import { GridLayout } from '@/base/Base.types.ts';
import { ChapterListOptions } from '@/features/chapter/Chapter.types.ts';
import type { SingleModeProps } from '@/features/manga/components/MangaActionMenuItems.tsx';
import type { GridLayout } from '@/base/Base.types.ts';
import type { ChapterListOptions } from '@/features/chapter/Chapter.types.ts';
export type MangaCardMode = 'default' | 'source' | 'migrate.search' | 'migrate.select' | 'duplicate';

View File

@@ -6,7 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { MangaGrid, IMangaGridProps } from '@/features/manga/components/MangaGrid.tsx';
import type { IMangaGridProps } from '@/features/manga/components/MangaGrid.tsx';
import { MangaGrid } from '@/features/manga/components/MangaGrid.tsx';
type TMangaBaseGrid = Omit<IMangaGridProps['mangas'][number], 'downloadCount' | 'unreadCount' | 'chapters'>;

View File

@@ -11,7 +11,7 @@ import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import { Link } from 'react-router-dom';
import { Chapters } from '@/features/chapter/services/Chapters.ts';
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
import {
import type {
ChapterNameInfo,
ChapterNumberInfo,
ChapterReadInfo,

View File

@@ -6,10 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ReactElement } from 'react';
import type { ReactElement } from 'react';
import { useLingui } from '@lingui/react/macro';
import { CustomTooltip } from '@/base/components/CustomTooltip';
import {
import type {
ChapterNameInfo,
ChapterNumberInfo,
ChapterScanlatorInfo,

View File

@@ -21,7 +21,7 @@ import Dialog from '@mui/material/Dialog';
import { AwaitableComponent } from 'awaitable-component';
import { useLingui } from '@lingui/react/macro';
import { Mangas } from '@/features/manga/services/Mangas.ts';
import { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import type { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import { MenuItem } from '@/base/components/menu/MenuItem.tsx';
import {
createGetMenuItemTitle,
@@ -32,8 +32,8 @@ import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'
import { TrackManga } from '@/features/tracker/components/TrackManga.tsx';
import { ChaptersDownloadActionMenuItems } from '@/features/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx';
import { NestedMenuItem } from '@/base/components/menu/NestedMenuItem.tsx';
import { MangaChapterStatFieldsFragment, MangaType } from '@/lib/graphql/generated/graphql.ts';
import { MangaAction, MangaDownloadInfo, MangaIdInfo, MangaUnreadInfo } from '@/features/manga/Manga.types.ts';
import type { MangaChapterStatFieldsFragment, MangaType } from '@/lib/graphql/generated/graphql.ts';
import type { MangaAction, MangaDownloadInfo, MangaIdInfo, MangaUnreadInfo } from '@/features/manga/Manga.types.ts';
import { MANGA_ACTION_TO_TRANSLATION } from '@/features/manga/Manga.constants.ts';
import { AppRoutes } from '@/base/AppRoute.constants.ts';
import { CategorySelect } from '@/features/category/components/CategorySelect.tsx';

View File

@@ -10,7 +10,7 @@ import { styled } from '@mui/material/styles';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import { useLingui } from '@lingui/react/macro';
import { MangaCardMode } from '@/features/manga/Manga.types.ts';
import type { MangaCardMode } from '@/features/manga/Manga.types.ts';
import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
import { useMetadataServerSettings } from '@/features/settings/services/ServerSettingsMetadata.ts';
import { MUIUtil } from '@/lib/mui/MUI.util.ts';

View File

@@ -6,18 +6,29 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import React, { ForwardedRef, Ref, useCallback, useLayoutEffect, useMemo, useRef, useState, type JSX } from 'react';
import Grid, { GridTypeMap } from '@mui/material/Grid';
import Box, { BoxProps } from '@mui/material/Box';
import { GridItemProps } from 'react-virtuoso';
import React, {
useCallback,
useLayoutEffect,
useMemo,
useRef,
useState,
type ForwardedRef,
type Ref,
type JSX,
} from 'react';
import type { GridTypeMap } from '@mui/material/Grid';
import Grid from '@mui/material/Grid';
import type { BoxProps } from '@mui/material/Box';
import Box from '@mui/material/Box';
import type { GridItemProps } from 'react-virtuoso';
import { useLingui } from '@lingui/react/macro';
import { EmptyViewAbsoluteCentered } from '@/base/components/feedback/EmptyViewAbsoluteCentered.tsx';
import { LoadingPlaceholder } from '@/base/components/feedback/LoadingPlaceholder.tsx';
import { MangaCard } from '@/features/manga/components/cards/MangaCard.tsx';
import { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import type { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import { DEFAULT_FULL_FAB_HEIGHT } from '@/base/components/buttons/StyledFab.tsx';
import { MangaCardProps } from '@/features/manga/Manga.types.ts';
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
import type { MangaCardProps } from '@/features/manga/Manga.types.ts';
import type { MangaType } from '@/lib/graphql/generated/graphql.ts';
import { useResizeObserver } from '@/base/hooks/useResizeObserver.tsx';
import { useNavBarContext } from '@/features/navigation-bar/NavbarContext.tsx';
import { GridLayout } from '@/base/Base.types.ts';

View File

@@ -6,19 +6,25 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { BaseSyntheticEvent, ChangeEvent, useMemo, ForwardedRef } from 'react';
import type { BaseSyntheticEvent, ChangeEvent, ForwardedRef } from 'react';
import { useMemo } from 'react';
import Button from '@mui/material/Button';
import Checkbox from '@mui/material/Checkbox';
import IconButton from '@mui/material/IconButton';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import { PopupState } from 'material-ui-popup-state/hooks';
import type { PopupState } from 'material-ui-popup-state/hooks';
import { bindTrigger } from 'material-ui-popup-state';
import { useLingui } from '@lingui/react/macro';
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
import { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
import type { SelectableCollectionReturnType } from '@/base/collection/hooks/useSelectableCollection.ts';
import type { MangaType } from '@/lib/graphql/generated/graphql.ts';
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
const preventDefaultAction = (e: BaseSyntheticEvent) => {
e.stopPropagation();
e.preventDefault();
};
export const MangaOptionButton = ({
id,
selected,
@@ -38,11 +44,6 @@ export const MangaOptionButton = ({
const bindTriggerProps = useMemo(() => bindTrigger(popupState), [popupState]);
const preventDefaultAction = (e: BaseSyntheticEvent) => {
e.stopPropagation();
e.preventDefault();
};
const handleSelectionChange = (e: ChangeEvent, isSelected: boolean) => {
preventDefaultAction(e);
handleSelection?.(id, isSelected);

View File

@@ -23,7 +23,7 @@ import { AwaitableComponent } from 'awaitable-component';
import ColorLensIcon from '@mui/icons-material/ColorLens';
import { useLingui } from '@lingui/react/macro';
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
import type { MangaType } from '@/lib/graphql/generated/graphql.ts';
import { AppRoutes } from '@/base/AppRoute.constants.ts';
import { CategorySelect } from '@/features/category/components/CategorySelect.tsx';
import { useMetadataServerSettings } from '@/features/settings/services/ServerSettingsMetadata.ts';

View File

@@ -11,7 +11,7 @@ import PlayArrow from '@mui/icons-material/PlayArrow';
import { useLingui } from '@lingui/react/macro';
import { StyledFab } from '@/base/components/buttons/StyledFab.tsx';
import { Chapters } from '@/features/chapter/services/Chapters.ts';
import {
import type {
ChapterMangaInfo,
ChapterNameInfo,
ChapterNumberInfo,

View File

@@ -18,9 +18,9 @@ import { makeToast } from '@/base/utils/Toast.ts';
import { TrackManga } from '@/features/tracker/components/TrackManga.tsx';
import { Trackers } from '@/features/tracker/services/Trackers.ts';
import { CustomButton } from '@/base/components/buttons/CustomButton.tsx';
import { GetTrackersSettingsQuery, MangaType } from '@/lib/graphql/generated/graphql.ts';
import type { GetTrackersSettingsQuery, MangaType } from '@/lib/graphql/generated/graphql.ts';
import { GET_TRACKERS_SETTINGS } from '@/lib/graphql/tracker/TrackerQuery.ts';
import { MangaTrackRecordInfo } from '@/features/manga/Manga.types.ts';
import type { MangaTrackRecordInfo } from '@/features/manga/Manga.types.ts';
import { AppRoutes } from '@/base/AppRoute.constants.ts';
import { MediaQuery } from '@/base/utils/MediaQuery.tsx';

View File

@@ -9,13 +9,14 @@
import PopupState, { bindMenu } from 'material-ui-popup-state';
import { memo, useCallback, useMemo, useState } from 'react';
import { useLongPress } from 'use-long-press';
import { MangaActionMenuItems, SingleModeProps } from '@/features/manga/components/MangaActionMenuItems.tsx';
import type { SingleModeProps } from '@/features/manga/components/MangaActionMenuItems.tsx';
import { MangaActionMenuItems } from '@/features/manga/components/MangaActionMenuItems.tsx';
import { Menu } from '@/base/components/menu/Menu.tsx';
import { MigrateDialog } from '@/features/migration/components/MigrateDialog.tsx';
import { useManageMangaLibraryState } from '@/features/manga/hooks/useManageMangaLibraryState.tsx';
import { MangaGridCard } from '@/features/manga/components/cards/MangaGridCard.tsx';
import { MangaListCard } from '@/features/manga/components/cards/MangaListCard.tsx';
import { MangaCardMode, MangaCardProps } from '@/features/manga/Manga.types.ts';
import type { MangaCardMode, MangaCardProps } from '@/features/manga/Manga.types.ts';
import { ContinueReadingButton } from '@/features/manga/components/ContinueReadingButton.tsx';
import { MangaBadges } from '@/features/manga/components/MangaBadges.tsx';
import { GridLayout } from '@/base/Base.types.ts';
@@ -98,7 +99,7 @@ export const MangaCard = memo((props: MangaCardProps) => {
(e: any, { context }: any) => {
// oxlint-disable-next-line no-param-reassign
e.shiftKey = true;
handleClick(e, context as () => {});
handleClick(e, context as () => void);
},
[handleClick],
),

View File

@@ -18,7 +18,7 @@ import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
import { SpinnerImage } from '@/base/components/SpinnerImage.tsx';
import { MangaOptionButton } from '@/features/manga/components/MangaOptionButton.tsx';
import { Mangas } from '@/features/manga/services/Mangas.ts';
import { SpecificMangaCardProps } from '@/features/manga/Manga.types.ts';
import type { SpecificMangaCardProps } from '@/features/manga/Manga.types.ts';
import { TypographyMaxLines } from '@/base/components/texts/TypographyMaxLines.tsx';
import { MANGA_COVER_ASPECT_RATIO } from '@/features/manga/Manga.constants.ts';
import { GridLayout } from '@/base/Base.types.ts';

View File

@@ -14,7 +14,7 @@ import { Link as RouterLink } from 'react-router-dom';
import { memo, useRef } from 'react';
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
import { TypographyMaxLines } from '@/base/components/texts/TypographyMaxLines.tsx';
import { SpecificMangaCardProps } from '@/features/manga/Manga.types.ts';
import type { SpecificMangaCardProps } from '@/features/manga/Manga.types.ts';
import { Mangas } from '@/features/manga/services/Mangas.ts';
import { MangaOptionButton } from '@/features/manga/components/MangaOptionButton.tsx';
import { ListCardAvatar } from '@/base/components/lists/cards/ListCardAvatar.tsx';

View File

@@ -16,7 +16,7 @@ import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { useLocalStorage } from '@/base/hooks/useStorage.tsx';
import { useResizeObserver } from '@/base/hooks/useResizeObserver.tsx';
import {
import type {
MangaDescriptionInfo,
MangaGenreInfo,
MangaLocationState,

View File

@@ -9,7 +9,8 @@
import FavoriteIcon from '@mui/icons-material/Favorite';
import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder';
import { styled } from '@mui/material/styles';
import { ComponentProps, ReactNode, useEffect } from 'react';
import type { ComponentProps, ReactNode } from 'react';
import { useEffect } from 'react';
import Link from '@mui/material/Link';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';
@@ -27,10 +28,10 @@ import { TrackMangaButton } from '@/features/manga/components/TrackMangaButton.t
import { useManageMangaLibraryState } from '@/features/manga/hooks/useManageMangaLibraryState.tsx';
import { Metadata as BaseMetadata } from '@/base/components/texts/Metadata.tsx';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
import { MangaType, SourceType } from '@/lib/graphql/generated/graphql.ts';
import type { MangaType, SourceType } from '@/lib/graphql/generated/graphql.ts';
import { useMetadataServerSettings } from '@/features/settings/services/ServerSettingsMetadata.ts';
import { MANGA_STATUS_TO_TRANSLATION } from '@/features/manga/Manga.constants.ts';
import {
import type {
MangaArtistInfo,
MangaAuthorInfo,
MangaDescriptionInfo,
@@ -47,7 +48,7 @@ import {
import { applyStyles } from '@/base/utils/ApplyStyles.ts';
import { CustomButtonIcon } from '@/base/components/buttons/CustomButtonIcon.tsx';
import { Sources } from '@/features/source/services/Sources.ts';
import { SourceIdInfo } from '@/features/source/Source.types.ts';
import type { SourceIdInfo } from '@/features/source/Source.types.ts';
import { Thumbnail } from '@/features/manga/components/details/Thumbnail.tsx';
import { DescriptionGenre } from '@/features/manga/components/details/DescriptionGenre.tsx';
import { SearchLink } from '@/features/manga/components/details/SearchLink.tsx';

View File

@@ -6,11 +6,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ReactNode } from 'react';
import type { ReactNode } from 'react';
import Link from '@mui/material/Link';
import { Link as RouterLink } from 'react-router-dom';
import { MangaLocationState } from '@/features/manga/Manga.types.ts';
import { SourceIdInfo } from '@/features/source/Source.types.ts';
import type { MangaLocationState } from '@/features/manga/Manga.types.ts';
import type { SourceIdInfo } from '@/features/source/Source.types.ts';
import { AppRoutes } from '@/base/AppRoute.constants.ts';
export const SearchLink = ({

View File

@@ -17,10 +17,11 @@ import { FastAverageColor } from 'fast-average-color';
import { Mangas } from '@/features/manga/services/Mangas.ts';
import { SpinnerImage } from '@/base/components/SpinnerImage.tsx';
import { MANGA_COVER_ASPECT_RATIO } from '@/features/manga/Manga.constants.ts';
import { MangaThumbnailInfo } from '@/features/manga/Manga.types.ts';
import type { MangaThumbnailInfo } from '@/features/manga/Manga.types.ts';
import { useAppThemeContext } from '@/features/theme/AppThemeContext.tsx';
import { TAppThemeContext } from '@/features/theme/AppTheme.types.ts';
import { ImageRequest, requestManager } from '@/lib/requests/RequestManager.ts';
import type { TAppThemeContext } from '@/features/theme/AppTheme.types.ts';
import type { ImageRequest } from '@/lib/requests/RequestManager.ts';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { noOp } from '@/lib/HelperFunctions.ts';
export const Thumbnail = ({

View File

@@ -16,7 +16,11 @@ import { getMetadataServerSettings } from '@/features/settings/services/ServerSe
import { Categories } from '@/features/category/services/Categories.ts';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
import { Mangas } from '@/features/manga/services/Mangas.ts';
import { GetCategoriesBaseQuery, GetCategoriesBaseQueryVariables, MangaType } from '@/lib/graphql/generated/graphql.ts';
import type {
GetCategoriesBaseQuery,
GetCategoriesBaseQueryVariables,
MangaType,
} from '@/lib/graphql/generated/graphql.ts';
import { GET_CATEGORIES_BASE } from '@/lib/graphql/category/CategoryQuery.ts';
import { AppRoutes } from '@/base/AppRoute.constants.ts';
import { getErrorMessage } from '@/lib/HelperFunctions.ts';

View File

@@ -23,11 +23,11 @@ import { MangaDetails } from '@/features/manga/components/details/MangaDetails.t
import { MangaToolbarMenu } from '@/features/manga/components/MangaToolbarMenu.tsx';
import { EmptyViewAbsoluteCentered } from '@/base/components/feedback/EmptyViewAbsoluteCentered.tsx';
import { LoadingPlaceholder } from '@/base/components/feedback/LoadingPlaceholder.tsx';
import { GetMangaScreenQuery } from '@/lib/graphql/generated/graphql.ts';
import type { GetMangaScreenQuery } from '@/lib/graphql/generated/graphql.ts';
import { GET_MANGA_SCREEN } from '@/lib/graphql/manga/MangaQuery.ts';
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
import { useAppTitleAndAction } from '@/features/navigation-bar/hooks/useAppTitleAndAction.ts';
import { MangaLocationState } from '@/features/manga/Manga.types.ts';
import type { MangaLocationState } from '@/features/manga/Manga.types.ts';
export const Manga: React.FC = () => {
const { t } = useLingui();
@@ -51,7 +51,9 @@ export const Manga: React.FC = () => {
const error = mangaError ?? refreshError;
useEffect(() => {
if (manga == null) return;
if (manga == null) {
return;
}
const doFetch = !autofetchedRef.current && !manga.initialized;
if (doFetch) {

View File

@@ -9,8 +9,8 @@
import { useEffect, useMemo } from 'react';
import { DEFAULT_CHAPTER_OPTIONS } from '@/features/chapter/Chapter.constants.ts';
import { getMetadataFrom } from '@/features/metadata/services/MetadataReader.ts';
import { MangaIdInfo, MangaMetadata, MangaMetadataKeys } from '@/features/manga/Manga.types.ts';
import {
import type { MangaIdInfo, MangaMetadata, MangaMetadataKeys } from '@/features/manga/Manga.types.ts';
import type {
AllowedMetadataValueTypes,
GqlMetaHolder,
Metadata,

View File

@@ -6,11 +6,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DocumentNode, Unmasked } from '@apollo/client';
import type { DocumentNode, Unmasked } from '@apollo/client';
import { t } from '@lingui/core/macro';
import { i18n } from '@/i18n';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import {
import type {
ChapterConditionInput,
GetMangasBaseQuery,
GetMangasBaseQueryVariables,
@@ -26,8 +26,8 @@ import { makeToast } from '@/base/utils/Toast.ts';
import { getMetadataServerSettings } from '@/features/settings/services/ServerSettingsMetadata.ts';
import { GET_MANGAS_BASE } from '@/lib/graphql/manga/MangaQuery.ts';
import { MANGA_BASE_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts';
import { MetadataMigrationSettings } from '@/features/migration/Migration.types.ts';
import {
import type { MetadataMigrationSettings } from '@/features/migration/Migration.types.ts';
import type {
MangaAction,
MangaArtistInfo,
MangaAuthorInfo,
@@ -39,10 +39,10 @@ import {
MangaSourceNameInfo,
MangaThumbnailInfo,
MangaTitleInfo,
MangaType,
MangaUnreadInfo,
MigrateMode,
} from '@/features/manga/Manga.types.ts';
import { MangaType } from '@/features/manga/Manga.types.ts';
import {
MANGA_ACTION_TO_CONFIRMATION_REQUIRED,
MANGA_ACTION_TO_TRANSLATION,
@@ -104,6 +104,9 @@ type PerformActionOptions<Action extends MangaAction> = Action extends 'mark_as_
type MigrateAction = { copy: () => Promise<unknown>[]; cleanup: () => Promise<unknown>[] };
type MigrateActionCreator = () => MigrateAction;
const performMigrationAction = async (migrateAction: keyof MigrateAction, ...actions: MigrateAction[]) =>
Promise.all(actions.flatMap((action) => action[migrateAction]()));
const ARTIST_AUTHOR_SEPARATOR_REGEX = /\s*[,|、]\s*/;
export class Mangas {
@@ -236,25 +239,23 @@ export class Mangas {
Object.fromEntries([...mangaIdToDefaultDownloadSize, ...mangaIdToDownloadSize]),
) satisfies MangaIdToDownloadSize[];
const chapterIdsToDownload = mangaIdToActualDownloadSize
.map(([mangaId, actualSize]) => {
const mangaChapters = mangaIdToChaptersToConsider[Number(mangaId)] ?? [];
const chapterIdsToDownload = mangaIdToActualDownloadSize.flatMap(([mangaId, actualSize]) => {
const mangaChapters = mangaIdToChaptersToConsider[Number(mangaId)] ?? [];
if (!mangaChapters.length) {
return [];
}
if (!mangaChapters.length) {
return [];
}
const shouldDownloadAll = actualSize === undefined;
if (shouldDownloadAll) {
return mangaChapters;
}
const shouldDownloadAll = actualSize === undefined;
if (shouldDownloadAll) {
return mangaChapters;
}
const uniqueMangaChapters = Chapters.removeDuplicates(mangaChapters[0], mangaChapters);
const uniqueMangaChaptersToDownload = uniqueMangaChapters.slice(0, actualSize);
const uniqueMangaChapters = Chapters.removeDuplicates(mangaChapters[0], mangaChapters);
const uniqueMangaChaptersToDownload = uniqueMangaChapters.slice(0, actualSize);
return Chapters.addDuplicates(uniqueMangaChaptersToDownload, mangaChapters);
})
.flat();
return Chapters.addDuplicates(uniqueMangaChaptersToDownload, mangaChapters);
});
if (!chapterIdsToDownload.length) {
return Promise.resolve();
@@ -531,11 +532,6 @@ export class Mangas {
mangaToMigrateToData.fetchChapters = { chapters: [] };
}
const performMigrationAction = async (
migrateAction: keyof MigrateAction,
...actions: MigrateAction[]
) => Promise.all(actions.map((action) => action[migrateAction]()).flat());
const performMigrationActions = async (
...actionCreators: [boolean | undefined, MigrateActionCreator][]
) => {