Skip to content

Commit 2dd8bbd

Browse files
committed
test: 💍 pass all tests
1 parent 0baaa1f commit 2dd8bbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+210
-226
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- Do not add trivial comments, usually do not add blank lines inside functions.
22
- Use Angular style commits, e.g `feat: implemented xyz`.
33
- Make sure tests (`yarn test`) pass.
4-
- In the end, make sure linter and formatter pass.
4+
- When you are doing a PR, make sure linter and formatter pass.

biome.json

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"formatter": {
7-
"indentStyle": "space",
8-
"lineWidth": 120
9-
},
10-
"javascript": {
11-
"formatter": {
12-
"quoteStyle": "single",
13-
"trailingCommas": "all",
14-
"bracketSpacing": false
15-
}
16-
},
17-
"linter": {
18-
"enabled": true,
19-
"rules": {
20-
"recommended": true,
21-
"style": {
22-
"noNonNullAssertion": "off",
23-
"useNodejsImportProtocol": "off",
24-
"useTemplate": "off",
25-
"noInferrableTypes": "off",
26-
"noUselessElse": "off",
27-
"noParameterAssign": "off",
28-
"noCommaOperator": "off",
29-
"useSingleVarDeclarator": "off",
30-
"noUnusedTemplateLiteral": "off",
31-
"useDefaultParameterLast": "off",
32-
"useEnumInitializers": "off"
33-
},
34-
"suspicious": {
35-
"noExplicitAny": "off",
36-
"useIsArray": "off",
37-
"noAssignInExpressions": "off",
38-
"noConfusingVoidType": "off"
39-
},
40-
"complexity": {
41-
"noStaticOnlyClass": "off",
42-
"useOptionalChain": "off"
43-
},
44-
"security": {
45-
"noGlobalEval": "off"
46-
}
47-
}
48-
}
2+
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"formatter": {
7+
"indentStyle": "space",
8+
"lineWidth": 120
9+
},
10+
"javascript": {
11+
"formatter": {
12+
"quoteStyle": "single",
13+
"trailingCommas": "all",
14+
"bracketSpacing": false
15+
}
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true,
21+
"style": {
22+
"noNonNullAssertion": "off",
23+
"useNodejsImportProtocol": "off",
24+
"useTemplate": "off",
25+
"noInferrableTypes": "off",
26+
"noUselessElse": "off",
27+
"noParameterAssign": "off",
28+
"noCommaOperator": "off",
29+
"useSingleVarDeclarator": "off",
30+
"noUnusedTemplateLiteral": "off",
31+
"useDefaultParameterLast": "off",
32+
"useEnumInitializers": "off"
33+
},
34+
"suspicious": {
35+
"noExplicitAny": "off",
36+
"useIsArray": "off",
37+
"noAssignInExpressions": "off",
38+
"noConfusingVoidType": "off"
39+
},
40+
"complexity": {
41+
"noStaticOnlyClass": "off",
42+
"useOptionalChain": "off"
43+
},
44+
"security": {
45+
"noGlobalEval": "off"
46+
}
47+
}
48+
}
4949
}

package.json

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,14 @@
1616
"type": "github",
1717
"url": "https://github.com/sponsors/streamich"
1818
},
19-
"keywords": [
20-
"json-type",
21-
"type",
22-
"schema",
23-
"json-schema",
24-
"jtd",
25-
"json",
26-
"pointer",
27-
"jit"
28-
],
19+
"keywords": ["json-type", "type", "schema", "json-schema", "jtd", "json", "pointer", "jit"],
2920
"engines": {
3021
"node": ">=10.0"
3122
},
3223
"main": "lib/index.js",
3324
"types": "lib/index.d.ts",
3425
"typings": "lib/index.d.ts",
35-
"files": [
36-
"LICENSE",
37-
"lib/"
38-
],
26+
"files": ["LICENSE", "lib/"],
3927
"license": "Apache-2.0",
4028
"scripts": {
4129
"format": "biome format ./src",
@@ -79,16 +67,11 @@
7967
"typescript": "^5.6.2"
8068
},
8169
"jest": {
82-
"moduleFileExtensions": [
83-
"ts",
84-
"js"
85-
],
70+
"moduleFileExtensions": ["ts", "js"],
8671
"transform": {
8772
"^.+\\.ts$": "ts-jest"
8873
},
89-
"transformIgnorePatterns": [
90-
".*/node_modules/.*"
91-
],
74+
"transformIgnorePatterns": [".*/node_modules/.*"],
9275
"testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.ts$"
9376
}
9477
}

src/__bench__/encode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* tslint:disable no-console */
22

3-
import {ModuleType} from '..';
3+
import {Writer} from '@jsonjoy.com/buffers/lib/Writer';
44
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
5+
import {EncodingFormat} from '@jsonjoy.com/json-pack/lib/constants';
56
import {JsonEncoder} from '@jsonjoy.com/json-pack/lib/json/JsonEncoder';
7+
import {ModuleType} from '..';
68
import type {CompiledBinaryEncoder} from '../codegen/types';
7-
import {EncodingFormat} from '@jsonjoy.com/json-pack/lib/constants';
8-
import {Writer} from '@jsonjoy.com/buffers/lib/Writer';
99

1010
const system = new ModuleType();
1111
const {t} = system;

src/__tests__/fixtures.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* across multiple test modules.
55
*/
66

7+
import {RandomJson} from '@jsonjoy.com/json-random';
8+
import {genRandomExample} from '@jsonjoy.com/json-random/lib/examples';
79
import {s} from '../schema';
810
import {t} from '../type';
9-
import {genRandomExample} from '@jsonjoy.com/json-random/lib/examples';
10-
import {RandomJson} from '@jsonjoy.com/json-random';
1111

1212
export const randomJson = () => {
1313
return Math.random() < 0.5 ? genRandomExample() : RandomJson.generate();

src/codegen/AbstractCodege.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {JsExpression} from '@jsonjoy.com/codegen/lib/util/JsExpression';
21
import type {Codegen} from '@jsonjoy.com/codegen';
2+
import type {JsExpression} from '@jsonjoy.com/codegen/lib/util/JsExpression';
33
import type {
44
AnyType,
55
ArrType,

src/codegen/binary/AbstractBinaryCodegen.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {Codegen, CodegenStepExecJs} from '@jsonjoy.com/codegen';
21
import {concat} from '@jsonjoy.com/buffers/lib/concat';
3-
import {WriteBlobStep} from './WriteBlobStep';
4-
import {Value} from '../../value/Value';
5-
import {CapacityEstimatorCodegen} from '../capacity';
6-
import {AbstractCodegen} from '../AbstractCodege';
7-
import {floats, ints, uints} from '../../util';
2+
import {Codegen, CodegenStepExecJs} from '@jsonjoy.com/codegen';
83
import {JsExpression} from '@jsonjoy.com/codegen/lib/util/JsExpression';
9-
import {DiscriminatorCodegen} from '../discriminator';
104
import type {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types';
115
import type {
126
AnyType,
@@ -21,7 +15,13 @@ import type {
2115
StrType,
2216
Type,
2317
} from '../../type';
18+
import {floats, ints, uints} from '../../util';
19+
import {Value} from '../../value/Value';
20+
import {AbstractCodegen} from '../AbstractCodege';
21+
import {CapacityEstimatorCodegen} from '../capacity';
22+
import {DiscriminatorCodegen} from '../discriminator';
2423
import type {CompiledBinaryEncoder, SchemaPath} from '../types';
24+
import {WriteBlobStep} from './WriteBlobStep';
2525

2626
type Step = WriteBlobStep | CodegenStepExecJs;
2727

src/codegen/binary/__tests__/testBinaryCodegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {ModuleType} from '../../../type/classes/ModuleType';
21
import type {Type} from '../../../type';
2+
import {ModuleType} from '../../../type/classes/ModuleType';
33

44
export const testBinaryCodegen = (transcode: (system: ModuleType, type: Type, value: unknown) => void) => {
55
describe('"any" type', () => {

src/codegen/binary/cbor copy/CborCodegen.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {AbstractBinaryCodegen} from '../AbstractBinaryCodegen';
2-
import {writer} from '../writer';
31
import {JsExpression} from '@jsonjoy.com/codegen/lib/util/JsExpression';
2+
import {normalizeAccessor} from '@jsonjoy.com/codegen/lib/util/normalizeAccessor';
43
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
5-
import {lazyKeyedFactory} from '../../util';
6-
import {ObjKeyOptType, type MapType, type ObjType, type Type} from '../../../type';
4+
import {type MapType, ObjKeyOptType, type ObjType, type Type} from '../../../type';
75
import type {CompiledBinaryEncoder, SchemaPath} from '../../types';
8-
import {normalizeAccessor} from '@jsonjoy.com/codegen/lib/util/normalizeAccessor';
6+
import {lazyKeyedFactory} from '../../util';
7+
import {AbstractBinaryCodegen} from '../AbstractBinaryCodegen';
8+
import {writer} from '../writer';
99

1010
export class CborCodegen extends AbstractBinaryCodegen<CborEncoder> {
1111
public static readonly get = lazyKeyedFactory((type: Type, name?: string) => {

src/codegen/binary/cbor copy/__tests__/CborCodegen.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {testBinaryCodegen} from '../../__tests__/testBinaryCodegen';
21
import {Writer} from '@jsonjoy.com/buffers/lib/Writer';
3-
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
42
import {CborDecoder} from '@jsonjoy.com/json-pack/lib/cbor/CborDecoder';
5-
import {CborCodegen} from '../CborCodegen';
3+
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
64
import type {ModuleType, Type} from '../../../../type';
5+
import {testBinaryCodegen} from '../../__tests__/testBinaryCodegen';
6+
import {CborCodegen} from '../CborCodegen';
77

88
const encoder = new CborEncoder(new Writer(16));
99
const decoder = new CborDecoder();

0 commit comments

Comments
 (0)