1
0
Fork 0

lint: declare default filter once

This commit is contained in:
ssube 2019-11-10 22:14:09 -06:00
parent 13d42e8b6f
commit 05e1ee714f
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@ import { VisitorContext } from '../visitor/VisitorContext';
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/strict-boolean-expressions */
const DEFAULT_FILTER = () => true;
export class SchemaRule implements Rule, RuleData, Visitor {
public readonly check: ValidateFunction;
public readonly desc: string;
@ -67,7 +69,7 @@ export class SchemaRule implements Rule, RuleData, Visitor {
protected compileFilter(ctx: VisitorContext): ValidateFunction {
if (isNil(this.filter)) {
return () => true;
return DEFAULT_FILTER;
} else {
return ctx.compile(this.filter);
}