Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding formstate, register, setvalue + minor bug fixes #1007

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ module.exports = {
},
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"next",
"next/core-web-vitals",
"plugin:react/jsx-runtime",
],
settings: {
Expand All @@ -31,16 +30,7 @@ module.exports = {
},
},
rules: {
// typescript
"@typescript-eslint/explicit-function-return-type": OFF,
"@typescript-eslint/interface-name-prefix": OFF,
"@typescript-eslint/explicit-module-boundary-types": OFF,
// react
"react/prop-types": OFF,
"react/no-unescaped-entities": OFF,
"react/jsx-curly-brace-presence": "warn",
// jsx-ally
"jsx-a11y/no-onchange": WARN,
"import/no-anonymous-default-export": OFF,
"@typescript-eslint/no-explicit-any": OFF,
},
}
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel:
staleLabel:
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lock-issue.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'Lock Issues'
name: "Lock Issues"

on:
workflow_dispatch:
schedule:
- cron: '0 0,6,12,18 * * *'
- cron: "0 0,6,12,18 * * *"

permissions:
issues: write
Expand Down
2 changes: 1 addition & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const Doc = defineDocumentType(() => ({
},
pages: {
type: "list",
resolve: (doc) => sidebar[doc.sidebar] ?? [],
resolve: (doc) => sidebar[doc.sidebar.trim()] ?? [],
},
},
}))
Expand Down
3 changes: 0 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import withBundleAnalyzer from "@next/bundle-analyzer"

/** @type {import('next').NextConfig} */
const nextConfig = {
typescript: {
ignoreBuildErrors: true,
},
reactStrictMode: true,
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
}
Expand Down
48 changes: 23 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@
"author": "beier luo",
"dependencies": {
"@hookform/devtools": "4.3.1",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.5",
"@types/node": "^20.3.1",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"contentlayer": "^0.3.3",
"date-fns": "^2.30.0",
"@types/node": "^20.4.9",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"contentlayer": "^0.3.4",
"little-state-machine": "^4.8.0",
"next": "^13.4.5",
"next-contentlayer": "^0.3.3",
"next": "^13.4.13",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.2.1",
"prism-react-renderer": "^2.0.5",
"prism-react-renderer": "^2.0.6",
"prismjs": "^1.29.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-github-btn": "1.4.0",
"react-hook-form": "7.44.3",
"react-hook-form": "7.45.4",
"react-simple-animate": "^3.5.2",
"react-simple-img": "3.0.0",
"react-sortablejs": "1.5.1",
Expand All @@ -33,21 +29,22 @@
"sortablejs": "1.15.0"
},
"devDependencies": {
"@next/bundle-analyzer": "^13.4.5",
"@next/bundle-analyzer": "^13.4.13",
"@types/react-helmet": "^6.1.6",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"concurrently": "^8.2.0",
"cross-env": "^7.0.3",
"eslint": "^8.42.0",
"eslint-config-next": "^13.4.5",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.46.0",
"eslint-config-next": "^13.4.13",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"typescript": "^5.1.3"
"lint-staged": "^13.2.3",
"prettier": "^3.0.1",
"typescript": "^5.1.6"
},
"keywords": [
"react-hook-form",
Expand All @@ -58,12 +55,13 @@
"analyze": "cross-env ANALYZE=true next build",
"build": "next build",
"dev": "next dev",
"format": "prettier --write",
"format": "prettier . --write",
"lint": "next lint --fix",
"now-build": "npm run build",
"prebuild": "contentlayer build",
"prepare": "husky install",
"start": "next start",
"typecheck": "tsc --noEmit",
"prepare": "husky install"
"typecheck": "tsc --noEmit"
},
"lint-staged": {
"*.{ts,tsx,mdx,css,json}": [
Expand Down
85 changes: 0 additions & 85 deletions src/components/ApiFormState.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions src/components/ApiGallery.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect } from "react"
import Link from "next/link"
import Footer from "./Footer"
import typographyStyles from "../styles/typography.module.css"
Expand All @@ -20,35 +19,6 @@ export default function ApiGallery() {
}
}

useEffect(() => {
const name = window.location.hash.toLowerCase().slice(1)

if (name === "controller") {
router.push(`/docs/usecontroller/${name}`)
} else if (
[
"register",
"unregister",
"watch",
"handlesubmit",
"reset",
"setError",
"clearerrors",
"setvalues",
"getvalues",
"trigger",
"control",
"formstate",
].includes(name)
) {
router.push(`/docs/useform/${name}`)
} else if (
["controller", "useformcontext", "usefieldarray"].includes(name)
) {
router.push(`/docs/${name}`)
}
}, [router])

return (
<div className={containerStyles.container}>
<h1 className={typographyStyles.headingWithTopMargin} id="main">
Expand Down