From de68202971aa5a1ce7e36d3e2c2fc26c6cdc4314 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 13 Jun 2017 20:48:02 +0200 Subject: [PATCH] build: enable noUnusedParameters check (#5091) --- src/cdk/tsconfig-build.json | 1 + src/demo-app/tsconfig-aot.json | 2 ++ src/demo-app/tsconfig-build.json | 1 + src/e2e-app/tsconfig-build.json | 2 ++ src/lib/expansion/expansion-panel-header.ts | 2 +- src/lib/tsconfig-build.json | 1 + src/material-examples/tsconfig-build.json | 1 + src/universal-app/tsconfig-build.json | 1 + src/universal-app/tsconfig-prerender.json | 2 ++ tools/gulp/packaging/inline-resources.ts | 4 ++-- tools/gulp/tasks/docs.ts | 4 ++-- tools/gulp/tsconfig.json | 1 + tools/gulp/util/firebase.ts | 2 +- 13 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cdk/tsconfig-build.json b/src/cdk/tsconfig-build.json index 6f9147eba18..9df97ab71c9 100644 --- a/src/cdk/tsconfig-build.json +++ b/src/cdk/tsconfig-build.json @@ -6,6 +6,7 @@ "declaration": true, "stripInternal": false, "experimentalDecorators": true, + "noUnusedParameters": true, "importHelpers": true, "module": "es2015", "moduleResolution": "node", diff --git a/src/demo-app/tsconfig-aot.json b/src/demo-app/tsconfig-aot.json index f330871ca94..04d80a85fcf 100644 --- a/src/demo-app/tsconfig-aot.json +++ b/src/demo-app/tsconfig-aot.json @@ -5,6 +5,8 @@ "extends": "./tsconfig-build", "compilerOptions": { "experimentalDecorators": true, + // TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT. + "noUnusedParameters": false, "outDir": ".", "paths": { "@angular/material": ["./material"], diff --git a/src/demo-app/tsconfig-build.json b/src/demo-app/tsconfig-build.json index 1a4ad4a77af..ec4e43d4d61 100644 --- a/src/demo-app/tsconfig-build.json +++ b/src/demo-app/tsconfig-build.json @@ -5,6 +5,7 @@ "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, + "noUnusedParameters": true, "lib": ["es6", "es2015", "dom"], "module": "commonjs", "moduleResolution": "node", diff --git a/src/e2e-app/tsconfig-build.json b/src/e2e-app/tsconfig-build.json index cdebc8aaead..9599e2d9463 100644 --- a/src/e2e-app/tsconfig-build.json +++ b/src/e2e-app/tsconfig-build.json @@ -5,6 +5,8 @@ "declaration": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, + // TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT. + "noUnusedParameters": false, "lib": ["es6", "es2015", "dom"], "module": "commonjs", "moduleResolution": "node", diff --git a/src/lib/expansion/expansion-panel-header.ts b/src/lib/expansion/expansion-panel-header.ts index f3f631cb103..1d1875f304e 100644 --- a/src/lib/expansion/expansion-panel-header.ts +++ b/src/lib/expansion/expansion-panel-header.ts @@ -56,7 +56,7 @@ export class MdExpansionPanelHeader { constructor(@Host() public panel: MdExpansionPanel) {} /** Toggles the expanded state of the panel. */ - _toggle(event?: KeyboardEvent): void { + _toggle(): void { this.panel.toggle(); } diff --git a/src/lib/tsconfig-build.json b/src/lib/tsconfig-build.json index 5efd7f75f47..020a9b3aee7 100644 --- a/src/lib/tsconfig-build.json +++ b/src/lib/tsconfig-build.json @@ -5,6 +5,7 @@ "declaration": true, "stripInternal": false, "experimentalDecorators": true, + "noUnusedParameters": true, "importHelpers": true, "module": "es2015", "moduleResolution": "node", diff --git a/src/material-examples/tsconfig-build.json b/src/material-examples/tsconfig-build.json index d330422d8a3..13b48491b7f 100644 --- a/src/material-examples/tsconfig-build.json +++ b/src/material-examples/tsconfig-build.json @@ -5,6 +5,7 @@ "declaration": true, "stripInternal": false, "experimentalDecorators": true, + "noUnusedParameters": true, "importHelpers": true, "module": "es2015", "moduleResolution": "node", diff --git a/src/universal-app/tsconfig-build.json b/src/universal-app/tsconfig-build.json index b6aebd3d4c0..ab3ee3e3313 100644 --- a/src/universal-app/tsconfig-build.json +++ b/src/universal-app/tsconfig-build.json @@ -5,6 +5,7 @@ "declaration": true, "stripInternal": false, "experimentalDecorators": true, + "noUnusedParameters": true, "module": "commonjs", "moduleResolution": "node", "outDir": ".", diff --git a/src/universal-app/tsconfig-prerender.json b/src/universal-app/tsconfig-prerender.json index 4dc36103d8c..1e3644fab85 100644 --- a/src/universal-app/tsconfig-prerender.json +++ b/src/universal-app/tsconfig-prerender.json @@ -4,6 +4,8 @@ "declaration": false, "stripInternal": false, "experimentalDecorators": true, + // TODO(paul): Remove once Angular has been upgraded and supports noUnusedParameters in AOT. + "noUnusedParameters": false, "module": "commonjs", "moduleResolution": "node", "outDir": ".", diff --git a/tools/gulp/packaging/inline-resources.ts b/tools/gulp/packaging/inline-resources.ts index 6516e5b9b86..bd40d6f5048 100644 --- a/tools/gulp/packaging/inline-resources.ts +++ b/tools/gulp/packaging/inline-resources.ts @@ -22,7 +22,7 @@ export function inlineResources(filePath: string) { /** Inlines the templates of Angular components for a specified source file. */ function inlineTemplate(fileContent: string, filePath: string) { - return fileContent.replace(/templateUrl:\s*'([^']+?\.html)'/g, (match, templateUrl) => { + return fileContent.replace(/templateUrl:\s*'([^']+?\.html)'/g, (_match, templateUrl) => { const templatePath = join(dirname(filePath), templateUrl); const templateContent = loadResourceFile(templatePath); return `template: "${templateContent}"`; @@ -31,7 +31,7 @@ function inlineTemplate(fileContent: string, filePath: string) { /** Inlines the external styles of Angular components for a specified source file. */ function inlineStyles(fileContent: string, filePath: string) { - return fileContent.replace(/styleUrls:\s*(\[[\s\S]*?])/gm, (match, styleUrlsValue) => { + return fileContent.replace(/styleUrls:\s*(\[[\s\S]*?])/gm, (_match, styleUrlsValue) => { // The RegExp matches the array of external style files. This is a string right now and // can to be parsed using the `eval` method. The value looks like "['AAA.css', 'BBB.css']" const styleUrls = eval(styleUrlsValue) as string[]; diff --git a/tools/gulp/tasks/docs.ts b/tools/gulp/tasks/docs.ts index 461a9c82b64..ed38895c56e 100644 --- a/tools/gulp/tasks/docs.ts +++ b/tools/gulp/tasks/docs.ts @@ -130,12 +130,12 @@ function transformMarkdownFiles(buffer: Buffer, file: any): string { let content = buffer.toString('utf-8'); // Replace comments with HTML elements. - content = content.replace(EXAMPLE_PATTERN, (match: string, name: string) => + content = content.replace(EXAMPLE_PATTERN, (_match: string, name: string) => `
` ); // Replace the URL in anchor elements inside of compiled markdown files. - content = content.replace(LINK_PATTERN, (match: string, head: string, link: string) => + content = content.replace(LINK_PATTERN, (_match: string, head: string, link: string) => // The head is the first match of the RegExp and is necessary to ensure that the RegExp matches // an anchor element. The head will be then used to re-create the existing anchor element. // If the head is not prepended to the replaced value, then the first match will be lost. diff --git a/tools/gulp/tsconfig.json b/tools/gulp/tsconfig.json index 0c5cc81d470..d1d21079a03 100644 --- a/tools/gulp/tsconfig.json +++ b/tools/gulp/tsconfig.json @@ -3,6 +3,7 @@ { "compilerOptions": { "experimentalDecorators": true, + "noUnusedParameters": true, "lib": ["es2015", "dom"], "module": "commonjs", "moduleResolution": "node", diff --git a/tools/gulp/util/firebase.ts b/tools/gulp/util/firebase.ts index d185ab978b5..3675aee4ad1 100644 --- a/tools/gulp/util/firebase.ts +++ b/tools/gulp/util/firebase.ts @@ -9,7 +9,7 @@ const screenshotFirebaseConfig = require('../../screenshot-test/functions/config const dashboardDatabaseUrl = 'https://material2-board.firebaseio.com'; /** Opens a connection to the Firebase dashboard app using a service account. */ -export function openFirebaseDashboardApp(asGuest = false) { +export function openFirebaseDashboardApp() { // Initialize the Firebase application with firebaseAdmin credentials. // Credentials need to be for a Service Account, which can be created in the Firebase console. return firebaseAdmin.initializeApp({