From 4ab8a2821f7de9e21c27bba7ddc9e917c875b5ae Mon Sep 17 00:00:00 2001 From: Marco Pasqualetti Date: Sat, 14 Dec 2024 14:47:46 +0100 Subject: [PATCH 1/2] refactor: fix typecheck errors and add script execution to CI --- .github/workflows/ci.yml | 2 +- src/components/BuilderPage.tsx | 7 ++++--- src/components/mdx/theme.ts | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b0e12aac..47621175e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: true matrix: - script: [format, lint] + script: [format, lint, typecheck] steps: - name: Checkout repo diff --git a/src/components/BuilderPage.tsx b/src/components/BuilderPage.tsx index 008823291..f23d43e59 100644 --- a/src/components/BuilderPage.tsx +++ b/src/components/BuilderPage.tsx @@ -4,6 +4,7 @@ import { Animate } from "react-simple-animate" import { useForm } from "react-hook-form" import SortableContainer from "./SortableContainer" import { useStateMachine } from "little-state-machine" +import type { GlobalState } from "little-state-machine" import colors from "../styles/colors" import generateCode from "./logic/generateCode" import copyClipBoard from "./utils/copyClipBoard" @@ -65,7 +66,7 @@ function BuilderPage({ useForm() const errors = formState.errors const [editIndex, setEditIndex] = useState(-1) - const copyFormData = useRef([]) + const copyFormData = useRef([]) const closeButton = useRef(null) const [showValidation, toggleValidation] = useState(false) const onSubmit = (data) => { @@ -90,7 +91,7 @@ function BuilderPage({ editFormData.minLength || editFormData.required copyFormData.current = formData - const editIndexRef = useRef(null) + const editIndexRef = useRef(null) editIndexRef.current = editIndex const router = useRouter() @@ -440,7 +441,7 @@ function BuilderPage({ aria-label="close builder" ref={closeButton} onClick={() => { - toggleBuilder(false) + toggleBuilder?.(false) goToBuilder(false) }} > diff --git a/src/components/mdx/theme.ts b/src/components/mdx/theme.ts index 58b1ae55e..15d5c1690 100644 --- a/src/components/mdx/theme.ts +++ b/src/components/mdx/theme.ts @@ -1,5 +1,4 @@ -// @ts-expect-error currently not being exported https://github.com/FormidableLabs/prism-react-renderer/issues/206 -import { PrismTheme } from "prism-react-renderer" +import type { PrismTheme } from "prism-react-renderer" export const theme: PrismTheme = { plain: { From e5ff202815ec6622ceb4c4b78e2dee8f756d1835 Mon Sep 17 00:00:00 2001 From: Marco Pasqualetti Date: Sat, 14 Dec 2024 15:13:32 +0100 Subject: [PATCH 2/2] ci: add `typecheck:ci` script --- .github/workflows/ci.yml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47621175e..54f52f9ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: true matrix: - script: [format, lint, typecheck] + script: ["format", "lint", "typecheck:ci"] steps: - name: Checkout repo diff --git a/package.json b/package.json index 805556920..7c9892363 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "now-build": "pnpm run build", "start": "next start", "typecheck": "tsc --noEmit", + "typecheck:ci": "next build --no-lint && tsc --noEmit", "prepare": "husky install" }, "lint-staged": {