Hygiene linting for extensions + new rule (#7843)

* linting for extensions + new rule

* Remove unneeded array

* Fix spelling mistake

* Fix bad merge
This commit is contained in:
Charles Gagnon
2019-10-22 18:56:31 -07:00
committed by GitHub
parent 4c24043cc8
commit 4a68ab4659
91 changed files with 920 additions and 792 deletions

View File

@@ -9,8 +9,8 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
// General Constants ///////////////////////////////////////////////////////
export const msgYes = localize('msgYes', 'Yes');
export const msgNo = localize('msgNo', 'No');
export const msgYes = localize('msgYes', "Yes");
export const msgNo = localize('msgNo', "No");
// Jupyter Constants ///////////////////////////////////////////////////////
export const msgSampleCodeDataFrame = localize('msgSampleCodeDataFrame', 'This sample code loads the file into a data frame and shows the first 10 results.');
export const msgSampleCodeDataFrame = localize('msgSampleCodeDataFrame', "This sample code loads the file into a data frame and shows the first 10 results.");

View File

@@ -22,7 +22,7 @@ export function getLivyUrl(serverName: string, port: string): string {
export async function mkDir(dirPath: string, outputChannel?: vscode.OutputChannel): Promise<void> {
if (!await fs.pathExists(dirPath)) {
if (outputChannel) {
outputChannel.appendLine(localize('mkdirOutputMsg', '... Creating {0}', dirPath));
outputChannel.appendLine(localize('mkdirOutputMsg', "... Creating {0}", dirPath));
}
await fs.ensureDir(dirPath);
}
@@ -71,7 +71,7 @@ export function executeStreamedCommand(cmd: string, options: childProcess.SpawnO
if (code === 0) {
resolve();
} else {
reject(localize('executeCommandProcessExited', 'Process exited with code {0}', code));
reject(localize('executeCommandProcessExited', "Process exited with code {0}", code));
}
});

View File

@@ -152,7 +152,7 @@ export class InstalledPackagesTab {
this.uninstallPackageButton.updateProperties({ enabled: false });
let doUninstall = await this.prompter.promptSingle<boolean>(<IQuestion>{
type: QuestionTypes.confirm,
message: localize('managePackages.confirmUninstall', 'Are you sure you want to uninstall the specified packages?'),
message: localize('managePackages.confirmUninstall', "Are you sure you want to uninstall the specified packages?"),
default: false
});

View File

@@ -119,7 +119,7 @@ export class JupyterController implements vscode.Disposable {
}
private async handleOpenNotebookTask(profile: azdata.IConnectionProfile): Promise<void> {
let notebookFileTypeName = localize('notebookFileType', 'Notebooks');
let notebookFileTypeName = localize('notebookFileType', "Notebooks");
let filter: { [key: string]: Array<string> } = {};
filter[notebookFileTypeName] = ['ipynb'];
let uris = await this.apiWrapper.showOpenDialog({
@@ -132,7 +132,7 @@ export class JupyterController implements vscode.Disposable {
// Verify this is a .ipynb file since this isn't actually filtered on Mac/Linux
if (path.extname(fileUri.fsPath) !== '.ipynb') {
// in the future might want additional supported types
this.apiWrapper.showErrorMessage(localize('unsupportedFileType', 'Only .ipynb Notebooks are supported'));
this.apiWrapper.showErrorMessage(localize('unsupportedFileType', "Only .ipynb Notebooks are supported"));
} else {
await azdata.nb.showNotebookDocument(fileUri, {
connectionProfile: profile,
@@ -191,7 +191,7 @@ export class JupyterController implements vscode.Disposable {
private async confirmReinstall(): Promise<boolean> {
return await this.prompter.promptSingle<boolean>(<IQuestion>{
type: QuestionTypes.confirm,
message: localize('confirmReinstall', 'Are you sure you want to reinstall?'),
message: localize('confirmReinstall', "Are you sure you want to reinstall?"),
default: true
});
}

View File

@@ -26,7 +26,7 @@ export class JupyterNotebookProvider implements nb.NotebookProvider {
public getNotebookManager(notebookUri: vscode.Uri): Thenable<nb.NotebookManager> {
if (!notebookUri) {
return Promise.reject(localize('errNotebookUriMissing', 'A notebook path is required'));
return Promise.reject(localize('errNotebookUriMissing', "A notebook path is required"));
}
return Promise.resolve(this.doGetNotebookManager(notebookUri));
}

View File

@@ -73,7 +73,7 @@ export class LocalJupyterServerManager implements nb.ServerManager, vscode.Dispo
public dispose(): void {
this.stopServer().catch(err => {
let msg = utils.getErrorMessage(err);
this._apiWrapper.showErrorMessage(localize('shutdownError', 'Shutdown of Notebook server failed: {0}', msg));
this._apiWrapper.showErrorMessage(localize('shutdownError', "Shutdown of Notebook server failed: {0}", msg));
});
}

View File

@@ -120,7 +120,7 @@ export class JupyterSessionManager implements nb.SessionManager {
public async startNew(options: nb.ISessionOptions, skipSettingEnvironmentVars?: boolean): Promise<nb.ISession> {
if (!this._isReady) {
// no-op
return Promise.reject(new Error(localize('errorStartBeforeReady', 'Cannot start a session, the manager is not yet initialized')));
return Promise.reject(new Error(localize('errorStartBeforeReady', "Cannot start a session, the manager is not yet initialized")));
}
let sessionImpl = await this._sessionManager.startNew(options);
let jupyterSession = new JupyterSession(sessionImpl, skipSettingEnvironmentVars);

View File

@@ -69,7 +69,7 @@ export class JupyterSettingWriter {
value = `set([${setting.value}])`;
break;
default:
throw new Error(localize('UnexpectedSettingType', 'Unexpected setting type {0}', setting.type));
throw new Error(localize('UnexpectedSettingType', "Unexpected setting type {0}", setting.type));
}
return `c.${setting.key} = ${value}`;
}

View File

@@ -168,7 +168,7 @@ export class PerFolderServerInstance implements IServerInstance {
}
} catch (error) {
// For now, we don't care as this is non-critical
this.notify(this.options.install, localize('serverStopError', 'Error stopping Notebook Server: {0}', utils.getErrorMessage(error)));
this.notify(this.options.install, localize('serverStopError', "Error stopping Notebook Server: {0}", utils.getErrorMessage(error)));
} finally {
this._isStarted = false;
this.utils.ensureProcessEnded(this.childProcess);
@@ -260,7 +260,7 @@ export class PerFolderServerInstance implements IServerInstance {
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));
reject(localize('notebookStartProcessExitPremature', "Notebook process exited prematurely with error: {0}, StdErr Output: {1}", err, stdErrLog));
}
};
this.childProcess.on('error', onErrorBeforeStartup);
@@ -309,7 +309,7 @@ export class PerFolderServerInstance implements IServerInstance {
private handleConnectionError(error: Error): void {
let action = this.errorHandler.handleError(error);
if (action === ErrorAction.Shutdown) {
this.notify(this.options.install, localize('jupyterError', 'Error sent from Jupyter: {0}', utils.getErrorMessage(error)));
this.notify(this.options.install, localize('jupyterError', "Error sent from Jupyter: {0}", utils.getErrorMessage(error)));
this.stop();
}
}
@@ -349,14 +349,14 @@ export class PerFolderServerInstance implements IServerInstance {
}
private notifyStarted(install: JupyterServerInstallation, jupyterUri: string): void {
install.outputChannel.appendLine(localize('jupyterOutputMsgStartSuccessful', '... Jupyter is running at {0}', jupyterUri));
install.outputChannel.appendLine(localize('jupyterOutputMsgStartSuccessful', "... Jupyter is running at {0}", jupyterUri));
}
private notify(install: JupyterServerInstallation, message: string): void {
install.outputChannel.appendLine(message);
}
private notifyStarting(install: JupyterServerInstallation, startCommand: string): void {
install.outputChannel.appendLine(localize('jupyterOutputMsgStart', '... Starting Notebook server'));
install.outputChannel.appendLine(localize('jupyterOutputMsgStart', "... Starting Notebook server"));
install.outputChannel.appendLine(` > ${startCommand}`);
}