Skip to content

Commit 6ee136a

Browse files
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
1 parent 1d4922c commit 6ee136a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/lib/application-events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const ApplicationEvents = {
22
BOOTSTRAP_END: "bootstrapEnd",
3+
VALIDATE_PROJECT: "validateProject",
34
};

src/lib/application.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ export class Application extends ChildableComponent<
107107
*/
108108
static readonly EVENT_BOOTSTRAP_END = ApplicationEvents.BOOTSTRAP_END;
109109

110+
/**
111+
* Emitted when validation is being run.
112+
* The listener will be given an instance of {@link ProjectReflection}.
113+
*/
114+
static readonly EVENT_VALIDATE_PROJECT = ApplicationEvents.VALIDATE_PROJECT;
115+
110116
/**
111117
* Create a new TypeDoc application instance.
112118
*/
@@ -431,6 +437,8 @@ export class Application extends ChildableComponent<
431437
validateLinks(project, this.logger);
432438
}
433439

440+
this.trigger(Application.EVENT_VALIDATE_PROJECT, project);
441+
434442
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
435443
}
436444

0 commit comments

Comments
 (0)