mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
Again fixing linting need to disable object-literal-shorthand for SimpleSchema.custom
This commit is contained in:
36
types/simpl-schema/index.d.ts
vendored
36
types/simpl-schema/index.d.ts
vendored
@@ -34,20 +34,25 @@ interface CustomValidationContext {
|
||||
operator: any;
|
||||
validationContext: ValidationContext;
|
||||
|
||||
/** Use this method to get information about other fields. Pass a field name
|
||||
(non-generic schema key) as the only argument. The return object will
|
||||
have isSet, value, and operator properties for that field. */
|
||||
/**
|
||||
* Use this method to get information about other fields. Pass a field name
|
||||
* (non-generic schema key) as the only argument. The return object will
|
||||
* have isSet, value, and operator properties for that field.
|
||||
*/
|
||||
field(): any;
|
||||
|
||||
/** Use this method to get information about other fields that have the same
|
||||
parent object. Works the same way as field(). This is helpful when you use
|
||||
sub-schemas or when you're dealing with arrays of objects. */
|
||||
/**
|
||||
* Use this method to get information about other fields that have the same
|
||||
* parent object. Works the same way as field(). This is helpful when you use
|
||||
* sub-schemas or when you're dealing with arrays of objects.
|
||||
*/
|
||||
siblingField(): any;
|
||||
|
||||
/** Call this to add validation errors for any key. In general, you should use
|
||||
this to add errors for other keys. To add an error for the current key,
|
||||
return the error type string. If you do use this to add an error for the
|
||||
current key, return false from your custom validation function. */
|
||||
/**
|
||||
* Call this to add validation errors for any key. In general, you should use
|
||||
* this to add errors for other keys. To add an error for the current key,
|
||||
* return the error type string. If you do use this to add an error for the
|
||||
* current key, return false from your custom validation function.
|
||||
*/
|
||||
addValidationErrors(errors: SimpleSchemaValidationError): any;
|
||||
}
|
||||
|
||||
@@ -64,10 +69,11 @@ interface SchemaDefinition {
|
||||
exclusiveMax?: boolean;
|
||||
exclusiveMin?: boolean;
|
||||
regEx?: RegExp | RegExp[];
|
||||
|
||||
/** For custom validation function. If you use an arrow function the context
|
||||
for "this" will not be available. Use "custom: function() { return
|
||||
something(this.value); }" instead. */
|
||||
/**
|
||||
* For custom validation function. If you use an arrow function the context
|
||||
* for "this" will not be available. Use "custom: function() { return
|
||||
* something(this.value); }" instead.
|
||||
*/
|
||||
custom?: (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError;
|
||||
blackbox?: boolean;
|
||||
autoValue?: () => any;
|
||||
|
||||
@@ -24,7 +24,7 @@ const StringSchema = new SimpleSchema({
|
||||
const text = this.value;
|
||||
|
||||
if (text.length > 100) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 100 };
|
||||
else if (text.length <10) return SimpleSchema.ErrorTypes.MIN_STRING
|
||||
else if (text.length < 10) return SimpleSchema.ErrorTypes.MIN_STRING;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"object-literal-shorthand": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user