Enable stricter compile options on extensions (#5044)

* enable stricter compile settings in extensions

* more strict compile

* formatting

* formatting

* revert some changes

* formtting

* formatting
This commit is contained in:
Anthony Dresser
2019-04-23 11:18:00 -07:00
committed by GitHub
parent c66b349cec
commit 58959ef35e
51 changed files with 196 additions and 294 deletions

View File

@@ -22,19 +22,18 @@
"bytes": "^3.1.0",
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.2.16",
"error-ex": "^1.3.2",
"find-remove": "1.2.1",
"figures": "^2.0.0",
"find-remove": "1.2.1",
"fs-extra": "^3.0.1",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"service-downloader": "github:anthonydresser/service-downloader#0.1.5",
"service-downloader": "github:anthonydresser/service-downloader#0.1.6",
"stream-meter": "^1.0.4",
"uri-js": "^4.2.2",
"vscode-extension-telemetry": "0.1.0",
"vscode-languageclient": "^3.5.1",
"vscode-nls": "^4.0.0"
},
"devDependencies": {},
"contributes": {
"commands": [
{

View File

@@ -2,10 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { SqlOpsDataClient, ClientOptions, SqlOpsFeature } from 'dataprotocol-client';
import * as path from 'path';
import { IConfig, ServerProvider } from 'service-downloader';
import { ServerOptions, RPCMessageType, ClientCapabilities, ServerCapabilities, TransportKind } from 'vscode-languageclient';
import { Disposable } from 'vscode';

View File

@@ -51,7 +51,6 @@ export class DacFxServicesFeature extends SqlOpsFeature<undefined> {
protected registerProvider(options: undefined): Disposable {
const client = this._client;
let self = this;
let exportBacpac = (databaseName: string, packageFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
let params: contracts.ExportParams = { databaseName: databaseName, packageFilePath: packageFilePath, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
@@ -165,7 +164,6 @@ export class SchemaCompareServicesFeature extends SqlOpsFeature<undefined> {
protected registerProvider(options: undefined): Disposable {
const client = this._client;
let self = this;
let schemaCompare = (sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.SchemaCompareResult> => {
let params: contracts.SchemaCompareParams = { sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode };
@@ -729,4 +727,4 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
registerOnUpdated
});
}
}
}

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
@@ -13,7 +12,7 @@ const localize = nls.loadMessageBundle();
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
import { IConfig, ServerProvider, Events } from 'service-downloader';
import { ServerOptions, TransportKind, LanguageClient } from 'vscode-languageclient';
import { ServerOptions, TransportKind } from 'vscode-languageclient';
import * as Constants from './constants';
import ContextProvider from './contextProvider';
@@ -37,7 +36,6 @@ import { registerSearchServerCommand } from './objectExplorerNodeProvider/comman
const baseConfig = require('./config.json');
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
const jupyterNotebookProviderId = 'jupyter';
const msgSampleCodeDataFrame = localize('msgSampleCodeDataFrame', 'This sample code loads the file into a data frame and shows the first 10 results.');
@@ -47,7 +45,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<MssqlE
if (!supported) {
vscode.window.showErrorMessage('Unsupported platform');
return;
return undefined;
}
let config: IConfig = JSON.parse(JSON.stringify(baseConfig));

View File

@@ -126,7 +126,7 @@ export abstract class Command extends vscode.Disposable {
export abstract class ProgressCommand extends Command {
static progressId = 0;
constructor(private command: string, protected prompter: IPrompter, appContext: AppContext) {
constructor(command: string, protected prompter: IPrompter, appContext: AppContext) {
super(command, appContext);
}

View File

@@ -3,14 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as constants from '../constants';
import { IFileSource, IHdfsOptions, IRequestParams, FileSourceFactory } from './fileSources';
import { IFileSource, IHdfsOptions, FileSourceFactory } from './fileSources';
export class SqlClusterConnection {
private _connection: azdata.connection.Connection;

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as fs from 'fs';
@@ -14,13 +12,12 @@ const localize = nls.loadMessageBundle();
import { ApiWrapper } from '../apiWrapper';
import { Command, ICommandViewContext, ProgressCommand, ICommandObjectExplorerContext } from './command';
import { IHdfsOptions, HdfsFileSource, File, IFile, joinHdfsPath, FileSourceFactory } from './fileSources';
import { HdfsProvider, FolderNode, FileNode, HdfsFileSourceNode } from './hdfsProvider';
import { File, IFile, joinHdfsPath } from './fileSources';
import { FolderNode, FileNode, HdfsFileSourceNode } from './hdfsProvider';
import { IPrompter, IQuestion, QuestionTypes } from '../prompts/question';
import * as constants from '../constants';
import * as LocalizedConstants from '../localizedConstants';
import * as utils from '../utils';
import { SqlClusterConnection } from './connection';
import { AppContext } from '../appContext';
import { TreeNode } from './treeNodes';
import { MssqlObjectExplorerNodeProvider } from './objectExplorerNodeProvider';
@@ -171,7 +168,6 @@ export class MkDirCommand extends ProgressCommand {
}
private async mkDir(fileName, folderNode: FolderNode, cancelToken: vscode.CancellationTokenSource): Promise<void> {
let subFolder = await folderNode.mkdir(fileName);
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as fspath from 'path';
@@ -12,9 +10,8 @@ import * as fs from 'fs';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { ApiWrapper } from '../apiWrapper';
import * as Constants from '../constants';
import { IFileSource, IHdfsOptions, HdfsFileSource, IFile, File, FileSourceFactory } from './fileSources';
import { IFileSource, IHdfsOptions, IFile, File, FileSourceFactory } from './fileSources';
import { CancelableStream } from './cancelableStream';
import { TreeNode } from './treeNodes';
import * as utils from '../utils';
@@ -38,7 +35,7 @@ export class HdfsProvider implements vscode.TreeDataProvider<TreeNode>, ITreeCha
private _onDidChangeTreeData = new vscode.EventEmitter<TreeNode>();
private context: TreeDataContext;
constructor(extensionContext: vscode.ExtensionContext, private vscodeApi: ApiWrapper) {
constructor(extensionContext: vscode.ExtensionContext) {
this.connections = [];
this.context = new TreeDataContext(extensionContext, this);
}

View File

@@ -1,10 +1,7 @@
'use strict';
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
import {window, OutputChannel } from 'vscode';
import * as nodeUtil from 'util';
import { window, OutputChannel } from 'vscode';
import PromptFactory from './factory';
import EscapeException from '../escapeException';
import { IQuestion, IPrompter, IPromptCallback } from './question';
@@ -13,8 +10,6 @@ import { IQuestion, IPrompter, IPromptCallback } from './question';
export default class CodeAdapter implements IPrompter {
private outChannel: OutputChannel;
private outBuffer: string = '';
private messageLevelFormatters = {};
constructor() {
// TODO Decide whether output channel logging should be saved here?
this.outChannel = window.createOutputChannel('test');
@@ -24,15 +19,9 @@ export default class CodeAdapter implements IPrompter {
public logError(message: any): void {
let line = `error: ${message.message}\n Code - ${message.code}`;
this.outBuffer += `${line}\n`;
this.outChannel.appendLine(line);
}
private formatMessage(message: any): string {
const prefix = `${message.level}: (${message.id}) `;
return `${prefix}${message.message}`;
}
public clearLog(): void {
this.outChannel.clear();
}
@@ -58,19 +47,20 @@ export default class CodeAdapter implements IPrompter {
public promptSingle<T>(question: IQuestion, ignoreFocusOut?: boolean): Promise<T> {
let questions: IQuestion[] = [question];
return this.prompt(questions, ignoreFocusOut).then( (answers: {[key: string]: T}) => {
return this.prompt(questions, ignoreFocusOut).then((answers: { [key: string]: T }) => {
if (answers) {
let response: T = answers[question.name];
return response || undefined;
}
return undefined;
});
}
public prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{[key: string]: T}> {
let answers: {[key: string]: T} = {};
public prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [key: string]: T }> {
let answers: { [key: string]: T } = {};
// Collapse multiple questions into a set of prompt steps
let promptResult: Promise<{[key: string]: T}> = questions.reduce((promise: Promise<{[key: string]: T}>, question: IQuestion) => {
let promptResult: Promise<{ [key: string]: T }> = questions.reduce((promise: Promise<{ [key: string]: T }>, question: IQuestion) => {
this.fixQuestion(question);
return promise.then(() => {

View File

@@ -3,13 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { SparkJobSubmissionModel } from './sparkJobSubmissionModel';
import { AppContext } from '../../../appContext';
import { ApiWrapper } from '../../../apiWrapper';

View File

@@ -10,7 +10,6 @@ import * as path from 'path';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as which from 'which';
import * as Constants from '../constants';
const localize = nls.loadMessageBundle();

View File

@@ -34,11 +34,11 @@ export function FilterErrorPath(line: string): string {
return values[1];
}
}
return undefined;
}
export class Telemetry {
private static reporter: TelemetryReporter;
private static userId: string;
private static platformInformation: PlatformInformation;
private static disabled: boolean;

View File

@@ -112,6 +112,7 @@ export function getPackageInfo(packageJson: any): IPackageInfo {
aiKey: packageJson.aiKey
};
}
return undefined;
}
export function generateUserId(): Promise<string> {

View File

@@ -3,11 +3,8 @@
"compilerOptions": {
"outDir": "./out",
"strict": false,
"alwaysStrict": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noUnusedLocals": false,
"noUnusedParameters": false
"noUnusedParameters": false,
"noImplicitAny": false
},
"include": [
"src/**/*"

View File

@@ -791,9 +791,9 @@ semver@^5.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
"service-downloader@github:anthonydresser/service-downloader#0.1.5":
version "0.1.5"
resolved "https://codeload.github.com/anthonydresser/service-downloader/tar.gz/6ebb0465573cc140e461a22f334260f55ef45546"
"service-downloader@github:anthonydresser/service-downloader#0.1.6":
version "0.1.6"
resolved "https://codeload.github.com/anthonydresser/service-downloader/tar.gz/fd4114b145ee2b4f1f7950c23f10f4b1b28a2bfc"
dependencies:
decompress "^4.2.0"
eventemitter2 "^5.0.1"