Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Do not add trivial comments, usually do not add blank lines inside functions.
- Use Angular style commits, e.g `feat: implemented xyz`.
- Make sure tests (`yarn test`) pass.
- In the end, make sure linter and formatter pass.
- When you are doing a PR, make sure linter and formatter pass.
94 changes: 47 additions & 47 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "all",
"bracketSpacing": false
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off",
"useNodejsImportProtocol": "off",
"useTemplate": "off",
"noInferrableTypes": "off",
"noUselessElse": "off",
"noParameterAssign": "off",
"noCommaOperator": "off",
"useSingleVarDeclarator": "off",
"noUnusedTemplateLiteral": "off",
"useDefaultParameterLast": "off",
"useEnumInitializers": "off"
},
"suspicious": {
"noExplicitAny": "off",
"useIsArray": "off",
"noAssignInExpressions": "off",
"noConfusingVoidType": "off"
},
"complexity": {
"noStaticOnlyClass": "off",
"useOptionalChain": "off"
},
"security": {
"noGlobalEval": "off"
}
}
}
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "all",
"bracketSpacing": false
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off",
"useNodejsImportProtocol": "off",
"useTemplate": "off",
"noInferrableTypes": "off",
"noUselessElse": "off",
"noParameterAssign": "off",
"noCommaOperator": "off",
"useSingleVarDeclarator": "off",
"noUnusedTemplateLiteral": "off",
"useDefaultParameterLast": "off",
"useEnumInitializers": "off"
},
"suspicious": {
"noExplicitAny": "off",
"useIsArray": "off",
"noAssignInExpressions": "off",
"noConfusingVoidType": "off"
},
"complexity": {
"noStaticOnlyClass": "off",
"useOptionalChain": "off"
},
"security": {
"noGlobalEval": "off"
}
}
}
}
25 changes: 4 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,14 @@
"type": "github",
"url": "https://github.com/sponsors/streamich"
},
"keywords": [
"json-type",
"type",
"schema",
"json-schema",
"jtd",
"json",
"pointer",
"jit"
],
"keywords": ["json-type", "type", "schema", "json-schema", "jtd", "json", "pointer", "jit"],
"engines": {
"node": ">=10.0"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"files": [
"LICENSE",
"lib/"
],
"files": ["LICENSE", "lib/"],
"license": "Apache-2.0",
"scripts": {
"format": "biome format ./src",
Expand Down Expand Up @@ -79,16 +67,11 @@
"typescript": "^5.6.2"
},
"jest": {
"moduleFileExtensions": [
"ts",
"js"
],
"moduleFileExtensions": ["ts", "js"],
"transform": {
"^.+\\.ts$": "ts-jest"
},
"transformIgnorePatterns": [
".*/node_modules/.*"
],
"transformIgnorePatterns": [".*/node_modules/.*"],
"testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.ts$"
}
}
40 changes: 20 additions & 20 deletions src/__bench__/encode.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
/* tslint:disable no-console */

import {ModuleType} from '..';
import {Writer} from '@jsonjoy.com/buffers/lib/Writer';
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
import {EncodingFormat} from '@jsonjoy.com/json-pack/lib/constants';
import {JsonEncoder} from '@jsonjoy.com/json-pack/lib/json/JsonEncoder';
import {ModuleType} from '..';
import type {CompiledBinaryEncoder} from '../codegen/types';
import {EncodingFormat} from '@jsonjoy.com/json-pack/lib/constants';
import {Writer} from '@jsonjoy.com/buffers/lib/Writer';

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

const response = system.alias(
'Response',
t.Object(
t.prop(
t.Key(
'collection',
t.Object(
t.prop('id', t.String({ascii: true, noJsonEscape: true})),
t.prop('ts', t.num.options({format: 'u64'})),
t.prop('cid', t.String({ascii: true, noJsonEscape: true})),
t.prop('prid', t.String({ascii: true, noJsonEscape: true})),
t.prop('slug', t.String({ascii: true, noJsonEscape: true})),
t.propOpt('name', t.str),
t.propOpt('src', t.str),
t.propOpt('doc', t.str),
t.propOpt('longText', t.str),
t.prop('active', t.bool),
t.prop('views', t.Array(t.num)),
t.Key('id', t.String({ascii: true, noJsonEscape: true})),
t.Key('ts', t.num.options({format: 'u64'})),
t.Key('cid', t.String({ascii: true, noJsonEscape: true})),
t.Key('prid', t.String({ascii: true, noJsonEscape: true})),
t.Key('slug', t.String({ascii: true, noJsonEscape: true})),
t.KeyOpt('name', t.str),
t.KeyOpt('src', t.str),
t.KeyOpt('doc', t.str),
t.KeyOpt('longText', t.str),
t.Key('active', t.bool),
t.Key('views', t.Array(t.num)),
),
),
t.prop(
t.Key(
'block',
t.Object(
t.prop('id', t.String({ascii: true, noJsonEscape: true})),
t.prop('ts', t.num.options({format: 'u64'})),
t.prop('cid', t.String({ascii: true, noJsonEscape: true})),
t.prop('slug', t.String({ascii: true, noJsonEscape: true})),
t.Key('id', t.String({ascii: true, noJsonEscape: true})),
t.Key('ts', t.num.options({format: 'u64'})),
t.Key('cid', t.String({ascii: true, noJsonEscape: true})),
t.Key('slug', t.String({ascii: true, noJsonEscape: true})),
),
),
),
Expand Down
Loading