No console linting (#9156)

* add no-console linting and change to just using overrides for sql files

* whitespace

* fix tests
This commit is contained in:
Anthony Dresser
2020-02-14 21:13:16 -06:00
committed by GitHub
parent 6b0332b2d1
commit 74b89a0a85
31 changed files with 107 additions and 105 deletions

View File

@@ -55,7 +55,7 @@ export class BackupDialog extends Modal {
* Get the bootstrap params and perform the bootstrap
*/
private bootstrapAngular(bodyContainer: HTMLElement) {
bootstrapAngular(this._instantiationService,
this._instantiationService.invokeFunction(bootstrapAngular,
BackupModule,
bodyContainer,
BACKUP_SELECTOR,

View File

@@ -126,7 +126,7 @@ export class DashboardEditor extends BaseEditor {
input.hasBootstrapped = true;
const uniqueSelector = bootstrapAngular(this.instantiationService,
const uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular,
DashboardModule,
this._dashboardContainer,
DASHBOARD_SELECTOR,

View File

@@ -23,6 +23,7 @@ import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/vie
import { IViewDescriptorService } from 'vs/workbench/common/views';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ILogService } from 'vs/platform/log/common/log';
export class ConnectionViewletPanel extends ViewPane {
@@ -44,7 +45,8 @@ export class ConnectionViewletPanel extends ViewPane {
@IContextKeyService contextKeyService: IContextKeyService,
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
@IOpenerService protected openerService: IOpenerService,
@IThemeService protected themeService: IThemeService
@IThemeService protected themeService: IThemeService,
@ILogService private readonly logService: ILogService
) {
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, opener, themeService);
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
@@ -73,7 +75,7 @@ export class ConnectionViewletPanel extends ViewPane {
const viewletContainer = DOM.append(container, DOM.$('div.server-explorer-viewlet'));
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
console.warn('render registered servers: ' + error);
this.logService.warn('render registered servers: ' + error);
});
this._root = container;
}

View File

@@ -445,7 +445,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
() => this.nextPage(), this.navigationResult.next ? true : false);
this.detectChanges();
}, err => {
console.log(err);
this.logService.info(err);
});
}
}

View File

@@ -227,7 +227,7 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle
providerInfo: input.getProviderInfo(),
profile: input.connectionProfile
};
bootstrapAngular(this._instantiationService,
this._instantiationService.invokeFunction(bootstrapAngular,
NotebookModule,
this._notebookContainer,
NOTEBOOK_SELECTOR,

View File

@@ -78,7 +78,7 @@ export class QueryModelViewTabView implements IPanelView {
* Load the angular components and record for this input that we have done so
*/
private bootstrapAngular(container: HTMLElement): string {
let uniqueSelector = bootstrapAngular(this._instantiationService,
let uniqueSelector = this._instantiationService.invokeFunction(bootstrapAngular,
QueryModelViewTabModule,
container,
'querytab-modelview-container',

View File

@@ -42,6 +42,7 @@ import { TreeViewItemHandleArg } from 'sql/workbench/common/views';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
import { ILogService } from 'vs/platform/log/common/log';
/**
* Action class that query-based Actions will extend. This base class automatically handles activating and
@@ -268,7 +269,8 @@ export class CancelQueryAction extends QueryTaskbarAction {
constructor(
editor: QueryEditor,
@IQueryModelService private readonly queryModelService: IQueryModelService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@ILogService private readonly logService: ILogService
) {
super(connectionManagementService, editor, CancelQueryAction.ID, CancelQueryAction.EnabledClass);
this.enabled = false;
@@ -278,7 +280,7 @@ export class CancelQueryAction extends QueryTaskbarAction {
public async run(): Promise<void> {
if (this.isConnected(this.editor)) {
if (!this.editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
this.queryModelService.cancelQuery(this.editor.input.uri);
@@ -526,7 +528,8 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
private _isSqlCmdMode: boolean,
@IQueryManagementService protected readonly queryManagementService: IQueryManagementService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@ILogService private readonly logService: ILogService
) {
super(connectionManagementService, editor, ToggleSqlCmdModeAction.ID, undefined);
}
@@ -554,7 +557,7 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
let queryoptions: QueryExecutionOptions = { options: {} };
queryoptions.options['isSqlCmdMode'] = toSqlCmdState;
if (!this.editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
this.queryManagementService.setQueryExecutionOptions(this.editor.input.uri, queryoptions);
@@ -586,7 +589,8 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
@IContextViewService contextViewProvider: IContextViewService,
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
@INotificationService private readonly notificationService: INotificationService,
@IConfigurationService private readonly configurationService: IConfigurationService
@IConfigurationService private readonly configurationService: IConfigurationService,
@ILogService private readonly logService: ILogService
) {
super();
this._databaseListDropdown = $('.databaseListDropdown');
@@ -680,7 +684,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
// PRIVATE HELPERS /////////////////////////////////////////////////////
private databaseSelected(dbName: string): void {
if (!this._editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
@@ -716,7 +720,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
private getCurrentDatabaseName(): string | undefined {
if (!this._editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return undefined;
}
@@ -744,7 +748,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
}
if (!this._editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
@@ -758,7 +762,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
private onDropdownFocus(): void {
if (!this._editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
@@ -782,7 +786,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
if (this._isInAccessibilityMode) {
this._databaseSelectBox.enable();
if (!this._editor.input) {
console.error('editor input was null');
this.logService.error('editor input was null');
return;
}
let uri = this._editor.input.uri;

View File

@@ -333,7 +333,7 @@ suite('SQL QueryAction Tests', () => {
});
// If I call run on CancelQueryAction when I am not connected
let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object);
let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object, undefined);
isConnected = false;
await queryAction.run();
@@ -467,7 +467,7 @@ suite('SQL QueryAction Tests', () => {
});
// If I query without having initialized anything, state should be clear
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
@@ -498,7 +498,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
// ... Create a database dropdown that has been connected
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
listItem.onConnected();
// If: I raise a connection changed event
@@ -520,7 +520,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
// ... Create a database dropdown that has been connected
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
listItem.onConnected();
// If: I raise a connection changed event for the 'wrong' URI
@@ -545,7 +545,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
// ... Create a database dropdown
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
// If: I raise a connection changed event
let eventParams = <IConnectionParams>{

View File

@@ -63,7 +63,7 @@ suite('SQL QueryEditor Tests', () => {
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
if (classDef.ID) {
if (classDef.ID === 'listDatabaseQueryActionItem') {
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object);
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
}
}
// Default
@@ -295,7 +295,7 @@ suite('SQL QueryEditor Tests', () => {
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
.returns((definition, editor, action, selectBox) => {
if (definition.ID === 'listDatabaseQueryActionItem') {
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object);
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
return item;
}
// Default

View File

@@ -102,7 +102,7 @@ export class QueryPlanEditor extends BaseEditor {
planXml: input.planXml
};
let uniqueSelector = bootstrapAngular(this.instantiationService,
let uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular,
QueryPlanModule,
this.getContainer(),
QUERYPLAN_SELECTOR,