From 52f45af7f092ee25045c0a0a2aa33beb5f136ce8 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 6 Nov 2017 20:50:36 -0800 Subject: [PATCH] Add additional no unused checks for php extension --- extensions/php/src/features/completionItemProvider.ts | 2 +- extensions/php/src/features/hoverProvider.ts | 8 +++++--- extensions/php/src/features/signatureHelpProvider.ts | 2 +- extensions/php/src/features/utils/async.ts | 4 ++-- extensions/php/src/features/validationProvider.ts | 2 +- extensions/php/tsconfig.json | 4 ++++ 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/extensions/php/src/features/completionItemProvider.ts b/extensions/php/src/features/completionItemProvider.ts index 3d918dc4cf5..05a0f9f29bc 100644 --- a/extensions/php/src/features/completionItemProvider.ts +++ b/extensions/php/src/features/completionItemProvider.ts @@ -12,7 +12,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider public triggerCharacters = ['.', ':', '$']; - public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise { + public provideCompletionItems(document: TextDocument, position: Position, _token: CancellationToken): Promise { let result: CompletionItem[] = []; let shouldProvideCompletionItems = workspace.getConfiguration('php').get('suggest.basic', true); diff --git a/extensions/php/src/features/hoverProvider.ts b/extensions/php/src/features/hoverProvider.ts index 2e0a137ec0a..f40d210b133 100644 --- a/extensions/php/src/features/hoverProvider.ts +++ b/extensions/php/src/features/hoverProvider.ts @@ -11,15 +11,15 @@ import { textToMarkedString } from './utils/markedTextUtil'; export default class PHPHoverProvider implements HoverProvider { - public provideHover(document: TextDocument, position: Position, token: CancellationToken): Hover | undefined { + public provideHover(document: TextDocument, position: Position, _token: CancellationToken): Hover | undefined { let enable = workspace.getConfiguration('php').get('suggest.basic', true); if (!enable) { - return; + return undefined; } let wordRange = document.getWordRangeAtPosition(position); if (!wordRange) { - return; + return undefined; } let name = document.getText(wordRange); @@ -30,5 +30,7 @@ export default class PHPHoverProvider implements HoverProvider { let contents: MarkedString[] = [textToMarkedString(entry.description), { language: 'php', value: signature }]; return new Hover(contents, wordRange); } + + return undefined; } } diff --git a/extensions/php/src/features/signatureHelpProvider.ts b/extensions/php/src/features/signatureHelpProvider.ts index 42c14b8066a..b3f6c12a306 100644 --- a/extensions/php/src/features/signatureHelpProvider.ts +++ b/extensions/php/src/features/signatureHelpProvider.ts @@ -69,7 +69,7 @@ class BackwardIterator { export default class PHPSignatureHelpProvider implements SignatureHelpProvider { - public provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): Promise | null { + public provideSignatureHelp(document: TextDocument, position: Position, _token: CancellationToken): Promise | null { let enable = workspace.getConfiguration('php').get('suggest.basic', true); if (!enable) { return null; diff --git a/extensions/php/src/features/utils/async.ts b/extensions/php/src/features/utils/async.ts index 5093f7c3eba..78ba0aa582a 100644 --- a/extensions/php/src/features/utils/async.ts +++ b/extensions/php/src/features/utils/async.ts @@ -53,7 +53,7 @@ export class Throttler { return result; }; - this.queuedPromise = new Promise((resolve, reject) => { + this.queuedPromise = new Promise((resolve) => { this.activePromise!.then(onComplete, onComplete).then(resolve); }); } @@ -121,7 +121,7 @@ export class Delayer { this.cancelTimeout(); if (!this.completionPromise) { - this.completionPromise = new Promise((resolve, reject) => { + this.completionPromise = new Promise((resolve) => { this.onResolve = resolve; }).then(() => { this.completionPromise = null; diff --git a/extensions/php/src/features/validationProvider.ts b/extensions/php/src/features/validationProvider.ts index 0a26bbd5a9b..4f7f8cadbb7 100644 --- a/extensions/php/src/features/validationProvider.ts +++ b/extensions/php/src/features/validationProvider.ts @@ -224,7 +224,7 @@ export default class PHPValidationProvider { } private doValidate(textDocument: vscode.TextDocument): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let executable = this.executable || 'php'; let decoder = new LineDecoder(); let diagnostics: vscode.Diagnostic[] = []; diff --git a/extensions/php/tsconfig.json b/extensions/php/tsconfig.json index b16347a7524..7e9b0d127b4 100644 --- a/extensions/php/tsconfig.json +++ b/extensions/php/tsconfig.json @@ -6,6 +6,10 @@ ], "module": "commonjs", "outDir": "./out", + "noImplicitAny": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, "strict": true }, "include": [