Skip to content

Commit f45b94f

Browse files
cyrilletuziKeen Yee Liau
authored and
Keen Yee Liau
committed
fix(@schematics/angular): add compliance with no-any lint rule
1 parent 4bde461 commit f45b94f

File tree

11 files changed

+48
-18
lines changed

11 files changed

+48
-18
lines changed

packages/schematics/angular/application/files/src/test.ts.template

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import {
77
platformBrowserDynamicTesting
88
} from '@angular/platform-browser-dynamic/testing';
99

10-
declare const require: any;
10+
declare const require: {
11+
context(path: string, deep?: boolean, filter?: RegExp): {
12+
keys(): string[];
13+
<T>(id: string): T;
14+
};
15+
};
1116

1217
// First, initialize the Angular testing environment.
1318
getTestBed().initTestEnvironment(

packages/schematics/angular/e2e/files/src/app.po.ts.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { browser, by, element } from 'protractor';
22

33
export class AppPage {
4-
navigateTo(): Promise<any> {
5-
return browser.get(browser.baseUrl) as Promise<any>;
4+
navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl) as Promise<unknown>;
66
}
77

88
getTitleText(): Promise<string> {

packages/schematics/angular/library/files/src/test.ts.template

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import {
88
platformBrowserDynamicTesting
99
} from '@angular/platform-browser-dynamic/testing';
1010

11-
declare const require: any;
11+
declare const require: {
12+
context(path: string, deep?: boolean, filter?: RegExp): {
13+
keys(): string[];
14+
<T>(id: string): T;
15+
};
16+
};
1217

1318
// First, initialize the Angular testing environment.
1419
getTestBed().initTestEnvironment(

packages/schematics/angular/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Pipe, PipeTransform } from '@angular/core';
55
})
66
export class <%= classify(name) %>Pipe implements PipeTransform {
77

8-
transform(value: any, ...args: any[]): any {
8+
transform(value: unknown, ...args: unknown[]): unknown {
99
return null;
1010
}
1111

packages/schematics/angular/pipe/index_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('Pipe Schematic', () => {
5757
expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo.pipe'/);
5858
expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooPipe\r?\n/m);
5959
const fileContent = tree.readContent('/projects/bar/src/app/foo.pipe.ts');
60-
expect(fileContent).toContain('transform(value: any, ...args: any[])');
60+
expect(fileContent).toContain('transform(value: unknown, ...args: unknown[])');
6161
});
6262

6363
it('should import into a specified module', async () => {

tests/angular_devkit/build_angular/hello-world-app-ve/e2e/app.po.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import { browser, by, element } from 'protractor';
99

1010
export class AppPage {
11-
navigateTo() {
12-
return browser.get(browser.baseUrl);
11+
navigateTo(): Promise<unknown> {
12+
return browser.get(browser.baseUrl) as Promise<unknown>;
1313
}
1414

15-
getTitleText() {
16-
return element(by.css('app-root h1')).getText();
15+
getTitleText(): Promise<string> {
16+
return element(by.css('app-root h1')).getText() as Promise<string>;
1717
}
1818
}

tests/angular_devkit/build_angular/hello-world-app-ve/src/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import {
1414
platformBrowserDynamicTesting
1515
} from '@angular/platform-browser-dynamic/testing';
1616

17-
declare const require: any;
17+
declare const require: {
18+
context(path: string, deep?: boolean, filter?: RegExp): {
19+
keys(): string[];
20+
<T>(id: string): T;
21+
};
22+
};
1823

1924
// First, initialize the Angular testing environment.
2025
getTestBed().initTestEnvironment(

tests/angular_devkit/build_angular/hello-world-app/e2e/app.po.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import { browser, by, element } from 'protractor';
99

1010
export class AppPage {
11-
navigateTo() {
12-
return browser.get(browser.baseUrl);
11+
navigateTo(): Promise<unknown> {
12+
return browser.get(browser.baseUrl) as Promise<unknown>;
1313
}
1414

15-
getTitleText() {
16-
return element(by.css('app-root h1')).getText();
15+
getTitleText(): Promise<string> {
16+
return element(by.css('app-root h1')).getText() as Promise<string>;
1717
}
1818
}

tests/angular_devkit/build_angular/hello-world-app/src/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import {
1414
platformBrowserDynamicTesting,
1515
} from '@angular/platform-browser-dynamic/testing';
1616

17-
declare const require: any;
17+
declare const require: {
18+
context(path: string, deep?: boolean, filter?: RegExp): {
19+
keys(): string[];
20+
<T>(id: string): T;
21+
};
22+
};
1823

1924
// First, initialize the Angular testing environment.
2025
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

tests/angular_devkit/build_ng_packagr/ng-packaged-ve/projects/lib/src/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import {
1515
platformBrowserDynamicTesting
1616
} from '@angular/platform-browser-dynamic/testing';
1717

18-
declare const require: any;
18+
declare const require: {
19+
context(path: string, deep?: boolean, filter?: RegExp): {
20+
keys(): string[];
21+
<T>(id: string): T;
22+
};
23+
};
1924

2025
// First, initialize the Angular testing environment.
2126
getTestBed().initTestEnvironment(

tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import {
1515
platformBrowserDynamicTesting
1616
} from '@angular/platform-browser-dynamic/testing';
1717

18-
declare const require: any;
18+
declare const require: {
19+
context(path: string, deep?: boolean, filter?: RegExp): {
20+
keys(): string[];
21+
<T>(id: string): T;
22+
};
23+
};
1924

2025
// First, initialize the Angular testing environment.
2126
getTestBed().initTestEnvironment(

0 commit comments

Comments
 (0)