From 418669b0c6a742379d8bbabd6cd44469bf81fe06 Mon Sep 17 00:00:00 2001 From: Dale Seo Date: Wed, 1 Jan 2025 15:06:42 -0500 Subject: [PATCH] enforce type keyword when importing types --- src/api/infra/gitHub/gitHubClient.test.ts | 2 +- src/api/services/fetch/fetchService.test.ts | 8 ++++++-- src/api/services/process/processService.test.ts | 2 +- src/api/services/process/processService.ts | 7 +------ src/components/Card/Card.tsx | 2 +- src/components/GradeImage/GradeImage.tsx | 2 +- src/components/Sidebar/Sidebar.tsx | 2 +- src/components/Spinner/Spinner.tsx | 2 +- src/pages/Certificate/Certificate.test.tsx | 2 +- tsconfig.app.json | 3 ++- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/api/infra/gitHub/gitHubClient.test.ts b/src/api/infra/gitHub/gitHubClient.test.ts index 5044fc05..99b17e0d 100644 --- a/src/api/infra/gitHub/gitHubClient.test.ts +++ b/src/api/infra/gitHub/gitHubClient.test.ts @@ -1,7 +1,7 @@ import { test, expect, beforeEach, vi } from "vitest"; import { mock } from "vitest-mock-extended"; import { createGitHubClient } from "./gitHubClient"; -import { GitHubMember, GitHubTeam, GitHubTree } from "./types"; +import type { GitHubMember, GitHubTeam, GitHubTree } from "./types"; // Mock data const mockGitHubTeams = mock(); diff --git a/src/api/services/fetch/fetchService.test.ts b/src/api/services/fetch/fetchService.test.ts index f5c4cd12..dd4b4529 100644 --- a/src/api/services/fetch/fetchService.test.ts +++ b/src/api/services/fetch/fetchService.test.ts @@ -2,8 +2,12 @@ import { beforeEach, expect, test, vi } from "vitest"; import { mock } from "vitest-mock-extended"; import { createGitHubClient } from "../../infra/gitHub/gitHubClient"; import { createFetchService } from "./fetchService"; -import { Grade } from "../types"; -import { GitHubMember, GitHubTeam, GitHubTree } from "../../infra/gitHub/types"; +import type { Grade } from "../types"; +import type { + GitHubMember, + GitHubTeam, + GitHubTree, +} from "../../infra/gitHub/types"; // Mock data const dummyConfig = { diff --git a/src/api/services/process/processService.test.ts b/src/api/services/process/processService.test.ts index 97f46ae8..08ac994b 100644 --- a/src/api/services/process/processService.test.ts +++ b/src/api/services/process/processService.test.ts @@ -4,7 +4,7 @@ import { mock } from "vitest-mock-extended"; import { problems } from "../../constants/problems"; import type { Config } from "../../config/types"; -import { Grade, MemberIdentity, Submission } from "../types"; +import type { Grade, MemberIdentity, Submission } from "../types"; import { createProcessService } from "./processService"; // Mock data diff --git a/src/api/services/process/processService.ts b/src/api/services/process/processService.ts index dfa7c157..3f491562 100644 --- a/src/api/services/process/processService.ts +++ b/src/api/services/process/processService.ts @@ -1,11 +1,6 @@ import { problemMap } from "../../constants/problems"; import type { Config } from "../../config/types"; -import { - Grade, - type Member, - type MemberIdentity, - type Submission, -} from "../types"; +import type { Grade, Member, MemberIdentity, Submission } from "../types"; export function createProcessService(config: Config) { return { diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 7303ca51..0172d974 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,4 +1,4 @@ -import { Grade } from "../../api/services/types"; +import type { Grade } from "../../api/services/types"; import GradeImage from "../GradeImage/GradeImage"; import Link from "../Link/Link"; import styles from "./Card.module.css"; diff --git a/src/components/GradeImage/GradeImage.tsx b/src/components/GradeImage/GradeImage.tsx index f6fab2ae..76d80a56 100644 --- a/src/components/GradeImage/GradeImage.tsx +++ b/src/components/GradeImage/GradeImage.tsx @@ -1,4 +1,4 @@ -import { Grade } from "../../api/services/types"; +import type { Grade } from "../../api/services/types"; import SeedImage from "../../assets/GradeSeed.png"; import SproutImage from "../../assets/GradeSprout.png"; import LeafImage from "../../assets/GradeLeaf.png"; diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index ceb82fbb..4781ef72 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from "react"; -import { Grade } from "../../api/services/types"; +import type { Grade } from "../../api/services/types"; import Github from "../../assets/Github.png"; import GradeImage from "../GradeImage/GradeImage"; import styles from "./Sidebar.module.css"; diff --git a/src/components/Spinner/Spinner.tsx b/src/components/Spinner/Spinner.tsx index fd8a75ba..3fb67fdd 100644 --- a/src/components/Spinner/Spinner.tsx +++ b/src/components/Spinner/Spinner.tsx @@ -1,4 +1,4 @@ -import { HTMLAttributes } from "react"; +import type { HTMLAttributes } from "react"; import styles from "./Spinner.module.css"; export default function Spinner(props: HTMLAttributes) { diff --git a/src/pages/Certificate/Certificate.test.tsx b/src/pages/Certificate/Certificate.test.tsx index a363071e..298119a1 100644 --- a/src/pages/Certificate/Certificate.test.tsx +++ b/src/pages/Certificate/Certificate.test.tsx @@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event"; import { afterAll, expect, test, vi } from "vitest"; import { mock } from "vitest-mock-extended"; -import { Member } from "../../api/services/types"; +import type { Member } from "../../api/services/types"; import useMembers from "../../hooks/useMembers"; import Certificate from "./Certificate"; import { gradeEmojiMap } from "./constants"; diff --git a/tsconfig.app.json b/tsconfig.app.json index f333dd44..9acffca6 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -18,7 +18,8 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "verbatimModuleSyntax": true }, "include": [ "src",