Skip to content

Commit fd59cb2

Browse files
committed
Update master-ko (deep-merge package.json, keep local files including README.md)
1 parent 72a94c8 commit fd59cb2

16 files changed

Lines changed: 2971 additions & 2118 deletions

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@
33
# dependencies
44
/node_modules
55
/.pnp
6-
.yarn/*
7-
!.yarn/patches
8-
!.yarn/releases
9-
!.yarn/plugins
10-
!.yarn/sdks
11-
!.yarn/versions
126
.pnp.*
137

14-
158
# testing
169
/coverage
1710

@@ -33,6 +26,7 @@ yarn-error.log*
3326
.idea
3427
.cache/
3528
package-lock.json
29+
.vscode
3630
tsconfig.tsbuildinfo
3731
.next/
3832

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.18.1

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pnpm-lock.yaml
2+
.cache/
3+
.contentlayer/
4+
.next/

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
23
"endOfLine": "lf",
34
"semi": false,
45
"singleQuote": false,

CONTRIBUTING.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,52 @@ Here is a quick guide to doing code contributions to the library.
1212

1313
3. Install packages by running:
1414

15-
> yarn
15+
```shellscript
16+
pnpm install
17+
```
1618

1719
4. Startup a local version of the docs
1820

19-
> yarn start
21+
```shellscript
22+
pnpm run dev
23+
```
2024

2125
5. Ensure your code is formatted properly
2226

23-
> yarn format
27+
```shellscript
28+
pnpm run format
29+
```
2430

2531
6. Push your branch: `git push -u origin your-meaningful-branch-name`
2632

2733
7. Submit a pull request to the upstream react-hook-form repository.
2834

2935
8. Choose a descriptive title and describe your changes briefly.
3036

37+
## Testing production build
38+
39+
To test the documentation production site on your local machine,
40+
first execute the build script:
41+
42+
```shellscript
43+
pnpm run build
44+
```
45+
46+
Then start a local server which serves the file created by executing
47+
48+
```shellscript
49+
pnpm run start
50+
```
51+
3152
## Coding style
3253

33-
Please follow the coding style of the project. React Hook Form uses prettier. If possible, enable the prettier plugin in your editor to get real-time feedback. The formatting can be run manually with the following command: `yarn format`
54+
Please follow the coding style of the project.
55+
React Hook Form uses prettier.
56+
If possible, enable the prettier plugin in your editor to get real-time feedback. The formatting can be run manually with the following command:
57+
58+
```shellscript
59+
pnpm run format:fix
60+
```
3461

3562
## License
3663

changes.diff

Whitespace-only changes.

contentlayer.config.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import remarkGfm from "remark-gfm"
44
import rehypeMdxCodeProps from "rehype-mdx-code-props"
55
import emoji from "remark-emoji"
66
import * as sidebar from "./src/components/Menu/MenuLinks"
7+
import type { Pages } from "./src/types/types"
78

89
export const Doc = defineDocumentType(() => ({
910
name: "Doc",
@@ -33,13 +34,22 @@ export const Doc = defineDocumentType(() => ({
3334
type: "string",
3435
resolve: (doc) => doc._raw.flattenedPath.split("/").slice(1).join("/"),
3536
},
37+
38+
/**
39+
* Can't define value different from primitives, so hardcoding the correct type
40+
* @see https://github.com/contentlayerdev/contentlayer/issues/149
41+
*/
3642
segment: {
37-
type: "list",
43+
type: "string[]" as "list",
3844
resolve: (doc) => doc._raw.flattenedPath.split("/"),
3945
},
4046
pages: {
41-
type: "list",
42-
resolve: (doc) => sidebar[doc.sidebar] ?? [],
47+
type: "json",
48+
resolve: (doc) => {
49+
// added explicit type casting to keep track of this data structure
50+
// in case in the future contentlayer will support values different than primitives
51+
return sidebar[doc.sidebar] as unknown as Pages
52+
},
4353
},
4454
},
4555
}))

eslint.config.mjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// @ts-check
2+
import tseslint from "typescript-eslint"
3+
import { FlatCompat } from "@eslint/eslintrc"
4+
import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y"
5+
import eslintPluginReact from "eslint-plugin-react"
6+
7+
const compat = new FlatCompat({
8+
baseDirectory: import.meta.dirname,
9+
})
10+
11+
export default tseslint.config(
12+
tseslint.configs.recommendedTypeChecked,
13+
14+
...compat.config({
15+
extends: ["next"],
16+
rules: {
17+
// react
18+
"react/prop-types": "off",
19+
"react/no-unescaped-entities": "off",
20+
"react/jsx-curly-brace-presence": "warn",
21+
22+
// jsx-ally is already included in next-js so
23+
// we are adding only recommended rules directly here
24+
...eslintPluginJsxA11y.flatConfigs.recommended.rules,
25+
"jsx-a11y/no-onchange": "warn",
26+
27+
// import
28+
"import/no-anonymous-default-export": "off",
29+
30+
// next
31+
"@next/next/no-img-element": "off",
32+
},
33+
}),
34+
35+
// @ts-expect-error eslintPluginReact.configs.flat, but runtime is always defined
36+
eslintPluginReact.configs.flat["jsx-runtime"],
37+
38+
{
39+
linterOptions: {
40+
reportUnusedDisableDirectives: "error",
41+
},
42+
languageOptions: {
43+
parserOptions: {
44+
projectService: true,
45+
tsconfigRootDir: import.meta.dirname,
46+
},
47+
},
48+
rules: {
49+
// typescript
50+
"@typescript-eslint/explicit-function-return-type": "off",
51+
"@typescript-eslint/explicit-module-boundary-types": "off",
52+
"@typescript-eslint/interface-name-prefix": "off",
53+
"@typescript-eslint/no-floating-promises": "off",
54+
"@typescript-eslint/restrict-template-expressions": [
55+
"error",
56+
{
57+
allowAny: false,
58+
allowBoolean: false,
59+
allowNever: false,
60+
allowNullish: false,
61+
allowNumber: true,
62+
allowRegExp: false,
63+
},
64+
],
65+
},
66+
}
67+
)

next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
6+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

next.config.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { NextConfig } from "next"
2+
import { withContentlayer } from "next-contentlayer"
3+
import withBundleAnalyzer from "@next/bundle-analyzer"
4+
5+
const nextConfig: NextConfig = {
6+
eslint: {
7+
/**
8+
* Now eslint requires typecheck so we have to run build before executing lint
9+
* These check are performed via `.github/workflows/ci.yml` action
10+
*
11+
* @see https://github.com/react-hook-form/documentation/pull/1107
12+
*/
13+
ignoreDuringBuilds: true,
14+
},
15+
typescript: {
16+
/** @see `eslint.ignoreDuringBuilds` comment */
17+
ignoreBuildErrors: true,
18+
},
19+
reactStrictMode: true,
20+
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
21+
}
22+
23+
const bundleAnalyzer = withBundleAnalyzer({
24+
enabled: process.env.ANALYZE === "true",
25+
})
26+
27+
export default bundleAnalyzer(withContentlayer(nextConfig))

0 commit comments

Comments
 (0)