[ESLint] Prefer named exports (#427)

This commit is contained in:
schroda
2023-10-28 00:32:02 +02:00
committed by GitHub
parent 68e7b4b16d
commit 5a5b12a9e1
118 changed files with 319 additions and 470 deletions

View File

@@ -27,9 +27,9 @@ import Typography from '@mui/material/Typography';
import React from 'react';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import requestManager from '@/lib/requests/RequestManager.ts';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { getUploadDateString } from '@/util/date';
import DownloadStateIndicator from '@/components/molecules/DownloadStateIndicator';
import { DownloadStateIndicator } from '@/components/molecules/DownloadStateIndicator';
import { DownloadType, UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts';
import { TChapter } from '@/typings.ts';
@@ -42,7 +42,7 @@ interface IProps {
selected: boolean | null;
}
const ChapterCard: React.FC<IProps> = (props: IProps) => {
export const ChapterCard: React.FC<IProps> = (props: IProps) => {
const { t } = useTranslation();
const theme = useTheme();
@@ -212,5 +212,3 @@ const ChapterCard: React.FC<IProps> = (props: IProps) => {
</li>
);
};
export default ChapterCard;

View File

@@ -12,14 +12,14 @@ import React, { ComponentProps, useEffect, useMemo, useRef, useState } from 'rea
import { Virtuoso } from 'react-virtuoso';
import { useTranslation } from 'react-i18next';
import { TChapter, TManga, TranslationKey } from '@/typings';
import requestManager from '@/lib/requests/RequestManager.ts';
import ChapterCard from '@/components/manga/ChapterCard';
import ResumeFab from '@/components/manga/ResumeFAB';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { ChapterCard } from '@/components/manga/ChapterCard';
import { ResumeFab } from '@/components/manga/ResumeFAB';
import { filterAndSortChapters, useChapterOptions } from '@/components/manga/util';
import EmptyView from '@/components/util/EmptyView';
import makeToast from '@/components/util/Toast';
import ChaptersToolbarMenu from '@/components/manga/ChaptersToolbarMenu';
import SelectionFAB from '@/components/manga/SelectionFAB';
import { EmptyView } from '@/components/util/EmptyView';
import { makeToast } from '@/components/util/Toast';
import { ChaptersToolbarMenu } from '@/components/manga/ChaptersToolbarMenu';
import { SelectionFAB } from '@/components/manga/SelectionFAB';
import { DEFAULT_FULL_FAB_HEIGHT } from '@/components/util/StyledFab';
import { DownloadType, UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts';
@@ -78,7 +78,7 @@ interface IProps {
isRefreshing: boolean;
}
const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
export const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
const { t } = useTranslation();
const [selection, setSelection] = useState<number[] | null>(null);
@@ -299,5 +299,3 @@ const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
</>
);
};
export default ChapterList;

View File

@@ -10,10 +10,10 @@ import { RadioGroup } from '@mui/material';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ChapterListOptions, ChapterOptionsReducerAction, TranslationKey } from '@/typings';
import RadioInput from '@/components/atoms/RadioInput';
import SortRadioInput from '@/components/atoms/SortRadioInput';
import ThreeStateCheckboxInput from '@/components/atoms/ThreeStateCheckboxInput';
import OptionsTabs from '@/components/molecules/OptionsTabs';
import { RadioInput } from '@/components/atoms/RadioInput';
import { SortRadioInput } from '@/components/atoms/SortRadioInput';
import { ThreeStateCheckboxInput } from '@/components/atoms/ThreeStateCheckboxInput';
import { OptionsTabs } from '@/components/molecules/OptionsTabs';
import { SORT_OPTIONS } from '@/components/manga/util';
interface IProps {
@@ -29,7 +29,7 @@ const TITLES: { [key in 'filter' | 'sort' | 'display']: TranslationKey } = {
display: 'global.label.display',
};
const ChapterOptions: React.FC<IProps> = ({ open, onClose, options, optionsDispatch }) => {
export const ChapterOptions: React.FC<IProps> = ({ open, onClose, options, optionsDispatch }) => {
const { t } = useTranslation();
return (
@@ -110,5 +110,3 @@ const ChapterOptions: React.FC<IProps> = ({ open, onClose, options, optionsDispa
/>
);
};
export default ChapterOptions;

View File

@@ -10,7 +10,7 @@ import FilterList from '@mui/icons-material/FilterList';
import { IconButton } from '@mui/material';
import * as React from 'react';
import { ChapterListOptions, ChapterOptionsReducerAction } from '@/typings';
import ChapterOptions from '@/components/manga/ChapterOptions';
import { ChapterOptions } from '@/components/manga/ChapterOptions';
import { isFilterActive } from '@/components/manga/util';
interface IProps {
@@ -18,7 +18,7 @@ interface IProps {
optionsDispatch: React.Dispatch<ChapterOptionsReducerAction>;
}
const ChaptersToolbarMenu = ({ options, optionsDispatch }: IProps) => {
export const ChaptersToolbarMenu = ({ options, optionsDispatch }: IProps) => {
const [open, setOpen] = React.useState(false);
const isFiltered = isFilterActive(options);
@@ -36,5 +36,3 @@ const ChaptersToolbarMenu = ({ options, optionsDispatch }: IProps) => {
</>
);
};
export default ChaptersToolbarMenu;

View File

@@ -15,8 +15,8 @@ import { useTranslation } from 'react-i18next';
import { t as translate } from 'i18next';
import Button from '@mui/material/Button';
import { ISource, TManga } from '@/typings';
import requestManager from '@/lib/requests/RequestManager.ts';
import makeToast from '@/components/util/Toast';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { makeToast } from '@/components/util/Toast';
const DetailsWrapper = styled('div')(({ theme }) => ({
width: '100%',
@@ -165,7 +165,7 @@ function getValueOrUnknown(val?: string | null) {
return val || 'UNKNOWN';
}
const MangaDetails: React.FC<IProps> = ({ manga }) => {
export const MangaDetails: React.FC<IProps> = ({ manga }) => {
const { t } = useTranslation();
const { data: categoriesData, loading: areCategoriesLoading } = requestManager.useGetCategories();
const categories = categoriesData?.categories.nodes ?? [];
@@ -250,5 +250,3 @@ const MangaDetails: React.FC<IProps> = ({ manga }) => {
</DetailsWrapper>
);
};
export default MangaDetails;

View File

@@ -21,7 +21,7 @@ import {
} from '@mui/material';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import CategorySelect from '@/components/navbar/action/CategorySelect';
import { CategorySelect } from '@/components/navbar/action/CategorySelect';
import { TManga } from '@/typings.ts';
interface IProps {
@@ -30,7 +30,7 @@ interface IProps {
refreshing: boolean;
}
const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
const { t } = useTranslation();
const theme = useTheme();
const isLargeScreen = useMediaQuery(theme.breakpoints.up('sm'));
@@ -123,5 +123,3 @@ const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
</>
);
};
export default MangaToolbarMenu;

View File

@@ -9,14 +9,14 @@
import { Link } from 'react-router-dom';
import { PlayArrow } from '@mui/icons-material';
import { useTranslation } from 'react-i18next';
import StyledFab from '@/components/util/StyledFab';
import { StyledFab } from '@/components/util/StyledFab';
interface ResumeFABProps {
chapterIndex: number;
mangaId: number;
}
export default function ResumeFab(props: ResumeFABProps) {
export function ResumeFab(props: ResumeFABProps) {
const { t } = useTranslation();
const { chapterIndex, mangaId } = props;

View File

@@ -11,7 +11,7 @@ import { Fab, Menu, Box } from '@mui/material';
import React, { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import type { IChapterWithMeta } from '@/components/manga/ChapterList';
import SelectionFABActionItem from '@/components/manga/SelectionFABActionItem';
import { SelectionFABActionItem } from '@/components/manga/SelectionFABActionItem';
import { DEFAULT_FAB_STYLE } from '@/components/util/StyledFab';
export type SelectionAction = 'download' | 'delete' | 'bookmark' | 'unbookmark' | 'mark_as_read' | 'mark_as_unread';
@@ -21,7 +21,7 @@ interface SelectionFABProps {
onAction: (action: SelectionAction, chapters: IChapterWithMeta[]) => void;
}
const SelectionFAB: React.FC<SelectionFABProps> = (props) => {
export const SelectionFAB: React.FC<SelectionFABProps> = (props) => {
const { t } = useTranslation();
const { selectedChapters, onAction } = props;
@@ -102,5 +102,3 @@ const SelectionFAB: React.FC<SelectionFABProps> = (props) => {
</Box>
);
};
export default SelectionFAB;

View File

@@ -33,7 +33,7 @@ const ICONS = {
mark_as_unread: RemoveDone,
};
const SelectionFABActionItem: React.FC<IProps> = ({ action, matchingChapters, onClick, title }) => {
export const SelectionFABActionItem: React.FC<IProps> = ({ action, matchingChapters, onClick, title }) => {
const count = matchingChapters.length;
const Icon = ICONS[action];
return (
@@ -48,5 +48,3 @@ const SelectionFABActionItem: React.FC<IProps> = ({ action, matchingChapters, on
</MenuItem>
);
};
export default SelectionFABActionItem;

View File

@@ -7,7 +7,7 @@
*/
import { useCallback, useEffect, useState } from 'react';
import requestManager from '@/lib/requests/RequestManager.ts';
import { requestManager } from '@/lib/requests/RequestManager.ts';
export const useRefreshManga = (mangaId: string) => {
const [fetchingOnline, setFetchingOnline] = useState(false);