Fixed all lint alert

This commit is contained in:
DrMint 2022-04-23 22:08:22 +02:00
parent a87f8abdf0
commit 1251bf19bc
10 changed files with 30 additions and 17 deletions

View File

@ -85,6 +85,7 @@ export default function ScanSet(props: Props): JSX.Element {
scanLocales scanLocales
) )
); );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appLayout.preferredLanguages]); }, [appLayout.preferredLanguages]);
useEffect(() => { useEffect(() => {
@ -92,6 +93,7 @@ export default function ScanSet(props: Props): JSX.Element {
const selectedScanSet = scanSet[selectedScanIndex]; const selectedScanSet = scanSet[selectedScanIndex];
selectedScanSet?.pages?.data.sort((a, b) => { selectedScanSet?.pages?.data.sort((a, b) => {
function isInteger(value: string): boolean { function isInteger(value: string): boolean {
// eslint-disable-next-line require-unicode-regexp
return /^\d+$/.test(value); return /^\d+$/.test(value);
} }
function getFileName(path: string): string { function getFileName(path: string): string {
@ -115,6 +117,7 @@ export default function ScanSet(props: Props): JSX.Element {
}); });
setSelectedScan(selectedScanSet); setSelectedScan(selectedScanSet);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedScanIndex]); }, [selectedScanIndex]);
return ( return (
@ -136,7 +139,7 @@ export default function ScanSet(props: Props): JSX.Element {
<div className="flex flex-row flex-wrap gap-4 pb-6 place-items-center"> <div className="flex flex-row flex-wrap gap-4 pb-6 place-items-center">
{content?.data?.attributes?.slug && ( {content?.data?.attributes?.slug && (
<Button href={`/contents/${content?.data?.attributes?.slug}`}> <Button href={`/contents/${content.data.attributes.slug}`}>
{langui.open_content} {langui.open_content}
</Button> </Button>
)} )}

View File

@ -63,26 +63,28 @@ export default function ScanSetCover(props: Props): JSX.Element {
scanLocales scanLocales
) )
); );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appLayout.preferredLanguages]); }, [appLayout.preferredLanguages]);
useEffect(() => { useEffect(() => {
if (selectedScanIndex !== undefined) if (selectedScanIndex !== undefined)
setSelectedScan(images[selectedScanIndex]); setSelectedScan(images[selectedScanIndex]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedScanIndex]); }, [selectedScanIndex]);
const coverImages: UploadImageFragment[] = []; const coverImages: UploadImageFragment[] = [];
if (selectedScan?.obi_belt?.full?.data?.attributes) if (selectedScan?.obi_belt?.full?.data?.attributes)
coverImages.push(selectedScan.obi_belt?.full?.data?.attributes); coverImages.push(selectedScan.obi_belt.full.data.attributes);
if (selectedScan?.obi_belt?.inside_full?.data?.attributes) if (selectedScan?.obi_belt?.inside_full?.data?.attributes)
coverImages.push(selectedScan.obi_belt?.inside_full?.data?.attributes); coverImages.push(selectedScan.obi_belt.inside_full.data.attributes);
if (selectedScan?.dust_jacket?.full?.data?.attributes) if (selectedScan?.dust_jacket?.full?.data?.attributes)
coverImages.push(selectedScan.dust_jacket?.full?.data?.attributes); coverImages.push(selectedScan.dust_jacket.full.data.attributes);
if (selectedScan?.dust_jacket?.inside_full?.data?.attributes) if (selectedScan?.dust_jacket?.inside_full?.data?.attributes)
coverImages.push(selectedScan.dust_jacket?.inside_full?.data?.attributes); coverImages.push(selectedScan.dust_jacket.inside_full.data.attributes);
if (selectedScan?.cover?.full?.data?.attributes) if (selectedScan?.cover?.full?.data?.attributes)
coverImages.push(selectedScan.cover?.full?.data?.attributes); coverImages.push(selectedScan.cover.full.data.attributes);
if (selectedScan?.cover?.inside_full?.data?.attributes) if (selectedScan?.cover?.inside_full?.data?.attributes)
coverImages.push(selectedScan.cover?.inside_full?.data?.attributes); coverImages.push(selectedScan.cover.inside_full.data.attributes);
if (coverImages.length > 0) { if (coverImages.length > 0) {
return ( return (

View File

@ -12,6 +12,7 @@ export default function OrderableList(props: Props): JSX.Element {
useEffect(() => { useEffect(() => {
props.onChange?.(items); props.onChange?.(items);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [items]); }, [items]);
function updateOrder(sourceIndex: number, targetIndex: number) { function updateOrder(sourceIndex: number, targetIndex: number) {

View File

@ -6,7 +6,6 @@ import { useAppLayout } from "contexts/AppLayoutContext";
import { useMediaDesktop } from "hooks/useMediaQuery"; import { useMediaDesktop } from "hooks/useMediaQuery";
import Markdown from "markdown-to-jsx"; import Markdown from "markdown-to-jsx";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router";
import { AppStaticProps } from "queries/getAppStaticProps"; import { AppStaticProps } from "queries/getAppStaticProps";
interface Props { interface Props {
@ -15,7 +14,6 @@ interface Props {
export default function MainPanel(props: Props): JSX.Element { export default function MainPanel(props: Props): JSX.Element {
const { langui } = props; const { langui } = props;
const router = useRouter();
const isDesktop = useMediaDesktop(); const isDesktop = useMediaDesktop();
const appLayout = useAppLayout(); const appLayout = useAppLayout();

View File

@ -89,11 +89,13 @@ export default function Post(props: Props): JSX.Element {
translationLocales translationLocales
) )
); );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appLayout.preferredLanguages]); }, [appLayout.preferredLanguages]);
useEffect(() => { useEffect(() => {
if (selectedTranslationIndex !== undefined) if (selectedTranslationIndex !== undefined)
setSelectedTranslation(post?.translations?.[selectedTranslationIndex]); setSelectedTranslation(post?.translations?.[selectedTranslationIndex]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedTranslationIndex]); }, [selectedTranslationIndex]);
const thumbnail = const thumbnail =

View File

@ -34,10 +34,12 @@ interface Props {
author?: string; author?: string;
position: "Bottom" | "Top"; position: "Bottom" | "Top";
}; };
hoverlay?: { hoverlay?:
__typename: "Video"; | {
duration: number; __typename: "Video";
}; duration: number;
}
| { __typename: "anotherHoverlayName" };
} }
export default function ThumbnailPreview(props: Props): JSX.Element { export default function ThumbnailPreview(props: Props): JSX.Element {

View File

@ -103,12 +103,12 @@ export async function getStaticProps(
): Promise<{ notFound: boolean } | { props: Props }> { ): Promise<{ notFound: boolean } | { props: Props }> {
const sdk = getReadySdk(); const sdk = getReadySdk();
const channel = await sdk.getVideoChannel({ const channel = await sdk.getVideoChannel({
channel: context.params?.uid?.toString() ?? "", channel: context.params?.uid ? context.params.uid.toString() : "",
}); });
if (!channel.videoChannels?.data[0].attributes) return { notFound: true }; if (!channel.videoChannels?.data[0].attributes) return { notFound: true };
const props: Props = { const props: Props = {
...(await getAppStaticProps(context)), ...(await getAppStaticProps(context)),
channel: channel.videoChannels?.data[0].attributes, channel: channel.videoChannels.data[0].attributes,
}; };
return { return {
props: props, props: props,

View File

@ -81,6 +81,7 @@ export default function Content(props: Props): JSX.Element {
textSetLocales textSetLocales
) )
); );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appLayout.preferredLanguages]); }, [appLayout.preferredLanguages]);
useEffect(() => { useEffect(() => {
@ -88,6 +89,7 @@ export default function Content(props: Props): JSX.Element {
setSelectedTextSet(content?.text_set?.[selectedTextSetIndex]); setSelectedTextSet(content?.text_set?.[selectedTextSetIndex]);
if (selectedTextSetIndex !== undefined) if (selectedTextSetIndex !== undefined)
setSelectedTitle(content?.titles?.[selectedTextSetIndex]); setSelectedTitle(content?.titles?.[selectedTextSetIndex]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedTextSetIndex]); }, [selectedTextSetIndex]);
const subPanel = ( const subPanel = (

View File

@ -61,7 +61,7 @@ function prettyTestWritter(
level, level,
`${process.env.NEXT_PUBLIC_URL_SELF}/${locale}${asPath}`, `${process.env.NEXT_PUBLIC_URL_SELF}/${locale}${asPath}`,
locale, locale,
subCategory?.join(" -> "), subCategory.join(" -> "),
message, message,
process.env.NEXT_PUBLIC_URL_CMS + url, process.env.NEXT_PUBLIC_URL_CMS + url,
]; ];
@ -75,6 +75,7 @@ function prettyTestWritter(
} }
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function useTestingContent(props: { function useTestingContent(props: {
content: Exclude< content: Exclude<
GetContentTextQuery["contents"], GetContentTextQuery["contents"],
@ -183,6 +184,7 @@ function useTestingContent(props: {
} }
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function useTestingLibrary(props: { function useTestingLibrary(props: {
item: Exclude< item: Exclude<
GetLibraryItemQuery["libraryItems"], GetLibraryItemQuery["libraryItems"],
@ -509,6 +511,7 @@ function useTestingLibrary(props: {
} }
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function useTestingChronology(props: { function useTestingChronology(props: {
chronologyItems: Exclude< chronologyItems: Exclude<
GetChronologyItemsQuery["chronologyItems"], GetChronologyItemsQuery["chronologyItems"],

View File

@ -137,7 +137,7 @@ export async function getStaticProps(
): Promise<{ notFound: boolean } | { props: Props }> { ): Promise<{ notFound: boolean } | { props: Props }> {
const sdk = getReadySdk(); const sdk = getReadySdk();
const item = await sdk.getLibraryItemScans({ const item = await sdk.getLibraryItemScans({
slug: context.params?.slug?.toString() ?? "", slug: context.params?.slug ? context.params.slug.toString() : "",
language_code: context.locale ?? "en", language_code: context.locale ?? "en",
}); });
if (!item.libraryItems) return { notFound: true }; if (!item.libraryItems) return { notFound: true };