Skip to content

Commit 5929410

Browse files
committed
refactor: fix eslint errors
1 parent b29daad commit 5929410

24 files changed

+115
-111
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const ERROR = 2
55
/* eslint-enable @typescript-eslint/no-unused-vars */
66

77
module.exports = {
8+
reportUnusedDisableDirectives: true,
89
parser: "@typescript-eslint/parser",
910
parserOptions: {
1011
ecmaVersion: 2020,
@@ -42,5 +43,7 @@ module.exports = {
4243
// jsx-ally
4344
"jsx-a11y/no-onchange": WARN,
4445
"import/no-anonymous-default-export": OFF,
46+
// next
47+
"@next/next/no-img-element": OFF,
4548
},
4649
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"devDependencies": {
3636
"@next/bundle-analyzer": "^13.4.5",
3737
"@types/react-helmet": "^6.1.6",
38+
"@types/react": "^18.3.11",
3839
"@typescript-eslint/eslint-plugin": "^5.59.11",
3940
"@typescript-eslint/parser": "^5.59.11",
4041
"cross-env": "^7.0.3",
@@ -60,7 +61,8 @@
6061
"dev": "next dev",
6162
"format": "prettier . --check",
6263
"format:fix": "prettier . --write",
63-
"lint": "next lint --fix",
64+
"lint": "next lint",
65+
"lint:fix": "next lint --fix",
6466
"now-build": "pnpm run build",
6567
"start": "next start",
6668
"typecheck": "tsc --noEmit",

pnpm-lock.yaml

Lines changed: 14 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ApiFormState.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { memo } from "react"
2+
import API from "../data/api"
23
import typographyStyles from "../styles/typography.module.css"
34
import FormStateTable from "./FormStateTable"
45
import TabGroup from "./TabGroup"
56
import CodeArea from "./CodeArea"
67
import formStateUseEffect from "./codeExamples/formStateUseEffect"
78
import formStateUseEffectTs from "./codeExamples/formStateUseEffectTs"
89

9-
function ApiFormState({ api }: { api: any }) {
10+
function ApiFormState({ api }: { api: typeof API }) {
1011
return (
1112
<>
1213
<code className={typographyStyles.codeHeading}>

src/components/ApiRefTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useState } from "react"
22
import CodeArea from "./CodeArea"
33
import generic from "../data/generic"
4+
import apiData from "../data/api"
45
import typographyStyles from "../styles/typography.module.css"
56
import tableStyles from "../styles/table.module.css"
67
import styles from "./ApiRefTable.module.css"
78
import register from "./codeExamples/register"
89
import registerTs from "./codeExamples/registerTs"
910

10-
export default function ApiRefTable({ api }: { api: any }) {
11+
export default function ApiRefTable({ api }: { api: typeof apiData }) {
1112
const [isStandard, toggleOption] = useState(true)
1213

1314
return (

src/components/BuilderPage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useState, useRef, useEffect, memo, RefObject } from "react"
2+
import { useRouter } from "next/router"
13
import { Animate } from "react-simple-animate"
24
import { useForm } from "react-hook-form"
35
import SortableContainer from "./SortableContainer"
@@ -16,10 +18,8 @@ import containerStyles from "../styles/container.module.css"
1618
import typographyStyles from "../styles/typography.module.css"
1719
import CodeArea from "./CodeArea"
1820
import ClipBoard from "./ClipBoard"
19-
import { useState, useRef, useEffect, memo, RefObject } from "react"
2021
import styles from "./BuilderPage.module.css"
2122
import { BeekaiBuilderPage } from "./BeekaiBuilderPage"
22-
import { useRouter } from "next/router"
2323

2424
const errorStyle = {
2525
border: `1px solid ${colors.secondary}`,
@@ -110,15 +110,15 @@ function BuilderPage({
110110

111111
useEffect(() => {
112112
setValue("toggle", shouldToggleOn)
113-
}, [shouldToggleOn])
113+
}, [setValue, shouldToggleOn])
114114

115115
useEffect(() => {
116116
if (editFormData.type) setValue("type", editFormData.type)
117-
}, [editFormData.type])
117+
}, [editFormData.type, setValue])
118118

119119
useEffect(() => {
120120
setValue("required", editFormData.required)
121-
}, [editIndex])
121+
}, [editFormData.required, editIndex, setValue])
122122

123123
const child = (
124124
<div className={containerStyles.container}>

src/components/CodeCompareSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { memo } from "react"
22
import reactHookFormCode from "./codeExamples/reactHookFormCode"
33
import CodeArea from "./CodeArea"
44
import { AnimateGroup, Animate } from "react-simple-animate"
5-
import colors from "../styles/colors"
65
import home from "../data/home"
76
import typographyStyles from "../styles/typography.module.css"
87
import containerStyles from "../styles/container.module.css"

src/components/DevToolFeaturesList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { memo } from "react"
22
import { AnimateGroup, AnimateKeyframes } from "react-simple-animate"
33
import home from "../data/home"
44
import generic from "../data/generic"
5+
import type devToolsContent from "../data/devtools"
56
import typographyStyles from "../styles/typography.module.css"
67
import styles from "./DevToolFeaturesList.module.css"
78
import { AnimateKeyframesProps } from "react-simple-animate/dist/types"
@@ -18,16 +19,15 @@ const animationKeyFramesProps: AnimateKeyframesProps = {
1819
}
1920

2021
interface Props {
21-
isPlayFeature: boolean
22-
content: any
22+
content: typeof devToolsContent
2323
}
2424

25-
function FeaturesList({ isPlayFeature, content }: Props) {
25+
const FeaturesList = ({ content }: Props) => {
2626
return (
2727
<div className={styles.features}>
2828
<h2 className={typographyStyles.title}>{generic.features}</h2>
2929

30-
<AnimateGroup play={isPlayFeature}>
30+
<AnimateGroup play>
3131
<div className={styles.featuresContent}>
3232
<article>
3333
<AnimateKeyframes {...animationKeyFramesProps} sequenceIndex={0}>

src/components/DevTools.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import CodeArea from "./CodeArea"
88
import code from "./codeExamples/devTool"
99
import copyClipBoard from "./utils/copyClipBoard"
1010
import generic from "../data/generic"
11+
import content from "../data/devtools"
1112
import typographyStyles from "../styles/typography.module.css"
1213
import containerStyles from "../styles/container.module.css"
1314
import buttonStyles from "../styles/button.module.css"
@@ -27,11 +28,7 @@ const DevTool = dynamic<DevtoolUIProps>(
2728
}
2829
)
2930

30-
interface Props {
31-
content: any
32-
}
33-
34-
export default function DevTools({ content }: Props) {
31+
export default function DevTools() {
3532
const methods = useForm({
3633
mode: "onChange",
3734
})
@@ -68,7 +65,7 @@ export default function DevTools({ content }: Props) {
6865
)}
6966
/>
7067

71-
<DevToolFeaturesList isPlayFeature content={content} />
68+
<DevToolFeaturesList content={content} />
7269

7370
<div className={containerStyles.centerContent}>
7471
<h1 className={typographyStyles.h1}>

src/components/Form.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ function Form({
2929
methods,
3030
devTool,
3131
}: {
32-
onSubmit: (data: any) => void
33-
submitData: any
32+
onSubmit: (data: Record<string, unknown>) => void
33+
submitData: Record<string, unknown>
3434
toggleBuilder: (state: boolean) => void
3535
formUpdated: boolean
36-
methods: UseFormReturn<FieldValues, any, undefined>
36+
methods: UseFormReturn<FieldValues, Record<string, unknown>, undefined>
3737
devTool?: boolean
3838
}) {
3939
const { register, handleSubmit, watch, formState, reset } = methods
@@ -138,6 +138,7 @@ function Form({
138138
JSON.stringify(
139139
Object.entries(errors).reduce(
140140
// @ts-expect-error needed for previous
141+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
141142
(previous, [key, { ref, ...rest }]) => {
142143
previous[key] = rest
143144
return previous

0 commit comments

Comments
 (0)