@es-joy/jsoe 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ncurc.cjs +4 -5
- package/CHANGES.md +4 -0
- package/README.md +27 -3
- package/badges/licenses-badge.svg +1 -0
- package/dist/formatAndTypeChoices.d.ts +39 -19
- package/dist/formatAndTypeChoices.d.ts.map +1 -1
- package/dist/formats/indexedDBKey.d.ts +1 -1
- package/dist/formats/indexedDBKey.d.ts.map +1 -1
- package/dist/formats/json.d.ts +1 -1
- package/dist/formats/json.d.ts.map +1 -1
- package/dist/formats/schema.d.ts +11 -0
- package/dist/formats/schema.d.ts.map +1 -0
- package/dist/formats/structuredCloning.d.ts +11 -13
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/formats.d.ts +86 -25
- package/dist/formats.d.ts.map +1 -1
- package/dist/fundamentalTypes/BooleanObjectType.d.ts +1 -1
- package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/NumberObjectType.d.ts +1 -1
- package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/StringObjectType.d.ts +1 -1
- package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayReferenceType.d.ts +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts +3 -3
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/bigintObjectType.d.ts +6 -0
- package/dist/fundamentalTypes/bigintObjectType.d.ts.map +1 -0
- package/dist/fundamentalTypes/bigintType.d.ts +1 -1
- package/dist/fundamentalTypes/bigintType.d.ts.map +1 -1
- package/dist/fundamentalTypes/blobType.d.ts +1 -1
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
- package/dist/fundamentalTypes/booleanType.d.ts +8 -0
- package/dist/fundamentalTypes/booleanType.d.ts.map +1 -0
- package/dist/fundamentalTypes/catchType.d.ts +6 -0
- package/dist/fundamentalTypes/catchType.d.ts.map +1 -0
- package/dist/fundamentalTypes/dateType.d.ts +4 -4
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/domexceptionType.d.ts +1 -1
- package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
- package/dist/fundamentalTypes/enumType.d.ts +6 -0
- package/dist/fundamentalTypes/enumType.d.ts.map +1 -0
- package/dist/fundamentalTypes/errorType.d.ts +1 -1
- package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts +1 -1
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
- package/dist/fundamentalTypes/filelistType.d.ts +1 -1
- package/dist/fundamentalTypes/filelistType.d.ts.map +1 -1
- package/dist/fundamentalTypes/functionType.d.ts +6 -0
- package/dist/fundamentalTypes/functionType.d.ts.map +1 -0
- package/dist/fundamentalTypes/literalType.d.ts +6 -0
- package/dist/fundamentalTypes/literalType.d.ts.map +1 -0
- package/dist/fundamentalTypes/mapType.d.ts +1 -1
- package/dist/fundamentalTypes/mapType.d.ts.map +1 -1
- package/dist/fundamentalTypes/nanType.d.ts +6 -0
- package/dist/fundamentalTypes/nanType.d.ts.map +1 -0
- package/dist/fundamentalTypes/nativeEnumType.d.ts +6 -0
- package/dist/fundamentalTypes/nativeEnumType.d.ts.map +1 -0
- package/dist/fundamentalTypes/neverType.d.ts +6 -0
- package/dist/fundamentalTypes/neverType.d.ts.map +1 -0
- package/dist/fundamentalTypes/noneditableType.d.ts +1 -1
- package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -1
- package/dist/fundamentalTypes/nullType.d.ts +1 -1
- package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
- package/dist/fundamentalTypes/numberType.d.ts +1 -1
- package/dist/fundamentalTypes/numberType.d.ts.map +1 -1
- package/dist/fundamentalTypes/objectReferenceType.d.ts +1 -1
- package/dist/fundamentalTypes/objectType.d.ts +1 -1
- package/dist/fundamentalTypes/objectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/promiseType.d.ts +6 -0
- package/dist/fundamentalTypes/promiseType.d.ts.map +1 -0
- package/dist/fundamentalTypes/recordType.d.ts +6 -0
- package/dist/fundamentalTypes/recordType.d.ts.map +1 -0
- package/dist/fundamentalTypes/regexpType.d.ts +1 -1
- package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
- package/dist/fundamentalTypes/setType.d.ts +1 -1
- package/dist/fundamentalTypes/setType.d.ts.map +1 -1
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts +1 -1
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/stringType.d.ts +1 -1
- package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
- package/dist/fundamentalTypes/symbolType.d.ts +8 -0
- package/dist/fundamentalTypes/symbolType.d.ts.map +1 -0
- package/dist/fundamentalTypes/tupleType.d.ts +6 -0
- package/dist/fundamentalTypes/tupleType.d.ts.map +1 -0
- package/dist/fundamentalTypes/undefinedType.d.ts +1 -1
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/voidType.d.ts +6 -0
- package/dist/fundamentalTypes/voidType.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9660 -1586
- package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
- package/dist/subTypes/falseType.d.ts +1 -1
- package/dist/subTypes/trueType.d.ts +1 -1
- package/dist/superTypes/SpecialNumberType.d.ts +1 -1
- package/dist/superTypes/SpecialRealNumberType.d.ts +1 -1
- package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
- package/dist/superTypes/buffersourceType.d.ts +1 -1
- package/dist/superTypes/buffersourceType.d.ts.map +1 -1
- package/dist/superTypes/dommatrixType.d.ts +1 -1
- package/dist/superTypes/dommatrixType.d.ts.map +1 -1
- package/dist/superTypes/dompointType.d.ts +1 -1
- package/dist/superTypes/dompointType.d.ts.map +1 -1
- package/dist/superTypes/domrectType.d.ts +1 -1
- package/dist/superTypes/domrectType.d.ts.map +1 -1
- package/dist/superTypes/errorsSpecialType.d.ts +1 -1
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
- package/dist/typeChoices.d.ts +33 -16
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +161 -157
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/dialogs.d.ts +3 -3
- package/dist/utils/dialogs.d.ts.map +1 -1
- package/dist/utils/jsonPointer.d.ts.map +1 -1
- package/dist/utils/media.d.ts.map +1 -1
- package/dist/utils/objects.d.ts +16 -0
- package/dist/utils/objects.d.ts.map +1 -0
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/vendor-imports.d.ts +1 -1
- package/eslint.config.js +74 -0
- package/licenseInfo.json +4 -0
- package/package.json +33 -42
- package/rollup.config.js +15 -0
- package/src/formatAndTypeChoices.js +68 -54
- package/src/formats/indexedDBKey.js +9 -4
- package/src/formats/json.js +7 -4
- package/src/formats/schema.js +772 -0
- package/src/formats/structuredCloning.js +187 -86
- package/src/formats.js +61 -26
- package/src/fundamentalTypes/BooleanObjectType.js +18 -6
- package/src/fundamentalTypes/NumberObjectType.js +18 -5
- package/src/fundamentalTypes/StringObjectType.js +20 -8
- package/src/fundamentalTypes/arrayType.js +1241 -533
- package/src/fundamentalTypes/bigintObjectType.js +64 -0
- package/src/fundamentalTypes/bigintType.js +31 -5
- package/src/fundamentalTypes/blobType.js +201 -190
- package/src/fundamentalTypes/booleanType.js +63 -0
- package/src/fundamentalTypes/catchType.js +140 -0
- package/src/fundamentalTypes/dateType.js +57 -19
- package/src/fundamentalTypes/domexceptionType.js +61 -63
- package/src/fundamentalTypes/enumType.js +52 -0
- package/src/fundamentalTypes/errorType.js +20 -7
- package/src/fundamentalTypes/fileType.js +195 -189
- package/src/fundamentalTypes/filelistType.js +4 -0
- package/src/fundamentalTypes/functionType.js +150 -0
- package/src/fundamentalTypes/literalType.js +81 -0
- package/src/fundamentalTypes/mapType.js +4 -0
- package/src/fundamentalTypes/nanType.js +41 -0
- package/src/fundamentalTypes/nativeEnumType.js +155 -0
- package/src/fundamentalTypes/neverType.js +44 -0
- package/src/fundamentalTypes/noneditableType.js +19 -5
- package/src/fundamentalTypes/nullType.js +16 -6
- package/src/fundamentalTypes/numberType.js +49 -6
- package/src/fundamentalTypes/objectType.js +10 -2
- package/src/fundamentalTypes/promiseType.js +60 -0
- package/src/fundamentalTypes/recordType.js +42 -0
- package/src/fundamentalTypes/regexpType.js +51 -33
- package/src/fundamentalTypes/setType.js +4 -0
- package/src/fundamentalTypes/sparseUndefinedType.js +3 -0
- package/src/fundamentalTypes/stringType.js +254 -6
- package/src/fundamentalTypes/symbolType.js +81 -0
- package/src/fundamentalTypes/tupleType.js +39 -0
- package/src/fundamentalTypes/undefinedType.js +14 -4
- package/src/fundamentalTypes/voidType.js +48 -0
- package/src/jsoe.css +37 -3
- package/src/subTypes/blobHTMLType.js +33 -24
- package/src/superTypes/SpecialRealNumberType.js +22 -6
- package/src/superTypes/buffersourceType.js +86 -30
- package/src/superTypes/dommatrixType.js +24 -7
- package/src/superTypes/dompointType.js +27 -7
- package/src/superTypes/domrectType.js +33 -7
- package/src/superTypes/errorsSpecialType.js +30 -14
- package/src/typeChoices.js +115 -44
- package/src/types.js +129 -45
- package/src/utils/FileList.js +3 -3
- package/src/utils/dialogs.js +6 -8
- package/src/utils/objects.js +22 -0
- package/src/vendor-imports.js +1 -1
- package/tsconfig.json +2 -2
- package/vendor/jamilih/dist/jml-es.js +23 -6
- package/vendor/typeson-registry/dist/index.js +77 -47
- package/vendor/zod/lib/index.mjs +4236 -0
- package/vendor/zodex/dist/esm/dezerialize.d.ts +26 -0
- package/vendor/zodex/dist/esm/dezerialize.js +393 -0
- package/vendor/zodex/dist/esm/index.d.ts +9 -0
- package/vendor/zodex/dist/esm/index.js +4 -0
- package/vendor/zodex/dist/esm/infer.d.ts +29 -0
- package/vendor/zodex/dist/esm/infer.js +1 -0
- package/vendor/zodex/dist/esm/package.json +1 -0
- package/vendor/zodex/dist/esm/types.d.ts +201 -0
- package/vendor/zodex/dist/esm/types.js +13 -0
- package/vendor/zodex/dist/esm/ui.d.ts +23 -0
- package/vendor/zodex/dist/esm/ui.js +10 -0
- package/vendor/zodex/dist/esm/zerialize.d.ts +50 -0
- package/vendor/zodex/dist/esm/zerialize.js +417 -0
- package/vendor/zodex/dist/esm/zod-types.d.ts +11 -0
- package/vendor/zodex/dist/esm/zod-types.js +1 -0
- package/.eslintignore +0 -13
- package/.eslintrc.cjs +0 -145
- package/.nyc_output/out.json +0 -117370
- package/cypress.config.ts +0 -15
- package/demo/index-instrumented.html +0 -29
- package/demo/index-instrumented.js +0 -644
- package/demo/index.html +0 -29
- package/demo/index.js +0 -215
- package/src/formats/schemaAndArbitrary.js +0 -20
- package/src/formats/schemaOnly.js +0 -539
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SzInfer } from "./infer.js";
|
|
3
|
+
import { SzType } from "./types.js";
|
|
4
|
+
type ShapeValueProps<Value> = {
|
|
5
|
+
value: Value;
|
|
6
|
+
onChange: (_value: Value) => void;
|
|
7
|
+
};
|
|
8
|
+
type ShapeProps<T extends SzType> = {
|
|
9
|
+
shape: T;
|
|
10
|
+
} & ShapeValueProps<SzInfer<T>>;
|
|
11
|
+
type MappedShapeControl<T extends SzType> = {
|
|
12
|
+
[Type in T["type"]]: React.FC<ShapeProps<Extract<T, {
|
|
13
|
+
type: Type;
|
|
14
|
+
}>>>;
|
|
15
|
+
};
|
|
16
|
+
export declare function mapTypesToViews<T extends SzType>(controls: MappedShapeControl<T>): <I = SzInfer<T>>({ shape, value, onChange, }: {
|
|
17
|
+
shape: T;
|
|
18
|
+
value: I;
|
|
19
|
+
onChange: (_value: I) => void;
|
|
20
|
+
}) => React.FunctionComponentElement<ShapeProps<Extract<T, {
|
|
21
|
+
type: T["type"];
|
|
22
|
+
}>>>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SzOptional, SzNullable, SzDefault, SzLiteral, SzArray, SzObject, SzUnion, SzDiscriminatedUnion, SzIntersection, SzTuple, SzRecord, SzMap, SzSet, SzFunction, SzEnum, SzPromise, SzEffect, SzCatch, SzReadonly, SzType, SzUnknown, SzRef } from "./types.js";
|
|
3
|
+
import { ZodTypes, ZTypeName } from "./zod-types.js";
|
|
4
|
+
export declare const PRIMITIVES: {
|
|
5
|
+
readonly ZodString: "string";
|
|
6
|
+
readonly ZodNumber: "number";
|
|
7
|
+
readonly ZodBoolean: "boolean";
|
|
8
|
+
readonly ZodNaN: "nan";
|
|
9
|
+
readonly ZodBigInt: "bigInt";
|
|
10
|
+
readonly ZodDate: "date";
|
|
11
|
+
readonly ZodUndefined: "undefined";
|
|
12
|
+
readonly ZodNull: "null";
|
|
13
|
+
readonly ZodAny: "any";
|
|
14
|
+
readonly ZodUnknown: "unknown";
|
|
15
|
+
readonly ZodNever: "never";
|
|
16
|
+
readonly ZodVoid: "void";
|
|
17
|
+
readonly ZodSymbol: "symbol";
|
|
18
|
+
};
|
|
19
|
+
export type PrimitiveMap = typeof PRIMITIVES;
|
|
20
|
+
type IsZodPrimitive<T extends ZodTypes> = ZTypeName<T> extends keyof PrimitiveMap ? any : never;
|
|
21
|
+
export type Zerialize<T extends ZodTypes> = T extends z.ZodOptional<infer I> ? Zerialize<I> & SzOptional : T extends z.ZodNullable<infer I> ? Zerialize<I> & SzNullable : T extends z.ZodDefault<infer I> ? Zerialize<I> & SzDefault<I["_type"]> : T extends z.ZodReadonly<infer I> ? Zerialize<I> & SzReadonly : T extends IsZodPrimitive<T> ? {
|
|
22
|
+
type: PrimitiveMap[ZTypeName<T>];
|
|
23
|
+
} : T extends z.ZodLiteral<infer T> ? SzLiteral<T> : T extends z.ZodTuple<infer Items> ? {
|
|
24
|
+
[Index in keyof Items]: Zerialize<Items[Index]>;
|
|
25
|
+
} extends infer SzItems extends [SzType, ...SzType[]] | [] ? SzTuple<SzItems> : SzType : T extends z.ZodSet<infer T> ? SzSet<Zerialize<T>> : T extends z.ZodArray<infer T> ? SzArray<Zerialize<T>> : T extends z.ZodObject<infer Properties> ? SzObject<{
|
|
26
|
+
[Property in keyof Properties]: Zerialize<Properties[Property]>;
|
|
27
|
+
}> : T extends z.ZodRecord<infer Key, infer Value> ? SzRecord<Zerialize<Key>, Zerialize<Value>> : T extends z.ZodMap<infer Key, infer Value> ? SzMap<Zerialize<Key>, Zerialize<Value>> : T extends z.ZodEnum<infer Values> ? SzEnum<Values> : T extends z.ZodNativeEnum<infer _Values> ? SzUnknown : T extends z.ZodUnion<infer Options> ? {
|
|
28
|
+
[Index in keyof Options]: Zerialize<Options[Index]>;
|
|
29
|
+
} extends infer SzOptions extends [
|
|
30
|
+
SzType,
|
|
31
|
+
...SzType[]
|
|
32
|
+
] ? SzUnion<SzOptions> : SzType : T extends z.ZodDiscriminatedUnion<infer Discriminator, infer Options> ? SzDiscriminatedUnion<Discriminator, {
|
|
33
|
+
[Index in keyof Options]: Zerialize<Options[Index]>;
|
|
34
|
+
}> : T extends z.ZodIntersection<infer L, infer R> ? SzIntersection<Zerialize<L>, Zerialize<R>> : T extends z.ZodFunction<infer Args, infer Return> ? Zerialize<Args> extends infer SzArgs extends SzTuple ? SzFunction<SzArgs, Zerialize<Return>> : SzType : T extends z.ZodPromise<infer Value> ? SzPromise<Zerialize<Value>> : T extends z.ZodCatch<infer T> ? SzCatch<Zerialize<T>> : T extends z.ZodEffects<infer T> ? SzEffect<Zerialize<T>> : T extends z.ZodLazy<infer T> ? Zerialize<T> : T extends z.ZodBranded<infer T, infer _Brand> ? Zerialize<T> : T extends z.ZodPipeline<infer _In, infer Out> ? Zerialize<Out> : T extends z.ZodCatch<infer Inner> ? Zerialize<Inner> : SzType;
|
|
35
|
+
type ZerializerOptions = {
|
|
36
|
+
superRefinements?: {
|
|
37
|
+
[key: string]: (value: any, ctx: z.RefinementCtx) => Promise<void> | void;
|
|
38
|
+
};
|
|
39
|
+
transforms?: {
|
|
40
|
+
[key: string]: (value: any, ctx: z.RefinementCtx) => Promise<unknown> | unknown;
|
|
41
|
+
};
|
|
42
|
+
preprocesses?: {
|
|
43
|
+
[key: string]: (value: any, ctx: z.RefinementCtx) => unknown;
|
|
44
|
+
};
|
|
45
|
+
currentPath: string[];
|
|
46
|
+
seenObjects: WeakMap<z.ZodTypeDef, string>;
|
|
47
|
+
};
|
|
48
|
+
export declare function zerializeRefs<T extends ZodTypes>(schema: T, opts: ZerializerOptions, wrapReferences?: boolean): Zerialize<T> | SzRef;
|
|
49
|
+
export declare function zerialize<T extends ZodTypes>(schema: T, opts?: Partial<ZerializerOptions>): Zerialize<T>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { STRING_KINDS, } from "./types.js";
|
|
3
|
+
export const PRIMITIVES = {
|
|
4
|
+
ZodString: "string",
|
|
5
|
+
ZodNumber: "number",
|
|
6
|
+
ZodBoolean: "boolean",
|
|
7
|
+
ZodNaN: "nan",
|
|
8
|
+
ZodBigInt: "bigInt",
|
|
9
|
+
ZodDate: "date",
|
|
10
|
+
ZodUndefined: "undefined",
|
|
11
|
+
ZodNull: "null",
|
|
12
|
+
ZodAny: "any",
|
|
13
|
+
ZodUnknown: "unknown",
|
|
14
|
+
ZodNever: "never",
|
|
15
|
+
ZodVoid: "void",
|
|
16
|
+
ZodSymbol: "symbol",
|
|
17
|
+
};
|
|
18
|
+
const s = zerializeRefs;
|
|
19
|
+
const zerializers = {
|
|
20
|
+
ZodOptional: (def, opts) => ({
|
|
21
|
+
...s(def.innerType, opts, true),
|
|
22
|
+
isOptional: true,
|
|
23
|
+
}),
|
|
24
|
+
ZodNullable: (def, opts) => ({
|
|
25
|
+
...s(def.innerType, opts, true),
|
|
26
|
+
isNullable: true,
|
|
27
|
+
}),
|
|
28
|
+
ZodDefault: (def, opts) => ({
|
|
29
|
+
...s(def.innerType, opts, true),
|
|
30
|
+
defaultValue: def.innerType._def.typeName === "ZodBigInt"
|
|
31
|
+
? String(def.defaultValue())
|
|
32
|
+
: def.innerType._def.typeName === "ZodDate"
|
|
33
|
+
? def.defaultValue().getTime()
|
|
34
|
+
: def.defaultValue(),
|
|
35
|
+
}),
|
|
36
|
+
ZodNumber: (def) => {
|
|
37
|
+
const checks = def.checks.reduce((o, check) => ({
|
|
38
|
+
...o,
|
|
39
|
+
...(check.kind == "min"
|
|
40
|
+
? {
|
|
41
|
+
min: check.value,
|
|
42
|
+
...(check.inclusive ? { minInclusive: true } : {}),
|
|
43
|
+
}
|
|
44
|
+
: check.kind == "max"
|
|
45
|
+
? {
|
|
46
|
+
max: check.value,
|
|
47
|
+
...(check.inclusive ? { maxInclusive: true } : {}),
|
|
48
|
+
}
|
|
49
|
+
: check.kind == "multipleOf"
|
|
50
|
+
? { multipleOf: check.value }
|
|
51
|
+
: check.kind == "int"
|
|
52
|
+
? { int: true }
|
|
53
|
+
: check.kind == "finite"
|
|
54
|
+
? {
|
|
55
|
+
finite: true,
|
|
56
|
+
/* c8 ignore next 2 -- Guard */
|
|
57
|
+
}
|
|
58
|
+
: {}),
|
|
59
|
+
}), {});
|
|
60
|
+
return Object.assign({ type: "number", ...checks }, def.coerce ? { coerce: true } : {});
|
|
61
|
+
},
|
|
62
|
+
ZodString: (def) => {
|
|
63
|
+
const checks = def.checks.reduce((o, check) => ({
|
|
64
|
+
...o,
|
|
65
|
+
...(check.kind == "min"
|
|
66
|
+
? { min: check.value }
|
|
67
|
+
: check.kind == "max"
|
|
68
|
+
? { max: check.value }
|
|
69
|
+
: check.kind == "length"
|
|
70
|
+
? { length: check.value }
|
|
71
|
+
: check.kind == "toLowerCase"
|
|
72
|
+
? { toLowerCase: true }
|
|
73
|
+
: check.kind == "toUpperCase"
|
|
74
|
+
? { toUpperCase: true }
|
|
75
|
+
: check.kind == "trim"
|
|
76
|
+
? { trim: true }
|
|
77
|
+
: check.kind == "startsWith"
|
|
78
|
+
? { startsWith: check.value }
|
|
79
|
+
: check.kind == "endsWith"
|
|
80
|
+
? { endsWith: check.value }
|
|
81
|
+
: check.kind == "includes"
|
|
82
|
+
? { includes: check.value, position: check.position }
|
|
83
|
+
: check.kind == "regex"
|
|
84
|
+
? {
|
|
85
|
+
regex: check.regex.source,
|
|
86
|
+
...(check.regex.flags
|
|
87
|
+
? { flags: check.regex.flags }
|
|
88
|
+
: {}),
|
|
89
|
+
}
|
|
90
|
+
: check.kind == "ip"
|
|
91
|
+
? { kind: "ip", version: check.version }
|
|
92
|
+
: check.kind == "time"
|
|
93
|
+
? {
|
|
94
|
+
kind: "time",
|
|
95
|
+
...(typeof check.precision === "number"
|
|
96
|
+
? { precision: check.precision }
|
|
97
|
+
: {}),
|
|
98
|
+
}
|
|
99
|
+
: check.kind == "datetime"
|
|
100
|
+
? {
|
|
101
|
+
kind: "datetime",
|
|
102
|
+
...(check.offset
|
|
103
|
+
? { offset: check.offset }
|
|
104
|
+
: {}),
|
|
105
|
+
...("local" in check && check.local
|
|
106
|
+
? { local: check.local }
|
|
107
|
+
: {}),
|
|
108
|
+
...(typeof check.precision === "number"
|
|
109
|
+
? { precision: check.precision }
|
|
110
|
+
: {}),
|
|
111
|
+
}
|
|
112
|
+
: STRING_KINDS.has(check.kind)
|
|
113
|
+
? {
|
|
114
|
+
kind: check.kind,
|
|
115
|
+
/* c8 ignore next 2 -- Guard */
|
|
116
|
+
}
|
|
117
|
+
: {}),
|
|
118
|
+
}), {});
|
|
119
|
+
return Object.assign({ type: "string", ...checks }, def.coerce ? { coerce: true } : {});
|
|
120
|
+
},
|
|
121
|
+
ZodBoolean: (def) => Object.assign({ type: "boolean" }, def.coerce ? { coerce: true } : {}),
|
|
122
|
+
ZodNaN: () => ({ type: "nan" }),
|
|
123
|
+
ZodSymbol: (def) => ({ type: "symbol" }),
|
|
124
|
+
ZodBigInt: (def) => {
|
|
125
|
+
const checks = def.checks.reduce((o, check) => ({
|
|
126
|
+
...o,
|
|
127
|
+
...(check.kind == "min"
|
|
128
|
+
? {
|
|
129
|
+
min: String(check.value),
|
|
130
|
+
...(check.inclusive ? { minInclusive: true } : {}),
|
|
131
|
+
}
|
|
132
|
+
: check.kind == "max"
|
|
133
|
+
? {
|
|
134
|
+
max: String(check.value),
|
|
135
|
+
...(check.inclusive ? { maxInclusive: true } : {}),
|
|
136
|
+
}
|
|
137
|
+
: check.kind == "multipleOf"
|
|
138
|
+
? {
|
|
139
|
+
multipleOf: String(check.value),
|
|
140
|
+
/* c8 ignore next 2 -- Guard */
|
|
141
|
+
}
|
|
142
|
+
: {}),
|
|
143
|
+
}), {});
|
|
144
|
+
return Object.assign({ type: "bigInt", ...checks }, def.coerce ? { coerce: true } : {});
|
|
145
|
+
},
|
|
146
|
+
ZodDate: (def) => {
|
|
147
|
+
const checks = def.checks.reduce((o, check) => ({
|
|
148
|
+
...o,
|
|
149
|
+
...(check.kind == "min"
|
|
150
|
+
? { min: check.value }
|
|
151
|
+
: check.kind == "max"
|
|
152
|
+
? {
|
|
153
|
+
max: check.value,
|
|
154
|
+
/* c8 ignore next 2 -- Guard */
|
|
155
|
+
}
|
|
156
|
+
: {}),
|
|
157
|
+
}), {});
|
|
158
|
+
return Object.assign({ type: "date", ...checks }, def.coerce ? { coerce: true } : {});
|
|
159
|
+
},
|
|
160
|
+
ZodUndefined: () => ({ type: "undefined" }),
|
|
161
|
+
ZodNull: () => ({ type: "null" }),
|
|
162
|
+
ZodAny: () => ({ type: "any" }),
|
|
163
|
+
ZodUnknown: () => ({ type: "unknown" }),
|
|
164
|
+
ZodNever: () => ({ type: "never" }),
|
|
165
|
+
ZodVoid: () => ({ type: "void" }),
|
|
166
|
+
ZodLiteral: (def) => ({ type: "literal", value: def.value }),
|
|
167
|
+
ZodTuple: (def, opts) => ({
|
|
168
|
+
type: "tuple",
|
|
169
|
+
items: def.items.map((item, idx) => {
|
|
170
|
+
const result = s(item, {
|
|
171
|
+
...opts,
|
|
172
|
+
currentPath: [...opts.currentPath, "items", String(idx)],
|
|
173
|
+
});
|
|
174
|
+
return result;
|
|
175
|
+
}),
|
|
176
|
+
...(def.rest
|
|
177
|
+
? {
|
|
178
|
+
rest: s(def.rest, {
|
|
179
|
+
...opts,
|
|
180
|
+
currentPath: [...opts.currentPath, "rest"],
|
|
181
|
+
}),
|
|
182
|
+
}
|
|
183
|
+
: {}),
|
|
184
|
+
}),
|
|
185
|
+
ZodSet: (def, opts) => ({
|
|
186
|
+
type: "set",
|
|
187
|
+
value: s(def.valueType, {
|
|
188
|
+
...opts,
|
|
189
|
+
currentPath: [...opts.currentPath, "value"],
|
|
190
|
+
}),
|
|
191
|
+
...(def.minSize === null ? {} : { minSize: def.minSize.value }),
|
|
192
|
+
...(def.maxSize === null ? {} : { maxSize: def.maxSize.value }),
|
|
193
|
+
}),
|
|
194
|
+
ZodArray: (def, opts) => ({
|
|
195
|
+
type: "array",
|
|
196
|
+
element: s(def.type, {
|
|
197
|
+
...opts,
|
|
198
|
+
currentPath: [...opts.currentPath, "element"],
|
|
199
|
+
}),
|
|
200
|
+
...(def.exactLength === null
|
|
201
|
+
? {}
|
|
202
|
+
: {
|
|
203
|
+
minLength: def.exactLength.value,
|
|
204
|
+
maxLength: def.exactLength.value,
|
|
205
|
+
}),
|
|
206
|
+
...(def.minLength === null ? {} : { minLength: def.minLength.value }),
|
|
207
|
+
...(def.maxLength === null ? {} : { maxLength: def.maxLength.value }),
|
|
208
|
+
}),
|
|
209
|
+
ZodObject: (def, opts) => ({
|
|
210
|
+
type: "object",
|
|
211
|
+
...(def.catchall._def.typeName === "ZodNever"
|
|
212
|
+
? {}
|
|
213
|
+
: {
|
|
214
|
+
catchall: s(def.catchall, {
|
|
215
|
+
...opts,
|
|
216
|
+
currentPath: [...opts.currentPath, "catchall"],
|
|
217
|
+
}),
|
|
218
|
+
}),
|
|
219
|
+
...(def.unknownKeys === "strip"
|
|
220
|
+
? {}
|
|
221
|
+
: {
|
|
222
|
+
unknownKeys: def.unknownKeys,
|
|
223
|
+
}),
|
|
224
|
+
properties: Object.fromEntries(Object.entries(def.shape()).map(([key, schema]) => [
|
|
225
|
+
key,
|
|
226
|
+
s(schema, {
|
|
227
|
+
...opts,
|
|
228
|
+
currentPath: [...opts.currentPath, "properties", key],
|
|
229
|
+
}),
|
|
230
|
+
])),
|
|
231
|
+
}),
|
|
232
|
+
ZodRecord: (def, opts) => ({
|
|
233
|
+
type: "record",
|
|
234
|
+
key: s(def.keyType, {
|
|
235
|
+
...opts,
|
|
236
|
+
currentPath: [...opts.currentPath, "key"],
|
|
237
|
+
}),
|
|
238
|
+
value: s(def.valueType, {
|
|
239
|
+
...opts,
|
|
240
|
+
currentPath: [...opts.currentPath, "value"],
|
|
241
|
+
}),
|
|
242
|
+
}),
|
|
243
|
+
ZodMap: (def, opts) => ({
|
|
244
|
+
type: "map",
|
|
245
|
+
key: s(def.keyType, {
|
|
246
|
+
...opts,
|
|
247
|
+
currentPath: [...opts.currentPath, "key"],
|
|
248
|
+
}),
|
|
249
|
+
value: s(def.valueType, {
|
|
250
|
+
...opts,
|
|
251
|
+
currentPath: [...opts.currentPath, "value"],
|
|
252
|
+
}),
|
|
253
|
+
}),
|
|
254
|
+
ZodEnum: (def) => ({ type: "enum", values: def.values }),
|
|
255
|
+
ZodNativeEnum: (def, opts) => ({
|
|
256
|
+
type: "nativeEnum",
|
|
257
|
+
values: def.values,
|
|
258
|
+
}),
|
|
259
|
+
ZodUnion: (def, opts) => ({
|
|
260
|
+
type: "union",
|
|
261
|
+
options: def.options.map((opt, idx) => {
|
|
262
|
+
const result = s(opt, {
|
|
263
|
+
...opts,
|
|
264
|
+
currentPath: [...opts.currentPath, "options", String(idx)],
|
|
265
|
+
});
|
|
266
|
+
return result;
|
|
267
|
+
}),
|
|
268
|
+
}),
|
|
269
|
+
ZodDiscriminatedUnion: (def, opts) => ({
|
|
270
|
+
type: "discriminatedUnion",
|
|
271
|
+
discriminator: def.discriminator,
|
|
272
|
+
options: def.options.map((opt, idx) => {
|
|
273
|
+
const result = s(opt, {
|
|
274
|
+
...opts,
|
|
275
|
+
currentPath: [...opts.currentPath, "options", String(idx)],
|
|
276
|
+
});
|
|
277
|
+
return result;
|
|
278
|
+
}),
|
|
279
|
+
}),
|
|
280
|
+
ZodIntersection: (def, opts) => ({
|
|
281
|
+
type: "intersection",
|
|
282
|
+
left: s(def.left, {
|
|
283
|
+
...opts,
|
|
284
|
+
currentPath: [...opts.currentPath, "left"],
|
|
285
|
+
}),
|
|
286
|
+
right: s(def.right, {
|
|
287
|
+
...opts,
|
|
288
|
+
currentPath: [...opts.currentPath, "right"],
|
|
289
|
+
}),
|
|
290
|
+
}),
|
|
291
|
+
ZodFunction: (def, opts) => ({
|
|
292
|
+
type: "function",
|
|
293
|
+
args: s(def.args, {
|
|
294
|
+
...opts,
|
|
295
|
+
currentPath: [...opts.currentPath, "args"],
|
|
296
|
+
}),
|
|
297
|
+
returns: s(def.returns, {
|
|
298
|
+
...opts,
|
|
299
|
+
currentPath: [...opts.currentPath, "returns"],
|
|
300
|
+
}),
|
|
301
|
+
}),
|
|
302
|
+
ZodPromise: (def, opts) => ({
|
|
303
|
+
type: "promise",
|
|
304
|
+
value: s(def.type, {
|
|
305
|
+
...opts,
|
|
306
|
+
currentPath: [...opts.currentPath, "value"],
|
|
307
|
+
}),
|
|
308
|
+
}),
|
|
309
|
+
ZodLazy: (def, opts) => {
|
|
310
|
+
const getter = def.getter();
|
|
311
|
+
return s(getter, opts, getter.isOptional() || getter.isNullable());
|
|
312
|
+
},
|
|
313
|
+
ZodEffects: (def, opts) => {
|
|
314
|
+
if (!("superRefinements" in opts ||
|
|
315
|
+
"transforms" in opts ||
|
|
316
|
+
"preprocesses" in opts)) {
|
|
317
|
+
return s(def.schema, opts);
|
|
318
|
+
}
|
|
319
|
+
const effects = [];
|
|
320
|
+
let lastDef;
|
|
321
|
+
let d = def;
|
|
322
|
+
do {
|
|
323
|
+
lastDef = d;
|
|
324
|
+
let found;
|
|
325
|
+
if ("superRefinements" in opts && opts.superRefinements) {
|
|
326
|
+
for (const [name, refinement] of Object.entries(opts.superRefinements)) {
|
|
327
|
+
if (d.effect.type === "refinement" &&
|
|
328
|
+
refinement === d.effect.refinement) {
|
|
329
|
+
effects.unshift({ type: "refinement", name });
|
|
330
|
+
found = true;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (!found && "transforms" in opts && opts.transforms) {
|
|
336
|
+
for (const [name, transform] of Object.entries(opts.transforms)) {
|
|
337
|
+
if (d.effect.type === "transform" &&
|
|
338
|
+
transform === d.effect.transform) {
|
|
339
|
+
effects.unshift({ type: "transform", name });
|
|
340
|
+
found = true;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (!found && "preprocesses" in opts && opts.preprocesses) {
|
|
346
|
+
for (const [name, preprocess] of Object.entries(opts.preprocesses)) {
|
|
347
|
+
if (d.effect.type === "preprocess" &&
|
|
348
|
+
preprocess === d.effect.transform) {
|
|
349
|
+
effects.unshift({ type: "preprocess", name });
|
|
350
|
+
found = true;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
d = d.schema._def;
|
|
356
|
+
} while (d && d.typeName === "ZodEffects");
|
|
357
|
+
return {
|
|
358
|
+
type: "effect",
|
|
359
|
+
effects,
|
|
360
|
+
inner: s(lastDef.schema, {
|
|
361
|
+
...opts,
|
|
362
|
+
currentPath: [...opts.currentPath, "inner"],
|
|
363
|
+
}),
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
ZodBranded: (def, opts) => s(def.type, opts),
|
|
367
|
+
ZodPipeline: (def, opts) => s(def.out, opts),
|
|
368
|
+
ZodCatch: (def, opts) => {
|
|
369
|
+
const catchValue = def.catchValue({
|
|
370
|
+
// No errors to report, so just add an empty set
|
|
371
|
+
get error() {
|
|
372
|
+
/* c8 ignore next 2 -- Unused */
|
|
373
|
+
return new z.ZodError([]);
|
|
374
|
+
},
|
|
375
|
+
// We don't have any input yet, so just provide `undefined`
|
|
376
|
+
input: undefined,
|
|
377
|
+
});
|
|
378
|
+
return {
|
|
379
|
+
type: "catch",
|
|
380
|
+
value: catchValue,
|
|
381
|
+
innerType: s(def.innerType, opts),
|
|
382
|
+
};
|
|
383
|
+
},
|
|
384
|
+
ZodReadonly: (def, opts) => ({
|
|
385
|
+
...s(def.innerType, opts, true),
|
|
386
|
+
readonly: true,
|
|
387
|
+
}),
|
|
388
|
+
};
|
|
389
|
+
// Must match the exported Zerialize types
|
|
390
|
+
export function zerializeRefs(schema, opts, wrapReferences) {
|
|
391
|
+
// export function zerialize(schema: ZodTypes, opts?: Partial<ZerializerOptions> | undefined): unknown {
|
|
392
|
+
if (opts.seenObjects.has(schema)) {
|
|
393
|
+
return wrapReferences // && schema._def.typeName !== "ZodOptional"
|
|
394
|
+
? {
|
|
395
|
+
type: "union",
|
|
396
|
+
options: [{ $ref: opts.seenObjects.get(schema) }],
|
|
397
|
+
}
|
|
398
|
+
: { $ref: opts.seenObjects.get(schema) };
|
|
399
|
+
}
|
|
400
|
+
const { _def: def } = schema;
|
|
401
|
+
const objectPath = "#" + (opts.currentPath.length ? "/" + opts.currentPath.join("/") : "");
|
|
402
|
+
opts.seenObjects.set(schema, objectPath);
|
|
403
|
+
const zer = zerializers[def.typeName](def, opts);
|
|
404
|
+
if (typeof def.description === "string") {
|
|
405
|
+
zer.description = def.description;
|
|
406
|
+
}
|
|
407
|
+
return zer;
|
|
408
|
+
}
|
|
409
|
+
export function zerialize(schema, opts = {}) {
|
|
410
|
+
if (!opts.currentPath) {
|
|
411
|
+
opts.currentPath = [];
|
|
412
|
+
}
|
|
413
|
+
if (!opts.seenObjects) {
|
|
414
|
+
opts.seenObjects = new WeakMap();
|
|
415
|
+
}
|
|
416
|
+
return zerializeRefs(schema, opts);
|
|
417
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
type Modifiers = z.ZodOptional<ZodTypes> | z.ZodNullable<ZodTypes> | z.ZodDefault<ZodTypes> | z.ZodReadonly<ZodTypes>;
|
|
3
|
+
type Primitives = z.ZodString | z.ZodNumber | z.ZodNaN | z.ZodBigInt | z.ZodBoolean | z.ZodDate | z.ZodUndefined | z.ZodNull | z.ZodAny | z.ZodUnknown | z.ZodNever | z.ZodVoid | z.ZodSymbol;
|
|
4
|
+
type ListCollections = z.ZodTuple<any, any> | z.ZodSet<ZodTypes> | z.ZodArray<ZodTypes>;
|
|
5
|
+
type KVCollections = z.ZodObject<any> | z.ZodRecord<any, ZodTypes> | z.ZodMap<ZodTypes, ZodTypes>;
|
|
6
|
+
type ADTs = z.ZodUnion<readonly [ZodTypes, ...ZodTypes[]]> | z.ZodDiscriminatedUnion<any, z.ZodObject<{
|
|
7
|
+
[k: string]: ZodTypes;
|
|
8
|
+
}>[]> | z.ZodIntersection<ZodTypes, ZodTypes> | z.ZodNativeEnum<any> | z.ZodEnum<any>;
|
|
9
|
+
export type ZodTypes = Modifiers | Primitives | ListCollections | KVCollections | ADTs | z.ZodFunction<any, ZodTypes> | z.ZodLazy<ZodTypes> | z.ZodLiteral<any> | z.ZodEffects<any, any> | z.ZodCatch<ZodTypes> | z.ZodPromise<ZodTypes> | z.ZodBranded<ZodTypes, any> | z.ZodPipeline<ZodTypes, ZodTypes>;
|
|
10
|
+
export type ZTypeName<T extends ZodTypes> = T["_def"]["typeName"];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ['ash-nazg/sauron-node-overrides', 'plugin:cypress/recommended'],
|
|
5
|
-
parserOptions: {
|
|
6
|
-
ecmaVersion: 2022
|
|
7
|
-
},
|
|
8
|
-
settings: {
|
|
9
|
-
jsdoc: {
|
|
10
|
-
mode: 'typescript'
|
|
11
|
-
},
|
|
12
|
-
polyfills: [
|
|
13
|
-
'AggregateError',
|
|
14
|
-
'Array.isArray',
|
|
15
|
-
'Array.filter',
|
|
16
|
-
'Array.flatMap',
|
|
17
|
-
'Array.forEach',
|
|
18
|
-
'Array.from',
|
|
19
|
-
'Array.includes',
|
|
20
|
-
'Array.map',
|
|
21
|
-
'Array.reduce',
|
|
22
|
-
'Array.some',
|
|
23
|
-
'ArrayBuffer',
|
|
24
|
-
'BigInt',
|
|
25
|
-
'BigInt64Array',
|
|
26
|
-
'Blob',
|
|
27
|
-
'btoa',
|
|
28
|
-
'console',
|
|
29
|
-
'DataView',
|
|
30
|
-
'Date.toISOString',
|
|
31
|
-
'document.body',
|
|
32
|
-
'document.createDocumentFragment',
|
|
33
|
-
'document.querySelector',
|
|
34
|
-
'document.querySelectorAll',
|
|
35
|
-
'DOMException',
|
|
36
|
-
'DOMMatrix',
|
|
37
|
-
'DOMMatrixReadOnly',
|
|
38
|
-
'DOMPoint',
|
|
39
|
-
'DOMPointReadOnly',
|
|
40
|
-
'DOMRect',
|
|
41
|
-
'DOMRectReadOnly',
|
|
42
|
-
'Error',
|
|
43
|
-
'fetch',
|
|
44
|
-
'File',
|
|
45
|
-
'FileList',
|
|
46
|
-
'FileList.item',
|
|
47
|
-
'FileReader',
|
|
48
|
-
'history',
|
|
49
|
-
'IDBKeyRange',
|
|
50
|
-
'indexedDB',
|
|
51
|
-
'JSON',
|
|
52
|
-
'location.hash',
|
|
53
|
-
'location.href',
|
|
54
|
-
'location.pathname',
|
|
55
|
-
'Map',
|
|
56
|
-
'MediaRecorder',
|
|
57
|
-
'MutationObserver',
|
|
58
|
-
'navigator.mediaDevices',
|
|
59
|
-
'Number.isNaN',
|
|
60
|
-
'Number.parseFloat',
|
|
61
|
-
'Number.parseInt',
|
|
62
|
-
'Object.assign',
|
|
63
|
-
'Object.hasOwn',
|
|
64
|
-
'Object.is',
|
|
65
|
-
'Object.keys',
|
|
66
|
-
'Object.entries',
|
|
67
|
-
'Object.values',
|
|
68
|
-
'Promise',
|
|
69
|
-
'requestAnimationFrame',
|
|
70
|
-
'Set',
|
|
71
|
-
'String.replaceAll',
|
|
72
|
-
'Symbol',
|
|
73
|
-
'Symbol.toStringTag',
|
|
74
|
-
'Uint8Array',
|
|
75
|
-
'URL',
|
|
76
|
-
'URLSearchParams',
|
|
77
|
-
'WeakMap'
|
|
78
|
-
],
|
|
79
|
-
coverage: true
|
|
80
|
-
},
|
|
81
|
-
env: {
|
|
82
|
-
node: false,
|
|
83
|
-
browser: true
|
|
84
|
-
},
|
|
85
|
-
overrides: [
|
|
86
|
-
{
|
|
87
|
-
files: '*.md/*.js',
|
|
88
|
-
rules: {
|
|
89
|
-
'import/unambiguous': 'off'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
files: 'cypress/**',
|
|
94
|
-
rules: {
|
|
95
|
-
'import/unambiguous': 'off'
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
rules: {
|
|
100
|
-
'no-console': 0,
|
|
101
|
-
'no-shadow': 0,
|
|
102
|
-
// 'jsdoc/require-jsdoc': ['error', {
|
|
103
|
-
// require: {
|
|
104
|
-
// ArrowFunctionExpression: true,
|
|
105
|
-
// ClassDeclaration: true,
|
|
106
|
-
// ClassExpression: true,
|
|
107
|
-
// FunctionDeclaration: true,
|
|
108
|
-
// FunctionExpression: true,
|
|
109
|
-
// MethodDefinition: true
|
|
110
|
-
// }
|
|
111
|
-
// }],
|
|
112
|
-
quotes: ['error', 'single', {
|
|
113
|
-
avoidEscape: true, allowTemplateLiterals: true
|
|
114
|
-
}],
|
|
115
|
-
|
|
116
|
-
'jsdoc/require-jsdoc': ['warn', {
|
|
117
|
-
contexts: [
|
|
118
|
-
'Program > VariableDeclaration > ' +
|
|
119
|
-
'VariableDeclarator > ArrowFunctionExpression',
|
|
120
|
-
'Program > VariableDeclaration > ' +
|
|
121
|
-
'VariableDeclarator > FunctionExpression',
|
|
122
|
-
'ExportNamedDeclaration > VariableDeclaration > ' +
|
|
123
|
-
'VariableDeclarator > ArrowFunctionExpression',
|
|
124
|
-
'ExportNamedDeclaration > VariableDeclaration > ' +
|
|
125
|
-
'VariableDeclarator > FunctionExpression',
|
|
126
|
-
'ExportDefaultDeclaration > ArrowFunctionExpression',
|
|
127
|
-
'ExportDefaultDeclaration > FunctionExpression',
|
|
128
|
-
|
|
129
|
-
'ClassDeclaration',
|
|
130
|
-
'ClassExpression',
|
|
131
|
-
'FunctionDeclaration', // Default is true
|
|
132
|
-
'MethodDefinition'
|
|
133
|
-
]
|
|
134
|
-
}],
|
|
135
|
-
|
|
136
|
-
// Disable until find time
|
|
137
|
-
'prefer-named-capture-group': 0,
|
|
138
|
-
'eslint-comments/require-description': 0,
|
|
139
|
-
// Disable until rule improved?
|
|
140
|
-
'require-atomic-updates': 0,
|
|
141
|
-
// Disable; waiting on https://github.com/mysticatea/eslint-plugin-node/issues/162
|
|
142
|
-
'n/no-unpublished-import': 0,
|
|
143
|
-
'unicorn/no-this-assignment': 0
|
|
144
|
-
}
|
|
145
|
-
};
|