Skip to content

Commit f305f22

Browse files
JeanMecheatscott
authored andcommitted
refactor(common): add missing override to satisfy the linter (#49599)
Linter was complaining of missing `override` despite being OK on the CI. this commits add them. PR Close #49599
1 parent 23f4619 commit f305f22

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

packages/common/test/directives/ng_plural_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
162162

163163
@Injectable()
164164
class TestLocalization extends NgLocalization {
165-
getPluralCategory(value: number): string {
165+
override getPluralCategory(value: number): string {
166166
if (value > 1 && value < 4) {
167167
return 'few';
168168
}

packages/common/test/pipes/i18n_plural_pipe_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ import {TestBed} from '@angular/core/testing';
8585
}
8686

8787
class TestLocalization extends NgLocalization {
88-
getPluralCategory(value: number): string {
88+
override getPluralCategory(value: number): string {
8989
return value > 1 && value < 6 ? 'many' : 'other';
9090
}
9191
}

packages/common/testing/src/mock_location_strategy.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ export class MockLocationStrategy extends LocationStrategy {
3535
this._subject.emit(new _MockPopStateEvent(this.path()));
3636
}
3737

38-
path(includeHash: boolean = false): string {
38+
override path(includeHash: boolean = false): string {
3939
return this.internalPath;
4040
}
4141

42-
prepareExternalUrl(internal: string): string {
42+
override prepareExternalUrl(internal: string): string {
4343
if (internal.startsWith('/') && this.internalBaseHref.endsWith('/')) {
4444
return this.internalBaseHref + internal.substring(1);
4545
}
4646
return this.internalBaseHref + internal;
4747
}
4848

49-
pushState(ctx: any, title: string, path: string, query: string): void {
49+
override pushState(ctx: any, title: string, path: string, query: string): void {
5050
// Add state change to changes array
5151
this.stateChanges.push(ctx);
5252

@@ -59,7 +59,7 @@ export class MockLocationStrategy extends LocationStrategy {
5959
this.urlChanges.push(externalUrl);
6060
}
6161

62-
replaceState(ctx: any, title: string, path: string, query: string): void {
62+
override replaceState(ctx: any, title: string, path: string, query: string): void {
6363
// Reset the last index of stateChanges to the ctx (state) object
6464
this.stateChanges[(this.stateChanges.length || 1) - 1] = ctx;
6565

@@ -72,15 +72,15 @@ export class MockLocationStrategy extends LocationStrategy {
7272
this.urlChanges.push('replace: ' + externalUrl);
7373
}
7474

75-
onPopState(fn: (value: any) => void): void {
75+
override onPopState(fn: (value: any) => void): void {
7676
this._subject.subscribe({next: fn});
7777
}
7878

79-
getBaseHref(): string {
79+
override getBaseHref(): string {
8080
return this.internalBaseHref;
8181
}
8282

83-
back(): void {
83+
override back(): void {
8484
if (this.urlChanges.length > 0) {
8585
this.urlChanges.pop();
8686
this.stateChanges.pop();
@@ -89,11 +89,11 @@ export class MockLocationStrategy extends LocationStrategy {
8989
}
9090
}
9191

92-
forward(): void {
92+
override forward(): void {
9393
throw 'not implemented';
9494
}
9595

96-
getState(): unknown {
96+
override getState(): unknown {
9797
return this.stateChanges[(this.stateChanges.length || 1) - 1];
9898
}
9999
}

packages/compiler/test/i18n/integration_common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class I18nComponent {
3131

3232
export class FrLocalization extends NgLocalization {
3333
public static PROVIDE = {provide: NgLocalization, useClass: FrLocalization, deps: []};
34-
getPluralCategory(value: number): string {
34+
override getPluralCategory(value: number): string {
3535
switch (value) {
3636
case 0:
3737
case 1:

packages/platform-browser/animations/src/animation_builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class BrowserAnimationBuilder extends AnimationBuilder {
2424
this._renderer = rootRenderer.createRenderer(doc.body, typeData) as AnimationRenderer;
2525
}
2626

27-
build(animation: AnimationMetadata|AnimationMetadata[]): AnimationFactory {
27+
override build(animation: AnimationMetadata|AnimationMetadata[]): AnimationFactory {
2828
const id = this._nextAnimationId.toString();
2929
this._nextAnimationId++;
3030
const entry = Array.isArray(animation) ? sequence(animation) : animation;
@@ -38,7 +38,7 @@ export class BrowserAnimationFactory extends AnimationFactory {
3838
super();
3939
}
4040

41-
create(element: any, options?: AnimationOptions): AnimationPlayer {
41+
override create(element: any, options?: AnimationOptions): AnimationPlayer {
4242
return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
4343
}
4444
}

packages/platform-browser/src/browser/browser_adapter.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,43 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
2222
setRootDomAdapter(new BrowserDomAdapter());
2323
}
2424

25-
onAndCancel(el: Node, evt: any, listener: any): Function {
25+
override onAndCancel(el: Node, evt: any, listener: any): Function {
2626
el.addEventListener(evt, listener, false);
2727
// Needed to follow Dart's subscription semantic, until fix of
2828
// https://code.google.com/p/dart/issues/detail?id=17406
2929
return () => {
3030
el.removeEventListener(evt, listener, false);
3131
};
3232
}
33-
dispatchEvent(el: Node, evt: any) {
33+
override dispatchEvent(el: Node, evt: any) {
3434
el.dispatchEvent(evt);
3535
}
36-
remove(node: Node): void {
36+
override remove(node: Node): void {
3737
if (node.parentNode) {
3838
node.parentNode.removeChild(node);
3939
}
4040
}
41-
createElement(tagName: string, doc?: Document): HTMLElement {
41+
override createElement(tagName: string, doc?: Document): HTMLElement {
4242
doc = doc || this.getDefaultDocument();
4343
return doc.createElement(tagName);
4444
}
45-
createHtmlDocument(): Document {
45+
override createHtmlDocument(): Document {
4646
return document.implementation.createHTMLDocument('fakeTitle');
4747
}
48-
getDefaultDocument(): Document {
48+
override getDefaultDocument(): Document {
4949
return document;
5050
}
5151

52-
isElementNode(node: Node): boolean {
52+
override isElementNode(node: Node): boolean {
5353
return node.nodeType === Node.ELEMENT_NODE;
5454
}
5555

56-
isShadowRoot(node: any): boolean {
56+
override isShadowRoot(node: any): boolean {
5757
return node instanceof DocumentFragment;
5858
}
5959

6060
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
61-
getGlobalEventTarget(doc: Document, target: string): EventTarget|null {
61+
override getGlobalEventTarget(doc: Document, target: string): EventTarget|null {
6262
if (target === 'window') {
6363
return window;
6464
}
@@ -70,17 +70,17 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
7070
}
7171
return null;
7272
}
73-
getBaseHref(doc: Document): string|null {
73+
override getBaseHref(doc: Document): string|null {
7474
const href = getBaseElementHref();
7575
return href == null ? null : relativePath(href);
7676
}
77-
resetBaseElement(): void {
77+
override resetBaseElement(): void {
7878
baseElement = null;
7979
}
80-
getUserAgent(): string {
80+
override getUserAgent(): string {
8181
return window.navigator.userAgent;
8282
}
83-
getCookie(name: string): string|null {
83+
override getCookie(name: string): string|null {
8484
return parseCookieValue(document.cookie, name);
8585
}
8686
}

packages/platform-browser/src/browser/generic_browser_adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import {ɵDomAdapter as DomAdapter} from '@angular/common';
1717
* can introduce XSS risks.
1818
*/
1919
export abstract class GenericBrowserDomAdapter extends DomAdapter {
20-
readonly supportsDOMEvents: boolean = true;
20+
override readonly supportsDOMEvents: boolean = true;
2121
}

0 commit comments

Comments
 (0)