Skip to content

Commit b5ab7af

Browse files
devversionAndrewKushnir
authored andcommitted
refactor: add override keyword to members implementing abstract declarations (angular#42512)
In combination with the TS `noImplicitOverride` compatibility changes, we also want to follow the best-practice of adding `override` to members which are implemented as part of abstract classes. This commit fixes all instances which will be flagged as part of the custom `no-implicit-override-abstract` TSLint rule. PR Close angular#42512
1 parent 04642e7 commit b5ab7af

File tree

113 files changed

+517
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+517
-511
lines changed

dev-infra/caretaker/check/base.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ const exampleData = 'this is example data' as const;
1313

1414
/** A simple usage of the BaseModule to illustrate the workings built into the abstract class. */
1515
class ConcreteBaseModule extends BaseModule<typeof exampleData> {
16-
async retrieveData() {
16+
override async retrieveData() {
1717
return exampleData;
1818
}
19-
async printToTerminal() {}
19+
override async printToTerminal() {}
2020
}
2121

2222
describe('BaseModule', () => {

dev-infra/caretaker/check/ci.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type CiData = {
2525
}[];
2626

2727
export class CiModule extends BaseModule<CiData> {
28-
async retrieveData() {
28+
override async retrieveData() {
2929
const gitRepoWithApi = {api: this.git.github, ...this.git.remoteConfig};
3030
const releaseTrains = await fetchActiveReleaseTrains(gitRepoWithApi);
3131

@@ -52,7 +52,7 @@ export class CiModule extends BaseModule<CiData> {
5252
return await Promise.all(ciResultPromises);
5353
}
5454

55-
async printToTerminal() {
55+
override async printToTerminal() {
5656
const data = await this.data;
5757
const minLabelLength = Math.max(...data.map(result => result.label.length));
5858
info.group(bold(`CI`));

dev-infra/caretaker/check/g3.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface G3StatsData {
2323
}
2424

2525
export class G3Module extends BaseModule<G3StatsData|void> {
26-
async retrieveData() {
26+
override async retrieveData() {
2727
const toCopyToG3 = this.getG3FileIncludeAndExcludeLists();
2828
const latestSha = this.getLatestShas();
2929

@@ -35,7 +35,7 @@ export class G3Module extends BaseModule<G3StatsData|void> {
3535
latestSha.g3, latestSha.master, toCopyToG3.include, toCopyToG3.exclude);
3636
}
3737

38-
async printToTerminal() {
38+
override async printToTerminal() {
3939
const stats = await this.data;
4040
if (!stats) {
4141
return;

dev-infra/caretaker/check/github.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type GithubQueryResult = {
4545
const MAX_RETURNED_ISSUES = 20;
4646

4747
export class GithubQueriesModule extends BaseModule<GithubQueryResults|void> {
48-
async retrieveData() {
48+
override async retrieveData() {
4949
// Non-null assertion is used here as the check for undefined immediately follows to confirm the
5050
// assertion. Typescript's type filtering does not seem to work as needed to understand
5151
// whether githubQueries is undefined or not.
@@ -95,7 +95,7 @@ export class GithubQueriesModule extends BaseModule<GithubQueryResults|void> {
9595
return graphqlQuery;
9696
}
9797

98-
async printToTerminal() {
98+
override async printToTerminal() {
9999
const queryResults = await this.data;
100100
if (!queryResults) {
101101
return;

dev-infra/caretaker/check/services.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ export const services: ServiceConfig[] = [
4545
];
4646

4747
export class ServicesModule extends BaseModule<StatusCheckResult[]> {
48-
async retrieveData() {
48+
override async retrieveData() {
4949
return Promise.all(services.map(service => this.getStatusFromStandardApi(service)));
5050
}
5151

52-
async printToTerminal() {
52+
override async printToTerminal() {
5353
const statuses = await this.data;
5454
const serviceNameMinLength = Math.max(...statuses.map(service => service.name.length));
5555
info.group(bold('Service Statuses'));

dev-infra/format/formatters/buildifier.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import {Formatter} from './base-formatter';
1616
* Formatter for running buildifier against bazel related files.
1717
*/
1818
export class Buildifier extends Formatter {
19-
name = 'buildifier';
19+
override name = 'buildifier';
2020

21-
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/buildifier');
21+
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/buildifier');
2222

23-
defaultFileMatcher = ['**/*.bzl', '**/BUILD.bazel', '**/WORKSPACE', '**/BUILD'];
23+
override defaultFileMatcher = ['**/*.bzl', '**/BUILD.bazel', '**/WORKSPACE', '**/BUILD'];
2424

25-
actions = {
25+
override actions = {
2626
check: {
2727
commandFlags: `${BAZEL_WARNING_FLAG} --lint=warn --mode=check --format=json`,
2828
callback:

dev-infra/format/formatters/clang-format.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import {Formatter} from './base-formatter';
1616
* Formatter for running clang-format against Typescript and Javascript files
1717
*/
1818
export class ClangFormat extends Formatter {
19-
name = 'clang-format';
19+
override name = 'clang-format';
2020

21-
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');
21+
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');
2222

23-
defaultFileMatcher = ['**/*.{t,j}s'];
23+
override defaultFileMatcher = ['**/*.{t,j}s'];
2424

25-
actions = {
25+
override actions = {
2626
check: {
2727
commandFlags: `--Werror -n -style=file`,
2828
callback:

dev-infra/format/formatters/prettier.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import {Formatter} from './base-formatter';
1717
* Formatter for running prettier against Typescript and Javascript files.
1818
*/
1919
export class Prettier extends Formatter {
20-
name = 'prettier';
20+
override name = 'prettier';
2121

22-
binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/prettier');
22+
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/prettier');
2323

24-
defaultFileMatcher = ['**/*.{t,j}s'];
24+
override defaultFileMatcher = ['**/*.{t,j}s'];
2525

2626
/**
2727
* The configuration path of the prettier config, obtained during construction to prevent needing
@@ -30,7 +30,7 @@ export class Prettier extends Formatter {
3030
private configPath =
3131
this.config['prettier'] ? exec(`${this.binaryFilePath} --find-config-path .`).trim() : '';
3232

33-
actions = {
33+
override actions = {
3434
check: {
3535
commandFlags: `--config ${this.configPath} --check`,
3636
callback:

dev-infra/pr/merge/strategies/api-merge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class GithubApiMergeStrategy extends MergeStrategy {
4444
super(git);
4545
}
4646

47-
async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
47+
override async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
4848
const {githubTargetBranch, prNumber, targetBranches, requiredBaseSha, needsCommitMessageFixup} =
4949
pullRequest;
5050
// If the pull request does not have its base branch set to any determined target

dev-infra/pr/merge/strategies/autosquash-merge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class AutosquashMergeStrategy extends MergeStrategy {
3131
* specific to the pull request merge.
3232
* @returns A pull request failure or null in case of success.
3333
*/
34-
async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
34+
override async merge(pullRequest: PullRequest): Promise<PullRequestFailure|null> {
3535
const {prNumber, targetBranches, requiredBaseSha, needsCommitMessageFixup, githubTargetBranch} =
3636
pullRequest;
3737
// In case a required base is specified for this pull request, check if the pull

dev-infra/release/publish/actions/configure-next-as-major.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import {packageJsonPath} from '../constants';
2121
export class ConfigureNextAsMajorAction extends ReleaseAction {
2222
private _newVersion = semver.parse(`${this.active.next.version.major + 1}.0.0-next.0`)!;
2323

24-
async getDescription() {
24+
override async getDescription() {
2525
const {branchName} = this.active.next;
2626
const newVersion = this._newVersion;
2727
return `Configure the "${branchName}" branch to be released as major (v${newVersion}).`;
2828
}
2929

30-
async perform() {
30+
override async perform() {
3131
const {branchName} = this.active.next;
3232
const newVersion = this._newVersion;
3333

dev-infra/release/publish/actions/cut-lts-patch.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export class CutLongTermSupportPatchAction extends ReleaseAction {
2222
/** Promise resolving an object describing long-term support branches. */
2323
ltsBranches = fetchLongTermSupportBranchesFromNpm(this.config);
2424

25-
async getDescription() {
25+
override async getDescription() {
2626
const {active} = await this.ltsBranches;
2727
return `Cut a new release for an active LTS branch (${active.length} active).`;
2828
}
2929

30-
async perform() {
30+
override async perform() {
3131
const ltsBranch = await this._promptForTargetLtsBranch();
3232
const newVersion = semverInc(ltsBranch.version, 'patch');
3333
const {pullRequest: {id}, releaseNotes} =

dev-infra/release/publish/actions/cut-new-patch.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import {ReleaseAction} from '../actions';
1818
export class CutNewPatchAction extends ReleaseAction {
1919
private _newVersion = semverInc(this.active.latest.version, 'patch');
2020

21-
async getDescription() {
21+
override async getDescription() {
2222
const {branchName} = this.active.latest;
2323
const newVersion = this._newVersion;
2424
return `Cut a new patch release for the "${branchName}" branch (v${newVersion}).`;
2525
}
2626

27-
async perform() {
27+
override async perform() {
2828
const {branchName} = this.active.latest;
2929
const newVersion = this._newVersion;
3030

dev-infra/release/publish/actions/cut-next-prerelease.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export class CutNextPrereleaseAction extends ReleaseAction {
2121
/** Promise resolving with the new version if a NPM next pre-release is cut. */
2222
private _newVersion: Promise<semver.SemVer> = this._computeNewVersion();
2323

24-
async getDescription() {
24+
override async getDescription() {
2525
const {branchName} = this._getActivePrereleaseTrain();
2626
const newVersion = await this._newVersion;
2727
return `Cut a new next pre-release for the "${branchName}" branch (v${newVersion}).`;
2828
}
2929

30-
async perform() {
30+
override async perform() {
3131
const releaseTrain = this._getActivePrereleaseTrain();
3232
const {branchName} = releaseTrain;
3333
const newVersion = await this._newVersion;

dev-infra/release/publish/actions/cut-release-candidate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import {ReleaseAction} from '../actions';
1717
export class CutReleaseCandidateAction extends ReleaseAction {
1818
private _newVersion = semverInc(this.active.releaseCandidate!.version, 'prerelease', 'rc');
1919

20-
async getDescription() {
20+
override async getDescription() {
2121
const newVersion = this._newVersion;
2222
return `Cut a first release-candidate for the feature-freeze branch (v${newVersion}).`;
2323
}
2424

25-
async perform() {
25+
override async perform() {
2626
const {branchName} = this.active.releaseCandidate!;
2727
const newVersion = this._newVersion;
2828

dev-infra/release/publish/actions/cut-stable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import {invokeSetNpmDistCommand, invokeYarnInstallCommand} from '../external-com
2020
export class CutStableAction extends ReleaseAction {
2121
private _newVersion = this._computeNewVersion();
2222

23-
async getDescription() {
23+
override async getDescription() {
2424
const newVersion = this._newVersion;
2525
return `Cut a stable release for the release-candidate branch (v${newVersion}).`;
2626
}
2727

28-
async perform() {
28+
override async perform() {
2929
const {branchName} = this.active.releaseCandidate!;
3030
const newVersion = this._newVersion;
3131
const isNewMajor = this.active.releaseCandidate?.isMajor;

dev-infra/release/publish/actions/move-next-into-feature-freeze.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import {changelogPath, packageJsonPath} from '../constants';
2424
export class MoveNextIntoFeatureFreezeAction extends ReleaseAction {
2525
private _newVersion = computeNewPrereleaseVersionForNext(this.active, this.config);
2626

27-
async getDescription() {
27+
override async getDescription() {
2828
const {branchName} = this.active.next;
2929
const newVersion = await this._newVersion;
3030
return `Move the "${branchName}" branch into feature-freeze phase (v${newVersion}).`;
3131
}
3232

33-
async perform() {
33+
override async perform() {
3434
const newVersion = await this._newVersion;
3535
const newBranch = `${newVersion.major}.${newVersion.minor}.x`;
3636

dev-infra/release/publish/actions/tag-recent-major-as-latest.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import {invokeSetNpmDistCommand, invokeYarnInstallCommand} from '../external-com
2525
* @see {CutStableAction#perform} for more details.
2626
*/
2727
export class TagRecentMajorAsLatest extends ReleaseAction {
28-
async getDescription() {
28+
override async getDescription() {
2929
return `Tag recently published major v${this.active.latest.version} as "next" in NPM.`;
3030
}
3131

32-
async perform() {
32+
override async perform() {
3333
await this.checkoutUpstreamBranch(this.active.latest.branchName);
3434
await invokeYarnInstallCommand(this.projectDir);
3535
await invokeSetNpmDistCommand('latest', this.active.latest.version);

dev-infra/release/publish/test/common.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ describe('common release action logic', () => {
143143
* release action class. This allows us to add unit tests.
144144
*/
145145
class TestAction extends ReleaseAction {
146-
async getDescription() {
146+
override async getDescription() {
147147
return 'Test action';
148148
}
149149

150-
async perform() {
150+
override async perform() {
151151
throw Error('Not implemented.');
152152
}
153153

packages/animations/browser/src/dsl/style_normalization/web_animations_style_normalizer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {dashCaseToCamelCase} from '../../util';
1010
import {AnimationStyleNormalizer} from './animation_style_normalizer';
1111

1212
export class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {
13-
normalizePropertyName(propertyName: string, errors: string[]): string {
13+
override normalizePropertyName(propertyName: string, errors: string[]): string {
1414
return dashCaseToCamelCase(propertyName);
1515
}
1616

17-
normalizeStyleValue(
17+
override normalizeStyleValue(
1818
userProvidedProperty: string, normalizedProperty: string, value: string|number,
1919
errors: string[]): string {
2020
let unit: string = '';

packages/animations/browser/test/render/timeline_animation_engine_spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ class SuffixNormalizer extends AnimationStyleNormalizer {
110110
super();
111111
}
112112

113-
normalizePropertyName(propertyName: string, errors: string[]): string {
113+
override normalizePropertyName(propertyName: string, errors: string[]): string {
114114
return propertyName + this._suffix;
115115
}
116116

117-
normalizeStyleValue(
117+
override normalizeStyleValue(
118118
userProvidedProperty: string, normalizedProperty: string, value: string|number,
119119
errors: string[]): string {
120120
return value + this._suffix;

packages/animations/browser/test/render/transition_animation_engine_spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,11 @@ class SuffixNormalizer extends AnimationStyleNormalizer {
693693
super();
694694
}
695695

696-
normalizePropertyName(propertyName: string, errors: string[]): string {
696+
override normalizePropertyName(propertyName: string, errors: string[]): string {
697697
return propertyName + this._suffix;
698698
}
699699

700-
normalizeStyleValue(
700+
override normalizeStyleValue(
701701
userProvidedProperty: string, normalizedProperty: string, value: string|number,
702702
errors: string[]): string {
703703
return value + this._suffix;
@@ -709,14 +709,14 @@ class ExactCssValueNormalizer extends AnimationStyleNormalizer {
709709
super();
710710
}
711711

712-
normalizePropertyName(propertyName: string, errors: string[]): string {
712+
override normalizePropertyName(propertyName: string, errors: string[]): string {
713713
if (!this._allowedValues[propertyName]) {
714714
errors.push(`The CSS property \`${propertyName}\` is not allowed`);
715715
}
716716
return propertyName;
717717
}
718718

719-
normalizeStyleValue(
719+
override normalizeStyleValue(
720720
userProvidedProperty: string, normalizedProperty: string, value: string|number,
721721
errors: string[]): string {
722722
const expectedValue = this._allowedValues[userProvidedProperty];

packages/common/http/test/xsrf_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SampleTokenExtractor extends HttpXsrfTokenExtractor {
1717
super();
1818
}
1919

20-
getToken(): string|null {
20+
override getToken(): string|null {
2121
return this.token;
2222
}
2323
}

packages/common/src/i18n/localization.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class NgLocaleLocalization extends NgLocalization {
5656
super();
5757
}
5858

59-
getPluralCategory(value: any, locale?: string): string {
59+
override getPluralCategory(value: any, locale?: string): string {
6060
const plural = getLocalePluralCase(locale || this.locale)(value);
6161

6262
switch (plural) {

0 commit comments

Comments
 (0)