From 05e1ee714f4f5e4755cd89d434a844b8e205bdc5 Mon Sep 17 00:00:00 2001 From: ssube Date: Sun, 10 Nov 2019 22:14:09 -0600 Subject: [PATCH] lint: declare default filter once --- src/rule/SchemaRule.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rule/SchemaRule.ts b/src/rule/SchemaRule.ts index 3846d2a..75d01b4 100644 --- a/src/rule/SchemaRule.ts +++ b/src/rule/SchemaRule.ts @@ -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); }