diff --git a/gatsby-node.ts b/gatsby-node.ts index 0afa3f4b..d196b6cd 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -80,7 +80,12 @@ export const createPages: GatsbyNode["createPages"] = async (api) => { return; } - const pages = res.data?.allMarkdownRemark.nodes!; + const pages = res.data?.allMarkdownRemark.nodes; + if (!pages) { + api.reporter.error("unreachable"); + return; + } + const component = path.resolve("src/templates/blog-post.tsx"); for (let i = 0; i < pages.length; ++i) { const slug = path.basename(pages[i].parent.name); diff --git a/src/components/date.test.tsx b/src/components/date.test.tsx index e3e717ac..7951e9cb 100644 --- a/src/components/date.test.tsx +++ b/src/components/date.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { DateString } from "./date"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders correctly", () => { diff --git a/src/components/footer.test.tsx b/src/components/footer.test.tsx index 701bcd04..d9139a95 100644 --- a/src/components/footer.test.tsx +++ b/src/components/footer.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { Footer } from "./footer"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders correctly", () => { diff --git a/src/components/header.test.tsx b/src/components/header.test.tsx index 5ef6f16d..7254fb99 100644 --- a/src/components/header.test.tsx +++ b/src/components/header.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { Header } from "./header"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders correctly", () => { diff --git a/src/components/navigation.test.tsx b/src/components/navigation.test.tsx index 89a59d42..5143f3f7 100644 --- a/src/components/navigation.test.tsx +++ b/src/components/navigation.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { Navigation } from "./navigation"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders correctly", () => { diff --git a/src/components/prev-next-link.test.tsx b/src/components/prev-next-link.test.tsx index 60d4c990..97e339a7 100644 --- a/src/components/prev-next-link.test.tsx +++ b/src/components/prev-next-link.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { PrevNextLink } from "./prev-next-link"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders both prev and next correctly", () => { diff --git a/src/components/questions.test.tsx b/src/components/questions.test.tsx index dcf1790d..1f5dc46a 100644 --- a/src/components/questions.test.tsx +++ b/src/components/questions.test.tsx @@ -1,5 +1,6 @@ import { expect, it } from "vitest"; import { Questions } from "./questions"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders correctly", () => { diff --git a/src/components/sns-link.test.tsx b/src/components/sns-link.test.tsx index ec8b9491..68650d4e 100644 --- a/src/components/sns-link.test.tsx +++ b/src/components/sns-link.test.tsx @@ -1,4 +1,5 @@ import { expect, it } from "vitest"; +import React from "react"; import { SNSLink } from "./sns-link"; import { render } from "../../utils/react-test"; diff --git a/src/components/title.test.tsx b/src/components/title.test.tsx index 7a759cba..7305ef57 100644 --- a/src/components/title.test.tsx +++ b/src/components/title.test.tsx @@ -1,5 +1,6 @@ import { Subtitle, Title } from "./title"; import { expect, it } from "vitest"; +import React from "react"; import { render } from "../../utils/react-test"; it("renders title correctly", () => { diff --git a/src/pages/blog.tsx b/src/pages/blog.tsx index cf0013ab..14d2a08a 100644 --- a/src/pages/blog.tsx +++ b/src/pages/blog.tsx @@ -19,6 +19,8 @@ function BlogCard({ parent, }: Queries.BlogEntriesQuery["allMarkdownRemark"]["nodes"][number]): JSX.Element { const title = frontmatter?.title ?? "無題"; + // NOTE: it will be fixed in PR #395. + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain const slug = (parent as { name?: string })?.name!; return (