Skip to content

Commit 41b8b5d

Browse files
committed
feat: refactor deserialization process
This refactor simplifies the TypeScript types of document results to a more readable level, as well as allowing to specifiy optional links and meta schemas for resources. BREAKING CHANGE: _links and _meta are now not included in resources by default anymore.
1 parent 73320ff commit 41b8b5d

13 files changed

+833
-1102
lines changed

.lefthook/commit-msg/commitlint.sh

-1
This file was deleted.

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,9 @@ must define one of the following two properties:
161161
> },
162162
> });
163163
> ```
164+
165+
### Resource links and meta
166+
167+
If you want to retrieve links or meta for resources, you can specify `linksSchema` and `metaSchema` respectively. Once
168+
defined, you'll either get a `$links` or `$meta` property on your resources. The `$` prefix is a design decision in
169+
order to avoid name clashes with attributes or relationships with the same name.

biome.json

+10-22
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.5.2/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
33
"organizeImports": {
44
"enabled": true
55
},
66
"files": {
7-
"include": [
8-
"biome.json",
9-
"release.config.cjs",
10-
"commitlint.config.cjs",
11-
"src/**/*",
12-
"test/**/*"
13-
]
7+
"include": ["biome.json", "commitlint.config.cjs", "src/**/*"]
148
},
159
"linter": {
1610
"enabled": true,
1711
"rules": {
1812
"recommended": true,
19-
"nursery": {
20-
"noEmptyTypeParameters": "error",
21-
"noInvalidUseBeforeDeclaration": "error",
22-
"noUnusedImports": "error",
23-
"noUnusedPrivateClassMembers": "error",
24-
"noUselessLoneBlockStatements": "error",
25-
"noUselessTernary": "error",
26-
"useExportType": "error",
27-
"useImportType": "error",
28-
"useForOf": "error",
29-
"useGroupedTypeImport": "error"
30-
},
3113
"complexity": {
3214
"noExcessiveCognitiveComplexity": "warn",
3315
"useSimplifiedLogicExpression": "error"
3416
},
3517
"correctness": {
36-
"noNewSymbol": "error"
18+
"noNewSymbol": "error",
19+
"noUnusedImports": "error",
20+
"noUnusedPrivateClassMembers": "error",
21+
"useHookAtTopLevel": "error"
3722
},
3823
"style": {
3924
"useBlockStatements": "error",
4025
"useCollapsedElseIf": "error",
26+
"useForOf": "error",
27+
"useFragmentSyntax": "error",
4128
"useShorthandArrayType": "error",
4229
"useShorthandAssign": "error",
4330
"useSingleCaseStatement": "error"
4431
},
4532
"suspicious": {
4633
"noApproximativeNumericConstant": "warn",
47-
"noConsoleLog": "error"
34+
"noConsoleLog": "error",
35+
"noEmptyBlockStatements": "error"
4836
}
4937
}
5038
},

lefthook.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ pre-commit:
55
run: npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true {staged_files} && git update-index --again
66

77
commit-msg:
8-
scripts:
9-
"commitlint.sh":
10-
runner: bash
8+
commands:
9+
lint-commit-msg:
10+
run: pnpm exec commitlint --edit

package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
"check": "biome check . --apply"
3636
},
3737
"devDependencies": {
38-
"@biomejs/biome": "1.5.2",
39-
"@commitlint/cli": "^18.4.4",
40-
"@commitlint/config-conventional": "^18.4.4",
41-
"@tsconfig/vite-react": "^3.0.0",
42-
"@vitest/coverage-v8": "^1.2.2",
43-
"lefthook": "^1.5.6",
44-
"typescript": "^5.3.3",
45-
"vite": "^5.0.12",
46-
"vite-plugin-dts": "^3.7.2",
47-
"vitest": "^1.2.2",
48-
"zod": "^3.22.4"
38+
"@biomejs/biome": "1.7.3",
39+
"@commitlint/cli": "^19.3.0",
40+
"@commitlint/config-conventional": "^19.2.2",
41+
"@tsconfig/vite-react": "^3.0.2",
42+
"@vitest/coverage-v8": "^1.6.0",
43+
"lefthook": "^1.6.11",
44+
"typescript": "^5.4.5",
45+
"vite": "^5.2.11",
46+
"vite-plugin-dts": "^3.9.1",
47+
"vitest": "^1.6.0",
48+
"zod": "^3.23.8"
4949
},
5050
"peerDependencies": {
5151
"zod": "^3.22.4"

0 commit comments

Comments
 (0)