Skip to content

Commit cc32405

Browse files
committed
build: enable noUnusedParameters check
* This enables the "noUnusedParameters" TypeScript option in all tsconfig files. This ensures that every package that will be published can be used together with "noUnusedParameters". * Added the "noUnusedParameters" option in unrelated tsconfig files as well (gulp tsconfig). This also helps avoiding unused / unnecessary code. * Skipped setting "noUnusedParameters" for the e2e and prerender project because those are served in AOT mode and the current Angular version of the project does not support "noUnusedParameters" yet.
1 parent c2816ef commit cc32405

File tree

13 files changed

+18
-6
lines changed

13 files changed

+18
-6
lines changed

src/cdk/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"declaration": true,
77
"stripInternal": false,
88
"experimentalDecorators": true,
9+
"noUnusedParameters": true,
910
"importHelpers": true,
1011
"module": "es2015",
1112
"moduleResolution": "node",

src/demo-app/tsconfig-aot.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"extends": "./tsconfig-build",
66
"compilerOptions": {
77
"experimentalDecorators": true,
8+
// TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT.
9+
"noUnusedParameters": false,
810
"outDir": ".",
911
"paths": {
1012
"@angular/material": ["./material"],

src/demo-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"declaration": false,
66
"emitDecoratorMetadata": true,
77
"experimentalDecorators": true,
8+
"noUnusedParameters": true,
89
"lib": ["es6", "es2015", "dom"],
910
"module": "commonjs",
1011
"moduleResolution": "node",

src/e2e-app/tsconfig-build.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"declaration": true,
66
"emitDecoratorMetadata": true,
77
"experimentalDecorators": true,
8+
// TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT.
9+
"noUnusedParameters": false,
810
"lib": ["es6", "es2015", "dom"],
911
"module": "commonjs",
1012
"moduleResolution": "node",

src/lib/expansion/expansion-panel-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class MdExpansionPanelHeader {
5656
constructor(@Host() public panel: MdExpansionPanel) {}
5757

5858
/** Toggles the expanded state of the panel. */
59-
_toggle(event?: KeyboardEvent): void {
59+
_toggle(): void {
6060
this.panel.toggle();
6161
}
6262

src/lib/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"declaration": true,
66
"stripInternal": false,
77
"experimentalDecorators": true,
8+
"noUnusedParameters": true,
89
"importHelpers": true,
910
"module": "es2015",
1011
"moduleResolution": "node",

src/material-examples/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"declaration": true,
66
"stripInternal": false,
77
"experimentalDecorators": true,
8+
"noUnusedParameters": true,
89
"importHelpers": true,
910
"module": "es2015",
1011
"moduleResolution": "node",

src/universal-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"declaration": true,
66
"stripInternal": false,
77
"experimentalDecorators": true,
8+
"noUnusedParameters": true,
89
"module": "commonjs",
910
"moduleResolution": "node",
1011
"outDir": ".",

src/universal-app/tsconfig-prerender.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"declaration": false,
55
"stripInternal": false,
66
"experimentalDecorators": true,
7+
// TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT.
8+
"noUnusedParameters": false,
79
"module": "commonjs",
810
"moduleResolution": "node",
911
"outDir": ".",

tools/gulp/packaging/inline-resources.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function inlineResources(filePath: string) {
2222

2323
/** Inlines the templates of Angular components for a specified source file. */
2424
function inlineTemplate(fileContent: string, filePath: string) {
25-
return fileContent.replace(/templateUrl:\s*'([^']+?\.html)'/g, (match, templateUrl) => {
25+
return fileContent.replace(/templateUrl:\s*'([^']+?\.html)'/g, (_match, templateUrl) => {
2626
const templatePath = join(dirname(filePath), templateUrl);
2727
const templateContent = loadResourceFile(templatePath);
2828
return `template: "${templateContent}"`;
@@ -31,7 +31,7 @@ function inlineTemplate(fileContent: string, filePath: string) {
3131

3232
/** Inlines the external styles of Angular components for a specified source file. */
3333
function inlineStyles(fileContent: string, filePath: string) {
34-
return fileContent.replace(/styleUrls:\s*(\[[\s\S]*?])/gm, (match, styleUrlsValue) => {
34+
return fileContent.replace(/styleUrls:\s*(\[[\s\S]*?])/gm, (_match, styleUrlsValue) => {
3535
// The RegExp matches the array of external style files. This is a string right now and
3636
// can to be parsed using the `eval` method. The value looks like "['AAA.css', 'BBB.css']"
3737
const styleUrls = eval(styleUrlsValue) as string[];

tools/gulp/tasks/docs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ function transformMarkdownFiles(buffer: Buffer, file: any): string {
130130
let content = buffer.toString('utf-8');
131131

132132
// Replace <!-- example(..) --> comments with HTML elements.
133-
content = content.replace(EXAMPLE_PATTERN, (match: string, name: string) =>
133+
content = content.replace(EXAMPLE_PATTERN, (_match: string, name: string) =>
134134
`<div material-docs-example="${name}"></div>`
135135
);
136136

137137
// Replace the URL in anchor elements inside of compiled markdown files.
138-
content = content.replace(LINK_PATTERN, (match: string, head: string, link: string) =>
138+
content = content.replace(LINK_PATTERN, (_match: string, head: string, link: string) =>
139139
// The head is the first match of the RegExp and is necessary to ensure that the RegExp matches
140140
// an anchor element. The head will be then used to re-create the existing anchor element.
141141
// If the head is not prepended to the replaced value, then the first match will be lost.

tools/gulp/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"compilerOptions": {
55
"experimentalDecorators": true,
6+
"noUnusedParameters": true,
67
"lib": ["es2015", "dom"],
78
"module": "commonjs",
89
"moduleResolution": "node",

tools/gulp/util/firebase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const screenshotFirebaseConfig = require('../../screenshot-test/functions/config
99
const dashboardDatabaseUrl = 'https://material2-board.firebaseio.com';
1010

1111
/** Opens a connection to the Firebase dashboard app using a service account. */
12-
export function openFirebaseDashboardApp(asGuest = false) {
12+
export function openFirebaseDashboardApp() {
1313
// Initialize the Firebase application with firebaseAdmin credentials.
1414
// Credentials need to be for a Service Account, which can be created in the Firebase console.
1515
return firebaseAdmin.initializeApp({

0 commit comments

Comments
 (0)