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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)