Skip to content

Commit c888534

Browse files
committed
chore: fix types and add type lint command
1 parent 19a1f92 commit c888534

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"prettier:check": "prettier --config .prettierrc.json --check",
1313
"prettier:write": "prettier --config .prettierrc.json --write",
1414
"eslint:check": "eslint -c .eslintrc.json",
15-
"lint": "next lint"
15+
"lint:types": "tsc --noEmit",
16+
"lint": "npm run lint:types && next lint"
1617
},
1718
"repository": {
1819
"type": "git",

src/app/contribute/_components/submission-form.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ import {
99
useCallback,
1010
useState,
1111
} from "react"
12-
import { TinaMarkdown } from "tinacms/dist/rich-text"
12+
import { Components, TinaMarkdown } from "tinacms/dist/rich-text"
1313
import { ContentBlocksContribute } from "@/tina/__generated__/types"
1414

1515
const method = "POST"
1616
const headers = { "Content-Type": "application/json" }
1717

18+
type MarkdownComponents =
19+
| Components<object>
20+
| Components<{ [x: string]: (props: object) => JSX.Element }>
21+
| undefined
22+
1823
const Field = ({
1924
isTextarea,
2025
...fieldProps
@@ -118,9 +123,11 @@ export function SubmissionForm({ ...contentBlock }: ContentBlocksContribute) {
118123
<div className="my-12 rounded-md border-2 border-solid border-slate-800 p-5">
119124
<TinaMarkdown
120125
content={formSuccessMessage}
121-
components={{
122-
p: (props) => <p className="mb-4 text-success" {...props} />,
123-
}}
126+
components={
127+
{
128+
p: (props) => <p className="mb-4 text-success" {...props} />,
129+
} as MarkdownComponents
130+
}
124131
/>
125132
<button className="btn btn-outline btn-sm" onClick={handleRefreshClick}>
126133
Submit Another Game ↻
@@ -134,16 +141,18 @@ export function SubmissionForm({ ...contentBlock }: ContentBlocksContribute) {
134141
<div className="rounded-md border-2 border-solid border-slate-800 p-5">
135142
<TinaMarkdown
136143
content={formHeader}
137-
components={{
138-
h2: (props) => (
139-
<h2 className="mb-4 text-2xl font-bold" {...props} />
140-
),
141-
p: (props) => <p className="mb-4" {...props} />,
142-
ul: (props) => <ul className="list-disc ps-4" {...props} />,
143-
hr: (props) => (
144-
<div className="divider" role="separator" {...props} />
145-
),
146-
}}
144+
components={
145+
{
146+
h2: (props) => (
147+
<h2 className="mb-4 text-2xl font-bold" {...props} />
148+
),
149+
p: (props) => <p className="mb-4" {...props} />,
150+
ul: (props) => <ul className="list-disc ps-4" {...props} />,
151+
hr: (props) => (
152+
<div className="divider" role="separator" {...props} />
153+
),
154+
} as MarkdownComponents
155+
}
147156
/>
148157

149158
{textFields?.map((field) => {

0 commit comments

Comments
 (0)