From 6ee136acbf5e98f93652a13a2d4206685321f82c Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Mon, 27 Feb 2023 04:15:25 +1300 Subject: [PATCH] feat: add validator run event to allow plugins to perform custom validation (#2184) * feat: add validator run event to allow plugins to perform custom validation --- src/lib/application-events.ts | 1 + src/lib/application.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/lib/application-events.ts b/src/lib/application-events.ts index f69fe683e..7fc75b25d 100644 --- a/src/lib/application-events.ts +++ b/src/lib/application-events.ts @@ -1,3 +1,4 @@ export const ApplicationEvents = { BOOTSTRAP_END: "bootstrapEnd", + VALIDATE_PROJECT: "validateProject", }; diff --git a/src/lib/application.ts b/src/lib/application.ts index 12710837d..16c529d6b 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -107,6 +107,12 @@ export class Application extends ChildableComponent< */ static readonly EVENT_BOOTSTRAP_END = ApplicationEvents.BOOTSTRAP_END; + /** + * Emitted when validation is being run. + * The listener will be given an instance of {@link ProjectReflection}. + */ + static readonly EVENT_VALIDATE_PROJECT = ApplicationEvents.VALIDATE_PROJECT; + /** * Create a new TypeDoc application instance. */ @@ -431,6 +437,8 @@ export class Application extends ChildableComponent< validateLinks(project, this.logger); } + this.trigger(Application.EVENT_VALIDATE_PROJECT, project); + this.logger.verbose(`Validation took ${Date.now() - start}ms`); }