Skip to content

Commit

Permalink
ci: lint style
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemain committed Feb 19, 2024
1 parent 57899a2 commit 18b5f35
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 90 deletions.
132 changes: 66 additions & 66 deletions javascript/packages/fury/lib/description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,59 @@
import { InternalSerializerType } from "./type";

export interface TypeDescription {
type: InternalSerializerType
label?: string
type: InternalSerializerType;
label?: string;
}

export interface ObjectTypeDescription extends TypeDescription {
options: {
props: { [key: string]: TypeDescription }
tag: string
}
props: { [key: string]: TypeDescription };
tag: string;
};
}

export interface EnumTypeDescription extends TypeDescription {
options: {
inner: { [key: string]: any }
}
inner: { [key: string]: any };
};
}

export interface OneofTypeDescription extends TypeDescription {
options: {
inner: { [key: string]: TypeDescription }
}
inner: { [key: string]: TypeDescription };
};
}

export interface ArrayTypeDescription extends TypeDescription {
options: {
inner: TypeDescription
}
inner: TypeDescription;
};
}

export interface TupleTypeDescription extends TypeDescription {
options: {
inner: TypeDescription[]
}
inner: TypeDescription[];
};
}

export interface SetTypeDescription extends TypeDescription {
options: {
key: TypeDescription
}
key: TypeDescription;
};
}

export interface MapTypeDescription extends TypeDescription {
options: {
key: TypeDescription
value: TypeDescription
}
key: TypeDescription;
value: TypeDescription;
};
}

type Props<T> = T extends {
options: {
props?: infer T2 extends { [key: string]: any }
tag: string
}
props?: infer T2 extends { [key: string]: any };
tag: string;
};
}
? {
[P in keyof T2]?: (InputType<T2[P]> | null);
Expand All @@ -81,25 +81,25 @@ type Props<T> = T extends {

type InnerProps<T> = T extends {
options: {
inner: infer T2 extends TypeDescription
}
inner: infer T2 extends TypeDescription;
};
}
? (InputType<T2> | null)[]
: unknown;

type MapProps<T> = T extends {
options: {
key: infer T2 extends TypeDescription
value: infer T3 extends TypeDescription
}
key: infer T2 extends TypeDescription;
value: infer T3 extends TypeDescription;
};
}
? Map<InputType<T2>, InputType<T3> | null>
: unknown;

type TupleProps<T> = T extends {
options: {
inner: infer T2 extends readonly [...TypeDescription[]]
}
inner: infer T2 extends readonly [...TypeDescription[]];
};
}
? { [K in keyof T2]: InputType<T2[K]> }
: unknown;
Expand All @@ -108,16 +108,16 @@ type Value<T> = T extends { [s: string]: infer T2 } ? T2 : unknown;

type EnumProps<T> = T extends {
options: {
inner: infer T2
}
inner: infer T2;
};
}
? Value<T2>
: unknown;

type OneofProps<T> = T extends {
options: {
inner?: infer T2 extends { [key: string]: any }
}
inner?: infer T2 extends { [key: string]: any };
};
}
? {
[P in keyof T2]?: (InputType<T2[P]> | null);
Expand All @@ -126,30 +126,30 @@ type OneofProps<T> = T extends {

type OneofResult<T> = T extends {
options: {
inner?: infer T2
}
inner?: infer T2;
};
}
? ResultType<Value<T2>>
: unknown;

type SetProps<T> = T extends {
options: {
key: infer T2 extends TypeDescription
}
key: infer T2 extends TypeDescription;
};
}
? Set<(InputType<T2> | null)>
: unknown;

export type InputType<T> = T extends {
type: InternalSerializerType.FURY_TYPE_TAG
type: InternalSerializerType.FURY_TYPE_TAG;
}
? Props<T>
: T extends {
type: InternalSerializerType.STRING
type: InternalSerializerType.STRING;
}
? string
: T extends {
type: InternalSerializerType.TUPLE
type: InternalSerializerType.TUPLE;
}
? TupleProps<T>
: T extends {
Expand All @@ -161,64 +161,64 @@ export type InputType<T> = T extends {
| InternalSerializerType.INT16
| InternalSerializerType.INT32
| InternalSerializerType.FLOAT
| InternalSerializerType.DOUBLE
| InternalSerializerType.DOUBLE;
}
? number

: T extends {
type: InternalSerializerType.UINT64
| InternalSerializerType.INT64
| InternalSerializerType.INT64;
}
? bigint
: T extends {
type: InternalSerializerType.MAP
type: InternalSerializerType.MAP;
}
? MapProps<T>
: T extends {
type: InternalSerializerType.FURY_SET
type: InternalSerializerType.FURY_SET;
}
? SetProps<T>
: T extends {
type: InternalSerializerType.ARRAY
type: InternalSerializerType.ARRAY;
}
? InnerProps<T>
: T extends {
type: InternalSerializerType.BOOL
type: InternalSerializerType.BOOL;
}
? boolean
: T extends {
type: InternalSerializerType.DATE
type: InternalSerializerType.DATE;
}
? Date
: T extends {
type: InternalSerializerType.TIMESTAMP
type: InternalSerializerType.TIMESTAMP;
}
? number
: T extends {
type: InternalSerializerType.BINARY
type: InternalSerializerType.BINARY;
}
? Uint8Array
: T extends {
type: InternalSerializerType.ANY
type: InternalSerializerType.ANY;
}
? any
: T extends {
type: InternalSerializerType.ENUM
type: InternalSerializerType.ENUM;
}
? EnumProps<T> : T extends {
type: InternalSerializerType.ONEOF
type: InternalSerializerType.ONEOF;
} ? OneofProps<T> : unknown;

export type ResultType<T> = T extends {
type: InternalSerializerType.FURY_TYPE_TAG
type: InternalSerializerType.FURY_TYPE_TAG;
}
? Props<T>
: T extends {
type: InternalSerializerType.STRING
type: InternalSerializerType.STRING;
}
? string
: T extends {
type: InternalSerializerType.TUPLE
type: InternalSerializerType.TUPLE;
}
? TupleProps<T>
: T extends {
Expand All @@ -230,52 +230,52 @@ export type ResultType<T> = T extends {
| InternalSerializerType.INT16
| InternalSerializerType.INT32
| InternalSerializerType.FLOAT
| InternalSerializerType.DOUBLE
| InternalSerializerType.DOUBLE;
}
? number

: T extends {
type: InternalSerializerType.UINT64
| InternalSerializerType.INT64
| InternalSerializerType.INT64;
}
? bigint
: T extends {
type: InternalSerializerType.MAP
type: InternalSerializerType.MAP;
}
? MapProps<T>
: T extends {
type: InternalSerializerType.FURY_SET
type: InternalSerializerType.FURY_SET;
}
? SetProps<T>
: T extends {
type: InternalSerializerType.ARRAY
type: InternalSerializerType.ARRAY;
}
? InnerProps<T>
: T extends {
type: InternalSerializerType.BOOL
type: InternalSerializerType.BOOL;
}
? boolean
: T extends {
type: InternalSerializerType.DATE
type: InternalSerializerType.DATE;
}
? Date
: T extends {
type: InternalSerializerType.TIMESTAMP
type: InternalSerializerType.TIMESTAMP;
}
? number
: T extends {
type: InternalSerializerType.BINARY
type: InternalSerializerType.BINARY;
}
? Uint8Array
: T extends {
type: InternalSerializerType.ANY
type: InternalSerializerType.ANY;
}
? any
: T extends {
type: InternalSerializerType.ENUM
type: InternalSerializerType.ENUM;
}
? EnumProps<T> : T extends {
type: InternalSerializerType.ONEOF
type: InternalSerializerType.ONEOF;
} ? OneofResult<T> : unknown;

export const Type = {
Expand Down
6 changes: 3 additions & 3 deletions javascript/packages/fury/lib/gen/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import { Scope } from "./scope";
import { TypeDescription, ObjectTypeDescription } from "../description";

export interface SerializerGenerator {
toSerializer(): string
toWriteEmbed(accessor: string, excludeHead?: boolean): string
toReadEmbed(accessor: (expr: string) => string, excludeHead?: boolean, refState?: RefState): string
toSerializer(): string;
toWriteEmbed(accessor: string, excludeHead?: boolean): string;
toReadEmbed(accessor: (expr: string) => string, excludeHead?: boolean, refState?: RefState): string;
}

export enum RefStateType {
Expand Down
6 changes: 3 additions & 3 deletions javascript/packages/fury/lib/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { ObjectTypeDescription, TypeDescription } from "./description";
import { InternalSerializerType } from "./type";

export type Meta = {
fixedSize: number
needToWriteRef: boolean
type: InternalSerializerType
fixedSize: number;
needToWriteRef: boolean;
type: InternalSerializerType;
};

export const getMeta = (description: TypeDescription, fury: Fury): Meta => {
Expand Down
6 changes: 3 additions & 3 deletions javascript/packages/fury/lib/platformBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { hasBuffer } from "./util";
export type SupportedEncodings = "latin1" | "utf8";

export interface PlatformBuffer extends Uint8Array {
toString(encoding?: SupportedEncodings, start?: number, end?: number,): string
write(string: string, offset: number, encoding?: SupportedEncodings): void
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): void
toString(encoding?: SupportedEncodings, start?: number, end?: number,): string;
write(string: string, offset: number, encoding?: SupportedEncodings): void;
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): void;
}

export class BrowserBuffer extends Uint8Array implements PlatformBuffer {
Expand Down
2 changes: 1 addition & 1 deletion javascript/packages/fury/lib/referenceResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const makeHead = (flag: RefFlags, type: InternalSerializerType) => {

export const ReferenceResolver = (
config: {
refTracking?: boolean
refTracking?: boolean;
},
binaryWriter: BinaryWriter,
binaryReader: BinaryReader,
Expand Down
Loading

0 comments on commit 18b5f35

Please sign in to comment.