Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable noImplicitAny and alwaysStrict in `tsconfig.json #2159

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as optionsSchemaGenerator from './src/tools/GenerateOptionsSchema';
import * as packageDependencyUpdater from './src/tools/UpdatePackageDependencies';

import tslint from 'gulp-tslint';
import { PlatformInformation } from './src/platform';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using these imports anywhere ?

import { PackageManager } from './src/packages';

require('./tasks/testTasks');
require('./tasks/onlinePackagingTasks');
Expand Down Expand Up @@ -39,13 +41,4 @@ gulp.task('tslint', () => {
summarizeFailureOutput: false,
emitError: false
}));
});

const lintReporter = (output, file, options) => {
//emits: src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’
let relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/');
output.forEach(e => {
let message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure;
console.log('[tslint] ' + message);
});
};
});
63 changes: 62 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@
"@types/chai-arrays": "1.0.2",
"@types/chai-as-promised": "^7.1.0",
"@types/chai-string": "^1.4.0",
"@types/del": "^3.0.1",
"@types/fs-extra": "^5.0.1",
"@types/gulp": "^3.8.36",
"@types/gulp-mocha": "0.0.32",
"@types/istanbul": "^0.4.30",
"@types/minimist": "^1.2.0",
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^2.2.48",
Expand Down
4 changes: 2 additions & 2 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class AssetGenerator {
this.initializeProjectData(workspaceInfo);
}

private initializeProjectData(workspaceInfo: protocol.WorkspaceInformationResponse) {
private initializeProjectData(workspaceInfo: protocol.WorkspaceInformationResponse): void {
// TODO: For now, assume the Debug configuration. Eventually, we'll need to revisit
// this when we allow selecting configurations.
const configurationName = 'Debug';
Expand Down Expand Up @@ -105,7 +105,7 @@ export class AssetGenerator {
}
}

return undefined;
return;
}

public hasWebServerDependency(): boolean {
Expand Down
1 change: 0 additions & 1 deletion src/coreclr-debug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import * as path from 'path';
import * as vscode from 'vscode';
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr-debug/debuggerEventsProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

// This contains the definition of messages that VsDbg-UI can send back to a listener which registers itself via the 'debuggerEventsPipeName'
// property on a launch or attach request.
//
Expand Down
1 change: 0 additions & 1 deletion src/coreclr-debug/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import * as path from 'path';
import * as fs from 'fs';
Expand Down
2 changes: 0 additions & 2 deletions src/features/abstractProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import { Disposable } from 'vscode';
import { OmniSharpServer } from '../omnisharp/server';

Expand Down
4 changes: 1 addition & 3 deletions src/features/changeForwarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import {Disposable, Uri, workspace} from 'vscode';
import {OmniSharpServer} from '../omnisharp/server';
import * as serverUtils from '../omnisharp/utils';
Expand Down Expand Up @@ -32,7 +30,7 @@ function forwardDocumentChanges(server: OmniSharpServer): Disposable {

function forwardFileChanges(server: OmniSharpServer): Disposable {

function onFileSystemEvent(changeType: FileChangeType): (Uri) => void {
function onFileSystemEvent(changeType: FileChangeType): (uri: Uri) => void {
return function(uri: Uri)
{
if (!server.isRunning()) {
Expand Down
2 changes: 0 additions & 2 deletions src/features/codeActionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import * as vscode from 'vscode';
import { OmniSharpServer } from '../omnisharp/server';
import AbstractProvider from './abstractProvider';
Expand Down
2 changes: 0 additions & 2 deletions src/features/codeLensProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
import * as vscode from 'vscode';
Expand Down
2 changes: 0 additions & 2 deletions src/features/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import { OmniSharpServer } from '../omnisharp/server';
import * as serverUtils from '../omnisharp/utils';
import { findLaunchTargets } from '../omnisharp/launcher';
Expand Down
2 changes: 0 additions & 2 deletions src/features/completionItemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import {extractSummaryText} from './documentation';
import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
Expand Down
5 changes: 2 additions & 3 deletions src/features/definitionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import * as serverUtils from '../omnisharp/utils';
import {CancellationToken, DefinitionProvider, Location, Position, TextDocument, Uri} from 'vscode';
import {GoToDefinitionRequest, MetadataRequest, MetadataSource} from '../omnisharp/protocol';
import {createRequest, toLocation, toLocationFromUri} from '../omnisharp/typeConvertion';
import AbstractSupport from './abstractProvider';
import DefinitionMetadataDocumentProvider from './definitionMetadataDocumentProvider';
import { OmniSharpServer } from '../omnisharp/server';

export default class CSharpDefinitionProvider extends AbstractSupport implements DefinitionProvider {
private _definitionMetadataDocumentProvider: DefinitionMetadataDocumentProvider;

constructor(server, definitionMetadataDocumentProvider: DefinitionMetadataDocumentProvider) {
constructor(server: OmniSharpServer, definitionMetadataDocumentProvider: DefinitionMetadataDocumentProvider) {
super(server);

this._definitionMetadataDocumentProvider = definitionMetadataDocumentProvider;
Expand Down
18 changes: 9 additions & 9 deletions src/features/diagnosticsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export class Advisor {

private _removeProjectFileCount(info: protocol.ProjectInformationResponse): void {
if (info.DotNetProject && info.DotNetProject.SourceFiles) {
delete this._updateProjectFileCount[info.DotNetProject.Path];
delete this._projectSourceFileCounts[info.DotNetProject.Path];
}

if (info.MsBuildProject && info.MsBuildProject.SourceFiles) {
delete this._updateProjectFileCount[info.MsBuildProject.Path];
delete this._projectSourceFileCounts[info.MsBuildProject.Path];
}
}

Expand Down Expand Up @@ -162,17 +162,17 @@ class DiagnosticsProvider extends AbstractSupport {
}

private _onDocumentRemove(document: vscode.TextDocument) {
let key = document.uri.toString();
let key = document.uri;
let didChange = false;
if (this._diagnostics[key]) {
if (this._diagnostics.get(key)) {
didChange = true;
this._diagnostics[key].dispose();
delete this._diagnostics[key];
this._diagnostics.delete(key);
}
if (this._documentValidations[key]) {

if (this._documentValidations[key.toString()]) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we did key.toString() enough times to justify introducing a local :)
BTW, why is key directly used as a ... key in _diagnostics but we toString it to use it as a key in _documentValidations?

didChange = true;
this._documentValidations[key].cancel();
delete this._documentValidations[key];
this._documentValidations[key.toString()].cancel();
delete this._documentValidations[key.toString()];
}
if (didChange) {
this._validateProject();
Expand Down
2 changes: 0 additions & 2 deletions src/features/documentHighlightProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/features/documentSymbolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as serverUtils from '../omnisharp/utils';
import {toDocumentSymbol} from '../omnisharp/typeConvertion';
Expand Down
1 change: 0 additions & 1 deletion src/features/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';
import * as protocol from '../omnisharp/protocol';

const summaryStartTag = /<summary>/i;
Expand Down
2 changes: 0 additions & 2 deletions src/features/formattingEditProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/features/hoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/features/implementationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import { FindImplementationsRequest } from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
3 changes: 1 addition & 2 deletions src/features/json/jsonContributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import { Location, getLocation, createScanner, SyntaxKind } from 'jsonc-parser';
import { ProjectJSONContribution } from './projectJSONContribution';
Expand Down Expand Up @@ -96,7 +95,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {

public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Thenable<CompletionList> {
let currentWord = this.getCurrentWord(document, position);
let overwriteRange = null;
let overwriteRange: Range = null;
let items: CompletionItem[] = [];
let isIncomplete = false;

Expand Down
1 change: 0 additions & 1 deletion src/features/json/projectJSONContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import * as nls from 'vscode-nls';

Expand Down
2 changes: 0 additions & 2 deletions src/features/referenceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/features/renameProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

import AbstractSupport from './abstractProvider';
import * as protocol from '../omnisharp/protocol';
import * as serverUtils from '../omnisharp/utils';
Expand Down
Loading