Lint the workflow parser package
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import {TemplateSchema} from ".";
|
||||
import {DEFINITION, BOOLEAN} from "../template-constants";
|
||||
import {MappingToken, LiteralToken} from "../tokens";
|
||||
import {TokenType} from "../tokens/types";
|
||||
@@ -40,5 +39,7 @@ export class BooleanDefinition extends ScalarDefinition {
|
||||
return literal.templateTokenType === TokenType.Boolean;
|
||||
}
|
||||
|
||||
public override validate(schema: TemplateSchema, name: string): void {}
|
||||
public override validate(): void {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import {TemplateSchema} from "./template-schema";
|
||||
import {DEFINITION, NULL} from "../template-constants";
|
||||
import {MappingToken, LiteralToken} from "../tokens";
|
||||
import {DefinitionType} from "./definition-type";
|
||||
@@ -40,5 +39,7 @@ export class NullDefinition extends ScalarDefinition {
|
||||
return literal.templateTokenType === TokenType.Null;
|
||||
}
|
||||
|
||||
public override validate(schema: TemplateSchema, name: string): void {}
|
||||
public override validate(): void {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import {TemplateSchema} from "./template-schema";
|
||||
import {DEFINITION, NUMBER} from "../template-constants";
|
||||
import {MappingToken, LiteralToken} from "../tokens";
|
||||
import {DefinitionType} from "./definition-type";
|
||||
@@ -40,5 +39,7 @@ export class NumberDefinition extends ScalarDefinition {
|
||||
return literal.templateTokenType === TokenType.Number;
|
||||
}
|
||||
|
||||
public override validate(schema: TemplateSchema, name: string): void {}
|
||||
public override validate(): void {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import {LiteralToken, MappingToken, StringToken} from "../tokens";
|
||||
import {TokenType} from "../tokens/types";
|
||||
import {DefinitionType} from "./definition-type";
|
||||
import {ScalarDefinition} from "./scalar-definition";
|
||||
import {TemplateSchema} from "./template-schema";
|
||||
|
||||
export class StringDefinition extends ScalarDefinition {
|
||||
public constant = "";
|
||||
@@ -80,7 +79,7 @@ export class StringDefinition extends ScalarDefinition {
|
||||
return false;
|
||||
}
|
||||
|
||||
public override validate(schema: TemplateSchema, name: string): void {
|
||||
public override validate(): void {
|
||||
if (this.constant && this.requireNonEmpty) {
|
||||
throw new Error(`Properties '${CONSTANT}' and '${REQUIRE_NON_EMPTY}' cannot both be set`);
|
||||
}
|
||||
|
||||
@@ -324,6 +324,7 @@ export class TemplateSchema {
|
||||
const template = readTemplate(context, TEMPLATE_SCHEMA, objectReader, undefined);
|
||||
context.errors.check();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const mapping = template!.assertMapping(TEMPLATE_SCHEMA);
|
||||
const schema = new TemplateSchema(mapping);
|
||||
schema.validate();
|
||||
|
||||
Reference in New Issue
Block a user