Again fixing linting need to disable object-literal-shorthand for SimpleSchema.custom

This commit is contained in:
arichter83
2018-12-06 15:15:50 +01:00
parent 34bd9bc71d
commit 4c382097c7
3 changed files with 28 additions and 17 deletions

View File

@@ -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;

View File

@@ -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;
}
}
});

View File

@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"object-literal-shorthand": false
}
}