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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -103,12 +103,12 @@ export async function getStaticProps(
): Promise<{ notFound: boolean } | { props: Props }> {
const sdk = getReadySdk();
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 };
const props: Props = {
...(await getAppStaticProps(context)),
channel: channel.videoChannels?.data[0].attributes,
channel: channel.videoChannels.data[0].attributes,
};
return {
props: props,

View File

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

View File

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

View File

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