Skip to content

Commit

Permalink
feat: add validator run event to allow plugins to perform custom vali…
Browse files Browse the repository at this point in the history
…dation (#2184)

* feat: add validator run event to allow plugins to perform custom validation
  • Loading branch information
RebeccaStevens committed Feb 26, 2023
1 parent 1d4922c commit 6ee136a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/application-events.ts
@@ -1,3 +1,4 @@
export const ApplicationEvents = {
BOOTSTRAP_END: "bootstrapEnd",
VALIDATE_PROJECT: "validateProject",
};
8 changes: 8 additions & 0 deletions src/lib/application.ts
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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`);
}

Expand Down

0 comments on commit 6ee136a

Please sign in to comment.