mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
joi: lint more
This commit is contained in:
32
types/joi/index.d.ts
vendored
32
types/joi/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for joi v13.4.0
|
||||
// Type definitions for joi 13.4
|
||||
// Project: https://github.com/hapijs/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
@@ -125,7 +125,7 @@ export interface IpOptions {
|
||||
cidr?: string;
|
||||
}
|
||||
|
||||
export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5'
|
||||
export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5';
|
||||
|
||||
export interface GuidOptions {
|
||||
version: GuidVersions[] | GuidVersions;
|
||||
@@ -181,8 +181,8 @@ export interface ReferenceOptions {
|
||||
}
|
||||
|
||||
export interface IPOptions {
|
||||
version?: Array<string>;
|
||||
cidr?: string
|
||||
version?: string[];
|
||||
cidr?: string;
|
||||
}
|
||||
|
||||
export interface StringRegexOptions {
|
||||
@@ -236,7 +236,6 @@ export type Schema = AnySchema
|
||||
| LazySchema;
|
||||
|
||||
export interface AnySchema extends JoiObject {
|
||||
|
||||
schemaType?: Types | string;
|
||||
|
||||
/**
|
||||
@@ -441,7 +440,6 @@ export interface State {
|
||||
}
|
||||
|
||||
export interface BooleanSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Allows for additional values to be considered valid booleans by converting them to true during validation.
|
||||
* Accepts a value or an array of values. String comparisons are by default case insensitive,
|
||||
@@ -695,7 +693,9 @@ export interface ArraySchema extends AnySchema {
|
||||
/**
|
||||
* Lists the types in sequence order for the array values where:
|
||||
* @param type - a joi schema object to validate against each array item in sequence order. type can be an array of values, or multiple values can be passed as individual arguments.
|
||||
* If a given type is .required() then there must be a matching item with the same index position in the array. Errors will contain the number of items that didn't match. Any unmatched item having a label will be mentioned explicitly.
|
||||
* If a given type is .required() then there must be a matching item with the same index position in the array.
|
||||
* Errors will contain the number of items that didn't match.
|
||||
* Any unmatched item having a label will be mentioned explicitly.
|
||||
*/
|
||||
ordered(...types: SchemaLike[]): this;
|
||||
ordered(types: SchemaLike[]): this;
|
||||
@@ -726,7 +726,6 @@ export interface ArraySchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface ObjectSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Sets or extends the allowed object keys.
|
||||
*/
|
||||
@@ -754,9 +753,9 @@ export interface ObjectSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specify validation rules for unknown keys matching a pattern.
|
||||
*
|
||||
* @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names
|
||||
* @param schema - the schema object matching keys must validate against
|
||||
*
|
||||
* @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names
|
||||
* @param schema - the schema object matching keys must validate against
|
||||
*/
|
||||
pattern(pattern: RegExp | SchemaLike, schema: SchemaLike): this;
|
||||
|
||||
@@ -884,7 +883,6 @@ export interface BinarySchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface DateSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specifies the oldest date allowed.
|
||||
* Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date,
|
||||
@@ -927,7 +925,6 @@ export interface DateSchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface FunctionSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specifies the arity of the function where:
|
||||
* @param n - the arity expected.
|
||||
@@ -961,7 +958,6 @@ export interface AlternativesSchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface LazySchema extends AnySchema {
|
||||
|
||||
}
|
||||
|
||||
export interface Reference extends JoiObject {
|
||||
@@ -982,7 +978,7 @@ export type ExtensionBoundSchema = Schema & {
|
||||
* @param options - should the context passed into the `validate` function in a custom rule
|
||||
*/
|
||||
createError(type: string, context: Context, state: State, options: ValidationOptions): Err;
|
||||
}
|
||||
};
|
||||
|
||||
export interface Rules<P extends object = any> {
|
||||
name: string;
|
||||
@@ -1134,7 +1130,7 @@ export function reach<T extends Schema>(schema: ObjectSchema, path: string[]): T
|
||||
/**
|
||||
* Creates a new Joi instance customized with the extension(s) you provide included.
|
||||
*/
|
||||
export function extend(extension: Extension|Extension[], ...extensions: (Extension|Extension[])[]): any;
|
||||
export function extend(extension: Extension|Extension[], ...extensions: Array<Extension|Extension[]>): any;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
@@ -1160,8 +1156,8 @@ export function defaults(fn: DefaultsFunction): Root;
|
||||
export function describe(schema: Schema): Description;
|
||||
|
||||
/**
|
||||
* Whitelists a value
|
||||
*/
|
||||
* Whitelists a value
|
||||
*/
|
||||
export function allow(value: any, ...values: any[]): Schema;
|
||||
export function allow(values: any[]): Schema;
|
||||
|
||||
|
||||
@@ -3,29 +3,24 @@ import Joi = require('joi');
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let x: any = null;
|
||||
let value: any = null;
|
||||
let num: number = 0;
|
||||
let str: string = '';
|
||||
let bool: boolean = false;
|
||||
let exp: RegExp = null;
|
||||
let obj: object = null;
|
||||
let date: Date = null;
|
||||
let err: Error = null;
|
||||
let func: Function = null;
|
||||
declare const value: any;
|
||||
let num = 0;
|
||||
let str = '';
|
||||
declare const bool: boolean;
|
||||
declare const exp: RegExp;
|
||||
declare const obj: object;
|
||||
declare const date: Date;
|
||||
declare const err: Error;
|
||||
declare const func: Function;
|
||||
|
||||
let anyArr: any[] = [];
|
||||
let numArr: number[] = [];
|
||||
let strArr: string[] = [];
|
||||
let boolArr: boolean[] = [];
|
||||
let expArr: RegExp[] = [];
|
||||
let objArr: object[] = [];
|
||||
let errArr: Error[] = [];
|
||||
let funcArr: Function[] = [];
|
||||
declare const numArr: number[];
|
||||
declare const strArr: string[];
|
||||
declare const expArr: RegExp[];
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let schema: Joi.Schema = null;
|
||||
let schemaLike: Joi.SchemaLike = null;
|
||||
declare const schemaLike: Joi.SchemaLike;
|
||||
|
||||
let anySchema: Joi.AnySchema = null;
|
||||
let numSchema: Joi.NumberSchema = null;
|
||||
@@ -38,7 +33,7 @@ let funcSchema: Joi.FunctionSchema = null;
|
||||
let objSchema: Joi.ObjectSchema = null;
|
||||
let altSchema: Joi.AlternativesSchema = null;
|
||||
|
||||
let schemaArr: Joi.Schema[] = [];
|
||||
declare const schemaArr: Joi.Schema[];
|
||||
|
||||
let ref: Joi.Reference = null;
|
||||
let description: Joi.Description = null;
|
||||
@@ -156,7 +151,7 @@ stringRegexOpts = { invert: bool };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let validErr: Joi.ValidationError = null;
|
||||
declare const validErr: Joi.ValidationError;
|
||||
let validErrItem: Joi.ValidationErrorItem;
|
||||
let validErrFunc: Joi.ValidationErrorFunction;
|
||||
|
||||
@@ -235,13 +230,13 @@ schemaMap = {
|
||||
{ c1: true },
|
||||
{ c2: null }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
anySchema = Joi.any();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
anySchema = anySchema.allow(x);
|
||||
anySchema = anySchema.allow(x, x);
|
||||
anySchema = anySchema.allow([x, x, x]);
|
||||
@@ -323,7 +318,6 @@ arrSchema = arrSchema.unique();
|
||||
arrSchema = arrSchema.unique((a, b) => a.test === b.test);
|
||||
arrSchema = arrSchema.unique('customer.id');
|
||||
|
||||
|
||||
arrSchema = arrSchema.items(numSchema);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema, schemaLike);
|
||||
arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]);
|
||||
@@ -333,7 +327,7 @@ arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]);
|
||||
|
||||
// - - - - - - - -
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
// use search & replace from any
|
||||
arrSchema = arrSchema.allow(x);
|
||||
arrSchema = arrSchema.allow(x, x);
|
||||
@@ -387,7 +381,7 @@ namespace common_copy_paste {
|
||||
boolSchema = Joi.bool();
|
||||
boolSchema = Joi.boolean();
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
boolSchema = boolSchema.allow(x);
|
||||
boolSchema = boolSchema.allow(x, x);
|
||||
boolSchema = boolSchema.allow([x, x, x]);
|
||||
@@ -462,7 +456,7 @@ binSchema = binSchema.min(num);
|
||||
binSchema = binSchema.max(num);
|
||||
binSchema = binSchema.length(num);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
binSchema = binSchema.allow(x);
|
||||
binSchema = binSchema.allow(x, x);
|
||||
binSchema = binSchema.allow([x, x, x]);
|
||||
@@ -535,7 +529,7 @@ dateSchema = dateSchema.timestamp();
|
||||
dateSchema = dateSchema.timestamp('javascript');
|
||||
dateSchema = dateSchema.timestamp('unix');
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
dateSchema = dateSchema.allow(x);
|
||||
dateSchema = dateSchema.allow(x, x);
|
||||
dateSchema = dateSchema.allow([x, x, x]);
|
||||
@@ -611,7 +605,7 @@ numSchema = numSchema.positive();
|
||||
numSchema = numSchema.negative();
|
||||
numSchema = numSchema.port();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
numSchema = numSchema.allow(x);
|
||||
numSchema = numSchema.allow(x, x);
|
||||
numSchema = numSchema.allow([x, x, x]);
|
||||
@@ -729,7 +723,7 @@ objSchema = objSchema.forbiddenKeys(str);
|
||||
objSchema = objSchema.forbiddenKeys(str, str);
|
||||
objSchema = objSchema.forbiddenKeys(strArr);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
objSchema = objSchema.allow(x);
|
||||
objSchema = objSchema.allow(x, x);
|
||||
objSchema = objSchema.allow([x, x, x]);
|
||||
@@ -809,7 +803,7 @@ strSchema = strSchema.ip(ipOpts);
|
||||
strSchema = strSchema.uri();
|
||||
strSchema = strSchema.uri(uriOpts);
|
||||
strSchema = strSchema.guid();
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions);
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] });
|
||||
strSchema = strSchema.guid({ version: 'uuidv4' });
|
||||
strSchema = strSchema.hex();
|
||||
strSchema = strSchema.hex(hexOpts);
|
||||
@@ -825,7 +819,7 @@ strSchema = strSchema.normalize('NFKC');
|
||||
strSchema = strSchema.base64();
|
||||
strSchema = strSchema.base64(base64Opts);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
strSchema = strSchema.allow(x);
|
||||
strSchema = strSchema.allow(x, x);
|
||||
strSchema = strSchema.allow([x, x, x]);
|
||||
@@ -891,11 +885,11 @@ schema = Joi.alt(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema)
|
||||
schema = Joi.lazy(() => schema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
namespace validate_tests {
|
||||
{ // validate tests
|
||||
{
|
||||
Joi.validate(value, obj);
|
||||
Joi.validate(value, schema);
|
||||
@@ -925,7 +919,7 @@ namespace validate_tests {
|
||||
|
||||
{
|
||||
let value = { username: 'example', password: 'example' };
|
||||
let schema = Joi.object().keys({
|
||||
const schema = Joi.object().keys({
|
||||
username: Joi.string().max(255).required(),
|
||||
password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(),
|
||||
});
|
||||
@@ -951,12 +945,11 @@ namespace validate_tests {
|
||||
|
||||
returnValue
|
||||
.then(val => JSON.stringify(val, null, 2))
|
||||
.then(val => { throw 'one error'; })
|
||||
.then(val => { throw new Error('one error'); })
|
||||
.catch(e => {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.compile(obj);
|
||||
|
||||
@@ -1,79 +1,13 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
25
types/joi/v10/index.d.ts
vendored
25
types/joi/v10/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for joi v10.6.0
|
||||
// Type definitions for joi 10.6
|
||||
// Project: https://github.com/hapijs/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
@@ -114,7 +114,7 @@ export interface IpOptions {
|
||||
cidr?: string;
|
||||
}
|
||||
|
||||
export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5'
|
||||
export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5';
|
||||
|
||||
export interface GuidOptions {
|
||||
version: GuidVersions[] | GuidVersions;
|
||||
@@ -160,8 +160,8 @@ export interface ReferenceOptions {
|
||||
}
|
||||
|
||||
export interface IPOptions {
|
||||
version?: Array<string>;
|
||||
cidr?: string
|
||||
version?: string[];
|
||||
cidr?: string;
|
||||
}
|
||||
|
||||
export interface JoiObject {
|
||||
@@ -210,7 +210,6 @@ export type Schema = AnySchema
|
||||
| LazySchema;
|
||||
|
||||
export interface AnySchema extends JoiObject {
|
||||
|
||||
/**
|
||||
* Validates a value using the schema and options.
|
||||
*/
|
||||
@@ -411,7 +410,6 @@ export interface State {
|
||||
}
|
||||
|
||||
export interface BooleanSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Allows for additional values to be considered valid booleans by converting them to true during validation.
|
||||
* Accepts a value or an array of values. String comparisons are by default case insensitive,
|
||||
@@ -514,7 +512,6 @@ export interface StringSchema extends AnySchema {
|
||||
max(limit: number, encoding?: string): this;
|
||||
max(limit: Reference, encoding?: string): this;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies whether the string.max() limit should be used as a truncation.
|
||||
* @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value.
|
||||
@@ -651,7 +648,9 @@ export interface ArraySchema extends AnySchema {
|
||||
/**
|
||||
* Lists the types in sequence order for the array values where:
|
||||
* @param type - a joi schema object to validate against each array item in sequence order. type can be an array of values, or multiple values can be passed as individual arguments.
|
||||
* If a given type is .required() then there must be a matching item with the same index position in the array. Errors will contain the number of items that didn't match. Any unmatched item having a label will be mentioned explicitly.
|
||||
* If a given type is .required() then there must be a matching item with the same index position in the array.
|
||||
* Errors will contain the number of items that didn't match.
|
||||
* Any unmatched item having a label will be mentioned explicitly.
|
||||
*/
|
||||
ordered(...types: SchemaLike[]): this;
|
||||
ordered(types: SchemaLike[]): this;
|
||||
@@ -682,7 +681,6 @@ export interface ArraySchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface ObjectSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Sets the allowed object keys.
|
||||
*/
|
||||
@@ -819,7 +817,6 @@ export interface BinarySchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface DateSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specifies the oldest date allowed.
|
||||
* Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date,
|
||||
@@ -862,7 +859,6 @@ export interface DateSchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface FunctionSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specifies the arity of the function where:
|
||||
* @param n - the arity expected.
|
||||
@@ -896,7 +892,6 @@ export interface AlternativesSchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface LazySchema extends AnySchema {
|
||||
|
||||
}
|
||||
|
||||
export interface Reference extends JoiObject {
|
||||
@@ -917,7 +912,7 @@ export type ExtensionBoundSchema = Schema & {
|
||||
* @param options - should the context passed into the `validate` function in a custom rule
|
||||
*/
|
||||
createError(type: string, context: Context, state: State, options: ValidationOptions): Err;
|
||||
}
|
||||
};
|
||||
|
||||
export interface Rules<P extends object = any> {
|
||||
name: string;
|
||||
@@ -1078,8 +1073,8 @@ export function extend(extention: Extension): any;
|
||||
export function describe(schema: Schema): Description;
|
||||
|
||||
/**
|
||||
* Whitelists a value
|
||||
*/
|
||||
* Whitelists a value
|
||||
*/
|
||||
export function allow(value: any, ...values: any[]): Schema;
|
||||
export function allow(values: any[]): Schema;
|
||||
|
||||
|
||||
@@ -2,50 +2,45 @@ import Joi = require('joi');
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var x: any = null;
|
||||
var value: any = null;
|
||||
var num: number = 0;
|
||||
var str: string = '';
|
||||
var bool: boolean = false;
|
||||
var exp: RegExp = null;
|
||||
var obj: object = null;
|
||||
var date: Date = null;
|
||||
var err: Error = null;
|
||||
var func: Function = null;
|
||||
let x: any = null;
|
||||
declare const value: any;
|
||||
let num = 0;
|
||||
let str = '';
|
||||
declare const bool: boolean;
|
||||
declare const exp: RegExp;
|
||||
declare const obj: object;
|
||||
declare const date: Date;
|
||||
declare const err: Error;
|
||||
declare const func: Function;
|
||||
|
||||
var anyArr: any[] = [];
|
||||
var numArr: number[] = [];
|
||||
var strArr: string[] = [];
|
||||
var boolArr: boolean[] = [];
|
||||
var expArr: RegExp[] = [];
|
||||
var objArr: object[] = [];
|
||||
var errArr: Error[] = [];
|
||||
var funcArr: Function[] = [];
|
||||
declare const numArr: number[];
|
||||
declare const strArr: string[];
|
||||
declare const expArr: RegExp[];
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schema: Joi.Schema = null;
|
||||
var schemaLike: Joi.SchemaLike = null;
|
||||
let schema: Joi.Schema = null;
|
||||
declare const schemaLike: Joi.SchemaLike;
|
||||
|
||||
var anySchema: Joi.AnySchema = null;
|
||||
var numSchema: Joi.NumberSchema = null;
|
||||
var strSchema: Joi.StringSchema = null;
|
||||
var arrSchema: Joi.ArraySchema = null;
|
||||
var boolSchema: Joi.BooleanSchema = null;
|
||||
var binSchema: Joi.BinarySchema = null;
|
||||
var dateSchema: Joi.DateSchema = null;
|
||||
var funcSchema: Joi.FunctionSchema = null;
|
||||
var objSchema: Joi.ObjectSchema = null;
|
||||
var altSchema: Joi.AlternativesSchema = null;
|
||||
let anySchema: Joi.AnySchema = null;
|
||||
let numSchema: Joi.NumberSchema = null;
|
||||
let strSchema: Joi.StringSchema = null;
|
||||
let arrSchema: Joi.ArraySchema = null;
|
||||
let boolSchema: Joi.BooleanSchema = null;
|
||||
let binSchema: Joi.BinarySchema = null;
|
||||
let dateSchema: Joi.DateSchema = null;
|
||||
let funcSchema: Joi.FunctionSchema = null;
|
||||
let objSchema: Joi.ObjectSchema = null;
|
||||
let altSchema: Joi.AlternativesSchema = null;
|
||||
|
||||
var schemaArr: Joi.Schema[] = [];
|
||||
declare const schemaArr: Joi.Schema[];
|
||||
|
||||
var ref: Joi.Reference = null;
|
||||
var description: Joi.Description = null;
|
||||
let ref: Joi.Reference = null;
|
||||
let description: Joi.Description = null;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validOpts: Joi.ValidationOptions = null;
|
||||
let validOpts: Joi.ValidationOptions = null;
|
||||
|
||||
validOpts = { abortEarly: bool };
|
||||
validOpts = { convert: bool };
|
||||
@@ -77,7 +72,7 @@ validOpts = {
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var renOpts: Joi.RenameOptions = null;
|
||||
let renOpts: Joi.RenameOptions;
|
||||
|
||||
renOpts = { alias: bool };
|
||||
renOpts = { multiple: bool };
|
||||
@@ -86,7 +81,7 @@ renOpts = { ignoreUndefined: bool };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var emailOpts: Joi.EmailOptions = null;
|
||||
let emailOpts: Joi.EmailOptions;
|
||||
|
||||
emailOpts = { errorLevel: num };
|
||||
emailOpts = { errorLevel: bool };
|
||||
@@ -96,7 +91,7 @@ emailOpts = { minDomainAtoms: num };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var ipOpts: Joi.IpOptions = null;
|
||||
let ipOpts: Joi.IpOptions;
|
||||
|
||||
ipOpts = { version: str };
|
||||
ipOpts = { version: strArr };
|
||||
@@ -104,7 +99,7 @@ ipOpts = { cidr: str };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var uriOpts: Joi.UriOptions = null;
|
||||
let uriOpts: Joi.UriOptions;
|
||||
|
||||
uriOpts = { scheme: str };
|
||||
uriOpts = { scheme: exp };
|
||||
@@ -113,7 +108,7 @@ uriOpts = { scheme: expArr };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenOpts: Joi.WhenOptions = null;
|
||||
let whenOpts: Joi.WhenOptions;
|
||||
|
||||
whenOpts = { is: x };
|
||||
whenOpts = { is: schema, then: schema };
|
||||
@@ -122,7 +117,7 @@ whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenSchemaOpts: Joi.WhenSchemaOptions = null;
|
||||
let whenSchemaOpts: Joi.WhenSchemaOptions;
|
||||
|
||||
whenSchemaOpts = { then: schema };
|
||||
whenSchemaOpts = { otherwise: schema };
|
||||
@@ -130,16 +125,16 @@ whenSchemaOpts = { then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var refOpts: Joi.ReferenceOptions = null;
|
||||
let refOpts: Joi.ReferenceOptions;
|
||||
|
||||
refOpts = { separator: str };
|
||||
refOpts = { contextPrefix: str };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validErr: Joi.ValidationError = null;
|
||||
var validErrItem: Joi.ValidationErrorItem;
|
||||
var validErrFunc: Joi.ValidationErrorFunction;
|
||||
declare const validErr: Joi.ValidationError;
|
||||
let validErrItem: Joi.ValidationErrorItem;
|
||||
let validErrFunc: Joi.ValidationErrorFunction;
|
||||
|
||||
validErrItem = {
|
||||
message: str,
|
||||
@@ -184,7 +179,7 @@ anySchema = objSchema;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schemaMap: Joi.SchemaMap = null;
|
||||
let schemaMap: Joi.SchemaMap;
|
||||
|
||||
schemaMap = {
|
||||
a: numSchema,
|
||||
@@ -216,13 +211,13 @@ schemaMap = {
|
||||
{ c1: true },
|
||||
{ c2: null }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
anySchema = Joi.any();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
anySchema = anySchema.allow(x);
|
||||
anySchema = anySchema.allow(x, x);
|
||||
anySchema = anySchema.allow([x, x, x]);
|
||||
@@ -304,7 +299,6 @@ arrSchema = arrSchema.unique();
|
||||
arrSchema = arrSchema.unique((a, b) => a.test === b.test);
|
||||
arrSchema = arrSchema.unique('customer.id');
|
||||
|
||||
|
||||
arrSchema = arrSchema.items(numSchema);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema, schemaLike);
|
||||
arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]);
|
||||
@@ -314,7 +308,7 @@ arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]);
|
||||
|
||||
// - - - - - - - -
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
// use search & replace from any
|
||||
arrSchema = arrSchema.allow(x);
|
||||
arrSchema = arrSchema.allow(x, x);
|
||||
@@ -368,7 +362,7 @@ namespace common_copy_paste {
|
||||
boolSchema = Joi.bool();
|
||||
boolSchema = Joi.boolean();
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
boolSchema = boolSchema.allow(x);
|
||||
boolSchema = boolSchema.allow(x, x);
|
||||
boolSchema = boolSchema.allow([x, x, x]);
|
||||
@@ -443,7 +437,7 @@ binSchema = binSchema.min(num);
|
||||
binSchema = binSchema.max(num);
|
||||
binSchema = binSchema.length(num);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
binSchema = binSchema.allow(x);
|
||||
binSchema = binSchema.allow(x, x);
|
||||
binSchema = binSchema.allow([x, x, x]);
|
||||
@@ -516,7 +510,7 @@ dateSchema = dateSchema.timestamp();
|
||||
dateSchema = dateSchema.timestamp('javascript');
|
||||
dateSchema = dateSchema.timestamp('unix');
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
dateSchema = dateSchema.allow(x);
|
||||
dateSchema = dateSchema.allow(x, x);
|
||||
dateSchema = dateSchema.allow([x, x, x]);
|
||||
@@ -591,7 +585,7 @@ numSchema = numSchema.multiple(num);
|
||||
numSchema = numSchema.positive();
|
||||
numSchema = numSchema.negative();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
numSchema = numSchema.allow(x);
|
||||
numSchema = numSchema.allow(x, x);
|
||||
numSchema = numSchema.allow([x, x, x]);
|
||||
@@ -702,7 +696,7 @@ objSchema = objSchema.optionalKeys(str);
|
||||
objSchema = objSchema.optionalKeys(str, str);
|
||||
objSchema = objSchema.optionalKeys(strArr);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
objSchema = objSchema.allow(x);
|
||||
objSchema = objSchema.allow(x, x);
|
||||
objSchema = objSchema.allow([x, x, x]);
|
||||
@@ -781,7 +775,7 @@ strSchema = strSchema.ip(ipOpts);
|
||||
strSchema = strSchema.uri();
|
||||
strSchema = strSchema.uri(uriOpts);
|
||||
strSchema = strSchema.guid();
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions);
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] });
|
||||
strSchema = strSchema.guid({ version: 'uuidv4' });
|
||||
strSchema = strSchema.hex();
|
||||
strSchema = strSchema.hostname();
|
||||
@@ -794,7 +788,7 @@ strSchema = strSchema.truncate(false);
|
||||
strSchema = strSchema.normalize();
|
||||
strSchema = strSchema.normalize('NFKC');
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
strSchema = strSchema.allow(x);
|
||||
strSchema = strSchema.allow(x, x);
|
||||
strSchema = strSchema.allow([x, x, x]);
|
||||
@@ -860,11 +854,11 @@ schema = Joi.alt(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema)
|
||||
schema = Joi.lazy(() => schema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
namespace validate_tests {
|
||||
{ // validate tests
|
||||
{
|
||||
Joi.validate(value, obj);
|
||||
Joi.validate(value, schema);
|
||||
@@ -894,7 +888,7 @@ namespace validate_tests {
|
||||
|
||||
{
|
||||
let value = { username: 'example', password: 'example' };
|
||||
let schema = Joi.object().keys({
|
||||
const schema = Joi.object().keys({
|
||||
username: Joi.string().max(255).required(),
|
||||
password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(),
|
||||
});
|
||||
@@ -920,7 +914,6 @@ namespace validate_tests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.compile(obj);
|
||||
|
||||
@@ -1,79 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
1507
types/joi/v6/index.d.ts
vendored
1507
types/joi/v6/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -2,48 +2,42 @@ import Joi = require('joi');
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var x: any = null;
|
||||
var value: any = null;
|
||||
var num: number = 0;
|
||||
var str: string = '';
|
||||
var bool: boolean = false;
|
||||
var exp: RegExp = null;
|
||||
var obj: Object = null;
|
||||
var date: Date = null;
|
||||
var err: Error = null;
|
||||
var func: Function = null;
|
||||
let x: any = null;
|
||||
declare const value: any;
|
||||
let num = 0;
|
||||
let str = '';
|
||||
declare const bool: boolean;
|
||||
declare const exp: RegExp;
|
||||
declare const obj: Object;
|
||||
declare const date: Date;
|
||||
declare const err: Error;
|
||||
declare const func: Function;
|
||||
|
||||
var anyArr: any[] = [];
|
||||
var numArr: number[] = [];
|
||||
var strArr: string[] = [];
|
||||
var boolArr: boolean[] = [];
|
||||
var expArr: RegExp[] = [];
|
||||
var objArr: Object[] = [];
|
||||
var errArr: Error[] = [];
|
||||
var funcArr: Function[] = [];
|
||||
declare const strArr: string[];
|
||||
declare const expArr: RegExp[];
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schema: Joi.Schema = null;
|
||||
let schema: Joi.Schema = null;
|
||||
|
||||
var anySchema: Joi.AnySchema<Joi.Schema> = null;
|
||||
var numSchema: Joi.NumberSchema = null;
|
||||
var strSchema: Joi.StringSchema = null;
|
||||
var arrSchema: Joi.ArraySchema = null;
|
||||
var boolSchema: Joi.BooleanSchema = null;
|
||||
var binSchema: Joi.BinarySchema = null;
|
||||
var dateSchema: Joi.DateSchema = null;
|
||||
var funcSchema: Joi.FunctionSchema = null;
|
||||
var objSchema: Joi.ObjectSchema = null;
|
||||
var altSchema: Joi.AlternativesSchema = null;
|
||||
let anySchema: Joi.AnySchema<Joi.Schema> = null;
|
||||
let numSchema: Joi.NumberSchema = null;
|
||||
let strSchema: Joi.StringSchema = null;
|
||||
let arrSchema: Joi.ArraySchema = null;
|
||||
let boolSchema: Joi.BooleanSchema = null;
|
||||
let binSchema: Joi.BinarySchema = null;
|
||||
let dateSchema: Joi.DateSchema = null;
|
||||
let funcSchema: Joi.FunctionSchema = null;
|
||||
let objSchema: Joi.ObjectSchema = null;
|
||||
let altSchema: Joi.AlternativesSchema = null;
|
||||
|
||||
var schemaArr: Joi.Schema[] = [];
|
||||
declare const schemaArr: Joi.Schema[];
|
||||
|
||||
var ref: Joi.Reference = null;
|
||||
let ref: Joi.Reference = null;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validOpts: Joi.ValidationOptions = null;
|
||||
let validOpts: Joi.ValidationOptions = null;
|
||||
|
||||
validOpts = {abortEarly: bool};
|
||||
validOpts = {convert: bool};
|
||||
@@ -56,7 +50,7 @@ validOpts = {context: obj};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var renOpts: Joi.RenameOptions = null;
|
||||
let renOpts: Joi.RenameOptions = null;
|
||||
|
||||
renOpts = {alias: bool};
|
||||
renOpts = {multiple: bool};
|
||||
@@ -65,7 +59,7 @@ renOpts = {ignoreUndefined: bool};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var emailOpts: Joi.EmailOptions = null;
|
||||
let emailOpts: Joi.EmailOptions = null;
|
||||
|
||||
emailOpts = {errorLevel: num};
|
||||
emailOpts = {errorLevel: bool};
|
||||
@@ -75,7 +69,7 @@ emailOpts = {minDomainAtoms: num};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var ipOpts: Joi.IpOptions = null;
|
||||
let ipOpts: Joi.IpOptions = null;
|
||||
|
||||
ipOpts = {version: str};
|
||||
ipOpts = {version: strArr};
|
||||
@@ -83,7 +77,7 @@ ipOpts = {cidr: str};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var uriOpts: Joi.UriOptions = null;
|
||||
let uriOpts: Joi.UriOptions = null;
|
||||
|
||||
uriOpts = {scheme: str};
|
||||
uriOpts = {scheme: exp};
|
||||
@@ -92,7 +86,7 @@ uriOpts = {scheme: expArr};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenOpts: Joi.WhenOptions<any> = null;
|
||||
let whenOpts: Joi.WhenOptions<any> = null;
|
||||
|
||||
whenOpts = {is: x};
|
||||
whenOpts = {is: schema, then: schema};
|
||||
@@ -100,17 +94,17 @@ whenOpts = {is: schema, otherwise: schema};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var refOpts: Joi.ReferenceOptions = null;
|
||||
let refOpts: Joi.ReferenceOptions = null;
|
||||
|
||||
refOpts = {separator: str};
|
||||
refOpts = {contextPrefix: str};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validErr: Joi.ValidationError = null;
|
||||
var validErrItem: Joi.ValidationErrorItem;
|
||||
declare const validErr: Joi.ValidationError;
|
||||
let validErrItem: Joi.ValidationErrorItem;
|
||||
|
||||
validErrItem= {
|
||||
validErrItem = {
|
||||
message: str,
|
||||
type: str,
|
||||
path: str
|
||||
@@ -149,7 +143,7 @@ anySchema = objSchema;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schemaMap: Joi.SchemaMap = null;
|
||||
let schemaMap: Joi.SchemaMap = null;
|
||||
|
||||
schemaMap = {
|
||||
a: numSchema,
|
||||
@@ -160,7 +154,7 @@ schemaMap = {
|
||||
|
||||
anySchema = Joi.any();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
anySchema = anySchema.allow(x);
|
||||
anySchema = anySchema.allow(x, x);
|
||||
anySchema = anySchema.allow([x, x, x]);
|
||||
@@ -235,10 +229,9 @@ arrSchema = arrSchema.items(numSchema);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema);
|
||||
arrSchema = arrSchema.items([numSchema, strSchema]);
|
||||
|
||||
|
||||
// - - - - - - - -
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
// use search & replace from any
|
||||
arrSchema = arrSchema.allow(x);
|
||||
arrSchema = arrSchema.allow(x, x);
|
||||
@@ -291,7 +284,7 @@ namespace common_copy_paste {
|
||||
boolSchema = Joi.bool();
|
||||
boolSchema = Joi.boolean();
|
||||
|
||||
namespace common_copy_paste {
|
||||
{ // common copy paste
|
||||
boolSchema = boolSchema.allow(x);
|
||||
boolSchema = boolSchema.allow(x, x);
|
||||
boolSchema = boolSchema.allow([x, x, x]);
|
||||
@@ -347,7 +340,7 @@ binSchema = binSchema.min(num);
|
||||
binSchema = binSchema.max(num);
|
||||
binSchema = binSchema.length(num);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
binSchema = binSchema.allow(x);
|
||||
binSchema = binSchema.allow(x, x);
|
||||
binSchema = binSchema.allow([x, x, x]);
|
||||
@@ -415,7 +408,7 @@ dateSchema = dateSchema.format(strArr);
|
||||
|
||||
dateSchema = dateSchema.iso();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
dateSchema = dateSchema.allow(x);
|
||||
dateSchema = dateSchema.allow(x, x);
|
||||
dateSchema = dateSchema.allow([x, x, x]);
|
||||
@@ -484,7 +477,7 @@ numSchema = numSchema.multiple(num);
|
||||
numSchema = numSchema.positive();
|
||||
numSchema = numSchema.negative();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
numSchema = numSchema.allow(x);
|
||||
numSchema = numSchema.allow(x, x);
|
||||
numSchema = numSchema.allow([x, x, x]);
|
||||
@@ -593,7 +586,7 @@ objSchema = objSchema.optionalKeys(str);
|
||||
objSchema = objSchema.optionalKeys(str, str);
|
||||
objSchema = objSchema.optionalKeys(strArr);
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
objSchema = objSchema.allow(x);
|
||||
objSchema = objSchema.allow(x, x);
|
||||
objSchema = objSchema.allow([x, x, x]);
|
||||
@@ -678,7 +671,7 @@ strSchema = strSchema.lowercase();
|
||||
strSchema = strSchema.uppercase();
|
||||
strSchema = strSchema.trim();
|
||||
|
||||
namespace common {
|
||||
{ // common
|
||||
strSchema = strSchema.allow(x);
|
||||
strSchema = strSchema.allow(x, x);
|
||||
strSchema = strSchema.allow([x, x, x]);
|
||||
|
||||
@@ -1,79 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user