Skip to content

Commit 9afe185

Browse files
committed
build: enable noImplicitOverride TypeScript option
The `noImplicitOverride` TypeScript option improves code quality by ensuring that properties from base classes are not accidentally overriden. Reference: https://www.typescriptlang.org/tsconfig#noImplicitOverride
1 parent 8be19da commit 9afe185

33 files changed

+102
-99
lines changed

packages/angular/cli/commands/add-impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import { Schema as AddCommandSchema } from './add';
3131
const npa = require('npm-package-arg');
3232

3333
export class AddCommand extends SchematicCommand<AddCommandSchema> {
34-
readonly allowPrivateSchematics = true;
34+
override readonly allowPrivateSchematics = true;
3535

36-
async initialize(options: AddCommandSchema & Arguments) {
36+
override async initialize(options: AddCommandSchema & Arguments) {
3737
if (options.registry) {
3838
return super.initialize({ ...options, packageRegistry: options.registry });
3939
} else {
@@ -235,7 +235,7 @@ export class AddCommand extends SchematicCommand<AddCommandSchema> {
235235
return this.executeSchematic(collectionName, options['--']);
236236
}
237237

238-
async reportAnalytics(
238+
override async reportAnalytics(
239239
paths: string[],
240240
options: AddCommandSchema & Arguments,
241241
dimensions: (boolean | number | string)[] = [],

packages/angular/cli/commands/build-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { Arguments } from '../models/interface';
1111
import { Schema as BuildCommandSchema } from './build';
1212

1313
export class BuildCommand extends ArchitectCommand<BuildCommandSchema> {
14-
public readonly target = 'build';
14+
public override readonly target = 'build';
1515

16-
public async run(options: ArchitectCommandOptions & Arguments) {
16+
public override async run(options: ArchitectCommandOptions & Arguments) {
1717
return this.runArchitectTarget(options);
1818
}
1919
}

packages/angular/cli/commands/deploy-impl.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ Find more packages on npm https://www.npmjs.com/search?q=ng%20deploy
2525
`;
2626

2727
export class DeployCommand extends ArchitectCommand<DeployCommandSchema> {
28-
public readonly target = 'deploy';
29-
public readonly missingTargetError = BuilderMissing;
28+
public override readonly target = 'deploy';
29+
public override readonly missingTargetError = BuilderMissing;
3030

31-
public async initialize(options: DeployCommandSchema & Arguments): Promise<number | void> {
31+
public override async initialize(
32+
options: DeployCommandSchema & Arguments,
33+
): Promise<number | void> {
3234
if (!options.help) {
3335
return super.initialize(options);
3436
}

packages/angular/cli/commands/e2e-impl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { Arguments } from '../models/interface';
1111
import { Schema as E2eCommandSchema } from './e2e';
1212

1313
export class E2eCommand extends ArchitectCommand<E2eCommandSchema> {
14-
public readonly target = 'e2e';
15-
public readonly multiTarget = true;
16-
public readonly missingTargetError = `
14+
public override readonly target = 'e2e';
15+
public override readonly multiTarget = true;
16+
public override readonly missingTargetError = `
1717
Cannot find "e2e" target for the specified project.
1818
1919
You should add a package that implements end-to-end testing capabilities.
@@ -26,7 +26,7 @@ For example:
2626
More options will be added to the list as they become available.
2727
`;
2828

29-
async initialize(options: E2eCommandSchema & Arguments) {
29+
override async initialize(options: E2eCommandSchema & Arguments) {
3030
if (!options.help) {
3131
return super.initialize(options);
3232
}

packages/angular/cli/commands/extract-i18n-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { Arguments } from '../models/interface';
1111
import { Schema as ExtractI18nCommandSchema } from './extract-i18n';
1212

1313
export class ExtractI18nCommand extends ArchitectCommand<ExtractI18nCommandSchema> {
14-
public readonly target = 'extract-i18n';
14+
public override readonly target = 'extract-i18n';
1515

16-
public async run(options: ExtractI18nCommandSchema & Arguments) {
16+
public override async run(options: ExtractI18nCommandSchema & Arguments) {
1717
const version = process.version.substr(1).split('.');
1818
if (Number(version[0]) === 12 && Number(version[1]) === 0) {
1919
this.logger.error(

packages/angular/cli/commands/generate-impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {
1616
// Allows us to resolve aliases before reporting analytics
1717
longSchematicName: string | undefined;
1818

19-
async initialize(options: GenerateCommandSchema & Arguments) {
19+
override async initialize(options: GenerateCommandSchema & Arguments) {
2020
// Fill up the schematics property of the command description.
2121
const [collectionName, schematicName] = await this.parseSchematicInfo(options);
2222
this.collectionName = collectionName;
@@ -75,7 +75,7 @@ export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {
7575
});
7676
}
7777

78-
async reportAnalytics(
78+
override async reportAnalytics(
7979
paths: string[],
8080
options: GenerateCommandSchema & Arguments,
8181
): Promise<void> {
@@ -104,7 +104,7 @@ export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {
104104
return [collectionName, schematicName];
105105
}
106106

107-
public async printHelp() {
107+
public override async printHelp() {
108108
await super.printHelp();
109109

110110
this.logger.info('');

packages/angular/cli/commands/lint-impl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ For example:
2020
`;
2121

2222
export class LintCommand extends ArchitectCommand<LintCommandSchema> {
23-
readonly target = 'lint';
24-
readonly multiTarget = true;
25-
readonly missingTargetError = MissingBuilder;
23+
override readonly target = 'lint';
24+
override readonly multiTarget = true;
25+
override readonly missingTargetError = MissingBuilder;
2626

27-
async initialize(options: LintCommandSchema & Arguments): Promise<number | void> {
27+
override async initialize(options: LintCommandSchema & Arguments): Promise<number | void> {
2828
if (!options.help) {
2929
return super.initialize(options);
3030
}

packages/angular/cli/commands/new-impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import { VERSION } from '../models/version';
1212
import { Schema as NewCommandSchema } from './new';
1313

1414
export class NewCommand extends SchematicCommand<NewCommandSchema> {
15-
public readonly allowMissingWorkspace = true;
16-
schematicName = 'ng-new';
15+
public override readonly allowMissingWorkspace = true;
16+
override schematicName = 'ng-new';
1717

18-
async initialize(options: NewCommandSchema & Arguments) {
18+
override async initialize(options: NewCommandSchema & Arguments) {
1919
this.collectionName = options.collection || (await this.getDefaultSchematicCollection());
2020

2121
return super.initialize(options);

packages/angular/cli/commands/run-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Arguments } from '../models/interface';
1111
import { Schema as RunCommandSchema } from './run';
1212

1313
export class RunCommand extends ArchitectCommand<RunCommandSchema> {
14-
public async run(options: ArchitectCommandOptions & Arguments) {
14+
public override async run(options: ArchitectCommandOptions & Arguments) {
1515
if (options.target) {
1616
return this.runArchitectTarget(options);
1717
} else {

packages/angular/cli/commands/serve-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import { Arguments } from '../models/interface';
1111
import { Schema as ServeCommandSchema } from './serve';
1212

1313
export class ServeCommand extends ArchitectCommand<ServeCommandSchema> {
14-
public readonly target = 'serve';
14+
public override readonly target = 'serve';
1515

1616
public validate() {
1717
return true;
1818
}
1919

20-
public async run(options: ArchitectCommandOptions & Arguments) {
20+
public override async run(options: ArchitectCommandOptions & Arguments) {
2121
return this.runArchitectTarget(options);
2222
}
2323
}

0 commit comments

Comments
 (0)