refactor(dev-infra): ensure compatibility with noImplicitOverride (#42512)

Adds the `override` keyword to the `dev-infra` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
This commit is contained in:
Paul Gschwendtner 2021-06-07 21:00:18 +02:00 committed by Andrew Kushnir
parent ccbb913f4b
commit 907363348a
11 changed files with 19 additions and 19 deletions

View File

@ -44,7 +44,7 @@ export class ConfigureNextAsMajorAction extends ReleaseAction {
info(yellow(` Please ask team members to review: ${pullRequest.url}.`));
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// The `next` branch can always be switched to a major version, unless it already
// is targeting a new major. A major can contain minor changes, so we can always
// change the target from a minor to a major.

View File

@ -74,7 +74,7 @@ export class CutLongTermSupportPatchAction extends ReleaseAction {
return {name: `v${branch.version.major} (from ${branch.name})`, value: branch};
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// LTS patch versions can be only cut if there are release trains in LTS phase.
// This action is always selectable as we support publishing of old LTS branches,
// and have prompt for selecting an LTS branch when the action performs.

View File

@ -36,7 +36,7 @@ export class CutNewPatchAction extends ReleaseAction {
await this.cherryPickChangelogIntoNextBranch(releaseNotes, branchName);
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// Patch versions can be cut at any time. See:
// https://hackmd.io/2Le8leq0S6G_R5VEVTNK9A#Release-prompt-options.
return true;

View File

@ -64,7 +64,7 @@ export class CutNextPrereleaseAction extends ReleaseAction {
}
}
static async isActive() {
static override async isActive() {
// Pre-releases for the `next` NPM dist tag can always be cut. Depending on whether
// there is a feature-freeze/release-candidate branch, the next pre-releases are either
// cut from such a branch, or from the actual `next` release-train branch (i.e. master).

View File

@ -34,7 +34,7 @@ export class CutReleaseCandidateAction extends ReleaseAction {
await this.cherryPickChangelogIntoNextBranch(releaseNotes, branchName);
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// A release-candidate can be cut for an active release-train currently
// in the feature-freeze phase.
return active.releaseCandidate !== null &&

View File

@ -73,7 +73,7 @@ export class CutStableAction extends ReleaseAction {
return semver.parse(`${version.major}.${version.minor}.${version.patch}`)!;
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// A stable version can be cut for an active release-train currently in the
// release-candidate phase. Note: It is not possible to directly release from
// feature-freeze phase into a stable version.

View File

@ -100,7 +100,7 @@ export class MoveNextIntoFeatureFreezeAction extends ReleaseAction {
info(yellow(` Please ask team members to review: ${nextUpdatePullRequest.url}.`));
}
static async isActive(active: ActiveReleaseTrains) {
static override async isActive(active: ActiveReleaseTrains) {
// A new feature-freeze/release-candidate branch can only be created if there
// is no active release-train in feature-freeze/release-candidate phase.
return active.releaseCandidate === null;

View File

@ -35,7 +35,7 @@ export class TagRecentMajorAsLatest extends ReleaseAction {
await invokeSetNpmDistCommand('latest', this.active.latest.version);
}
static async isActive({latest}: ActiveReleaseTrains, config: ReleaseConfig) {
static override async isActive({latest}: ActiveReleaseTrains, config: ReleaseConfig) {
// If the latest release-train does currently not have a major version as version. e.g.
// the latest branch is `10.0.x` with the version being `10.0.2`. In such cases, a major
// has not been released recently, and this action should never become active.

View File

@ -16,23 +16,23 @@ import {ReleaseNotes} from '../../../notes/release-notes';
* returning versioned entry strings.
*/
class MockReleaseNotes extends ReleaseNotes {
static async fromRange(version: semver.SemVer, startingRef: string, endingRef: string) {
static override async fromRange(version: semver.SemVer, startingRef: string, endingRef: string) {
return new MockReleaseNotes(version, startingRef, endingRef);
}
async getChangelogEntry() {
override async getChangelogEntry() {
return `Changelog Entry for ${this.version}`;
}
async getGithubReleaseEntry() {
override async getGithubReleaseEntry() {
return `Github Release Entry for ${this.version}`;
}
// Overrides of utility functions which call out to other tools and are unused in this mock.
protected async getCommitsInRange(from: string, to?: string) {
protected override async getCommitsInRange(from: string, to?: string) {
return [];
}
protected getReleaseConfig(config?: Partial<DevInfraReleaseConfig>) {
protected override getReleaseConfig(config?: Partial<DevInfraReleaseConfig>) {
return {} as ReleaseConfig;
}
}

View File

@ -31,19 +31,19 @@ export class AuthenticatedGitClient extends GitClient {
private _cachedOauthScopes: Promise<string[]>|null = null;
/** Instance of an authenticated github client. */
readonly github = new AuthenticatedGithubClient(this.githubToken);
override readonly github = new AuthenticatedGithubClient(this.githubToken);
protected constructor(readonly githubToken: string, baseDir?: string, config?: NgDevConfig) {
super(baseDir, config);
}
/** Sanitizes a given message by omitting the provided Github token if present. */
sanitizeConsoleOutput(value: string): string {
override sanitizeConsoleOutput(value: string): string {
return value.replace(this._githubTokenRegex, '<TOKEN>');
}
/** Git URL that resolves to the configured repository. */
getRepoGitUrl() {
override getRepoGitUrl() {
return getRepositoryGitUrl(this.remoteConfig, this.githubToken);
}
@ -102,7 +102,7 @@ export class AuthenticatedGitClient extends GitClient {
* Static method to get the singleton instance of the `AuthenticatedGitClient`,
* creating it if it has not yet been created.
*/
static get(): AuthenticatedGitClient {
static override get(): AuthenticatedGitClient {
if (!AuthenticatedGitClient._authenticatedInstance) {
throw new Error('No instance of `AuthenticatedGitClient` has been set up yet.');
}

View File

@ -78,12 +78,12 @@ export class VirtualGitClient extends AuthenticatedGitClient {
* Override the actual GitClient getLatestSemverTag, as an actual tag cannot be retrieved in
* testing.
*/
getLatestSemverTag() {
override getLatestSemverTag() {
return new SemVer('0.0.0');
}
/** Override for the actual Git client command execution. */
runGraceful(args: string[], options: SpawnSyncOptions = {}): SpawnSyncReturns<string> {
override runGraceful(args: string[], options: SpawnSyncOptions = {}): SpawnSyncReturns<string> {
const [command, ...rawArgs] = args;
switch (command) {
case 'push':