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

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as path from 'path';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
@@ -118,8 +116,8 @@ export class JupyterController implements vscode.Disposable {
private async handleOpenNotebookTask(profile: azdata.IConnectionProfile): Promise<void> {
let notebookFileTypeName = localize('notebookFileType', 'Notebooks');
let filter = {};
filter[notebookFileTypeName] = 'ipynb';
let filter: { [key: string]: Array<string> } = {};
filter[notebookFileTypeName] = ['ipynb'];
let uris = await this.apiWrapper.showOpenDialog({
filters: filter,
canSelectFiles: true,
@@ -207,8 +205,8 @@ export class JupyterController implements vscode.Disposable {
}
public doConfigurePython(jupyterInstaller: JupyterServerInstallation): void {
let pythonDialog = new ConfigurePythonDialog(this.apiWrapper, this.outputChannel, jupyterInstaller);
pythonDialog.showDialog().catch(err => {
let pythonDialog = new ConfigurePythonDialog(this.apiWrapper, jupyterInstaller);
pythonDialog.showDialog().catch((err: any) => {
this.apiWrapper.showErrorMessage(utils.getErrorMessage(err));
});
}

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 fs from 'fs-extra';
import * as path from 'path';
import * as nls from 'vscode-nls';
@@ -102,7 +100,7 @@ export default class JupyterServerInstallation {
.replace('#bundleversion', bundleVersion)
.replace('#extension', process.platform === constants.winPlatform ? 'zip' : 'tar.gz');
let pythonDownloadUrl = undefined;
let pythonDownloadUrl: string = undefined;
switch (utils.getOSPlatform()) {
case utils.Platform.Windows:
pythonDownloadUrl = 'https://go.microsoft.com/fwlink/?linkid=2074021';
@@ -117,9 +115,7 @@ export default class JupyterServerInstallation {
}
let pythonPackagePathLocal = this._pythonInstallationPath + '/' + packageName;
let self = undefined;
return new Promise((resolve, reject) => {
self = this;
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgDownloadPython(platformId, pythonDownloadUrl));
fs.mkdirs(this._pythonInstallationPath, (err) => {
if (err) {
@@ -169,7 +165,7 @@ export default class JupyterServerInstallation {
reject(err);
}
}
decompress(pythonPackagePathLocal, self._pythonInstallationPath).then(files => {
decompress(pythonPackagePathLocal, this._pythonInstallationPath).then(files => {
//Delete zip/tar file
fs.unlink(pythonPackagePathLocal, (err) => {
if (err) {
@@ -310,7 +306,7 @@ export default class JupyterServerInstallation {
*/
public async promptForPythonInstall(): Promise<void> {
if (!JupyterServerInstallation.isPythonInstalled(this.apiWrapper)) {
let pythonDialog = new ConfigurePythonDialog(this.apiWrapper, this.outputChannel, this);
let pythonDialog = new ConfigurePythonDialog(this.apiWrapper, this);
return pythonDialog.showDialog(true);
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { nb, ServerInfo, connection, IConnectionProfile } from 'azdata';
import { Session, Kernel } from '@jupyterlab/services';
import * as fs from 'fs-extra';
@@ -148,6 +146,7 @@ export class JupyterSessionManager implements nb.SessionManager {
if (this._sessionManager && !this._sessionManager.isDisposed) {
return this._sessionManager.shutdown(id);
}
return undefined;
}
public shutdownAll(): Promise<void> {
@@ -247,7 +246,6 @@ export class JupyterSession implements nb.ISession {
await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT_KNOX) ||
await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT_GATEWAY);
if (!clusterEndpoint) {
let kernelDisplayName: string = await this.getKernelDisplayName();
return Promise.reject(new Error(localize('connectionNotValid', 'Spark kernels require a connection to a SQL Server big data cluster master instance.')));
}
connection.options[KNOX_ENDPOINT_SERVER] = clusterEndpoint.ipAddress;
@@ -270,11 +268,6 @@ export class JupyterSession implements nb.ISession {
}
}
private async getKernelDisplayName(): Promise<string> {
let spec = await this.kernel.getSpec();
return spec.display_name;
}
private isSparkKernel(kernelName: string): boolean {
return kernelName && kernelName.toLowerCase().indexOf('spark') > -1;
}

View File

@@ -246,8 +246,8 @@ export class PerNotebookServerInstance implements IServerInstance {
this.childProcess = this.spawnJupyterProcess(install, startCommand);
let stdErrLog: string = '';
// Add listeners for the process exiting prematurely
let onErrorBeforeStartup = (err) => reject(err);
let onExitBeforeStart = (err) => {
let onErrorBeforeStartup = (err: any) => reject(err);
let onExitBeforeStart = (err: any) => {
if (!this.isStarted) {
reject(localize('notebookStartProcessExitPremature', 'Notebook process exited prematurely with error: {0}, StdErr Output: {1}', err, stdErrLog));
}
@@ -372,7 +372,7 @@ export class PerNotebookServerInstance implements IServerInstance {
}
private getEnvWithConfigPaths(env: {}): any {
let newEnv = Object.assign({}, env);
let newEnv: { [key: string]: string } = Object.assign({}, env);
newEnv['JUPYTER_CONFIG_DIR'] = this.instanceConfigRoot;
newEnv['JUPYTER_PATH'] = this.instanceDataRoot;
return newEnv;