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

@@ -23,6 +23,7 @@ import { URI } from 'vs/base/common/uri';
import { firstIndex } from 'vs/base/common/arrays';
import { values } from 'vs/base/common/collections';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
export class AccountManagementService implements IAccountManagementService {
// CONSTANTS ///////////////////////////////////////////////////////////
@@ -52,7 +53,8 @@ export class AccountManagementService implements IAccountManagementService {
@IInstantiationService private _instantiationService: IInstantiationService,
@IStorageService private _storageService: IStorageService,
@IClipboardService private _clipboardService: IClipboardService,
@IOpenerService private _openerService: IOpenerService
@IOpenerService private _openerService: IOpenerService,
@ILogService private readonly logService: ILogService
) {
// Create the account store
if (!this._mementoObj) {
@@ -301,7 +303,7 @@ export class AccountManagementService implements IAccountManagementService {
this.doWithProvider(providerId, provider => provider.provider.autoOAuthCancelled())
.then( // Swallow errors
null,
err => { console.warn(`Error when cancelling auto OAuth: ${err}`); }
err => { this.logService.warn(`Error when cancelling auto OAuth: ${err}`); }
)
.then(() => this.autoOAuthDialogController.closeAutoOAuthDialog());
}

View File

@@ -506,7 +506,7 @@ function getTestState(): AccountManagementState {
let mockMemento = {};
// Create the account management service
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null, null);
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null, null, undefined);
// Wire up event handlers
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();

View File

@@ -5,7 +5,7 @@
import { NgModuleRef, PlatformRef, Provider, enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { IInstantiationService, _util } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, _util, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IEditorInput } from 'vs/workbench/common/editor';
import { Trace } from 'vs/platform/instantiation/common/instantiationService';
import { values } from 'vs/base/common/map';
@@ -40,14 +40,15 @@ function createUniqueSelector(selector: string): string {
let platform: PlatformRef;
export function bootstrapAngular<T>(service: IInstantiationService, moduleType: IModuleFactory<T>, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef<T>) => void): string {
export function bootstrapAngular<T>(accessor: ServicesAccessor, moduleType: IModuleFactory<T>, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef<T>) => void): string {
// Create the uniqueSelectorString
let uniqueSelectorString = createUniqueSelector(selectorString);
let selector = document.createElement(uniqueSelectorString);
container.appendChild(selector);
const instantiationService = accessor.get(IInstantiationService);
if (!platform) {
service.invokeFunction((accessor) => {
instantiationService.invokeFunction((accessor) => {
const environmentService = accessor.get(IEnvironmentService);
if (environmentService.isBuilt) {
enableProdMode();
@@ -56,7 +57,7 @@ export function bootstrapAngular<T>(service: IInstantiationService, moduleType:
platform = platformBrowserDynamic();
}
platform.bootstrapModule(moduleType(params, uniqueSelectorString, service)).then(moduleRef => {
platform.bootstrapModule(moduleType(params, uniqueSelectorString, instantiationService)).then(moduleRef => {
if (input) {
input.onDispose(() => {
moduleRef.destroy();
@@ -66,14 +67,8 @@ export function bootstrapAngular<T>(service: IInstantiationService, moduleType:
callbackSetModule(moduleRef);
}
}).catch((e) => {
service.invokeFunction((accessor) => {
const logService = accessor.get(ILogService);
if (!logService) {
console.error(e);
return;
}
logService.error(e);
});
const logService = accessor.get(ILogService);
logService.error(e);
});
return uniqueSelectorString;

View File

@@ -109,7 +109,7 @@ export class DialogPane extends Disposable implements IThemable {
* Bootstrap angular for the dialog's model view controller with the given model view ID
*/
private initializeModelViewContainer(bodyContainer: HTMLElement, modelViewId: string, tab?: DialogTab) {
bootstrapAngular(this._instantiationService,
this._instantiationService.invokeFunction(bootstrapAngular,
DialogModule,
bodyContainer,
'dialog-modelview-container',

View File

@@ -232,7 +232,7 @@ export class WizardModal extends Modal {
* Bootstrap angular for the wizard's left nav bar
*/
private initializeNavigation(bodyContainer: HTMLElement) {
bootstrapAngular(this._instantiationService,
this._instantiationService.invokeFunction(bootstrapAngular,
DialogModule,
bodyContainer,
'wizard-navigation',

View File

@@ -9,6 +9,7 @@ import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane';
import { DialogComponentParams } from 'sql/workbench/services/dialog/browser/dialogContainer.component';
import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
import { workbenchInstantiationService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
interface BootstrapAngular {
@@ -41,7 +42,7 @@ suite('Dialog Pane Tests', () => {
});
dialog.content = modelViewId;
const themeService = new TestThemeService();
let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, undefined, themeService, false);
let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, workbenchInstantiationService(), themeService, undefined);
dialogPane.createBody(container);
assert.equal(bootstrapCalls, 1);
});
@@ -56,7 +57,7 @@ suite('Dialog Pane Tests', () => {
});
dialog.content = [new DialogTab('', modelViewId)];
const themeService = new TestThemeService();
let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, undefined, themeService, false);
let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, workbenchInstantiationService(), themeService, false);
dialogPane.createBody(container);
assert.equal(bootstrapCalls, 1);
});
@@ -73,7 +74,7 @@ suite('Dialog Pane Tests', () => {
let modelViewId2 = 'test_content_2';
dialog.content = [new DialogTab('tab1', modelViewId1), new DialogTab('tab2', modelViewId2)];
const themeService = new TestThemeService();
let dialogPane = new DialogPane(dialog.title, dialog.content, valid => dialog.notifyValidityChanged(valid), undefined, themeService, false);
let dialogPane = new DialogPane(dialog.title, dialog.content, valid => dialog.notifyValidityChanged(valid), workbenchInstantiationService(), themeService, false);
dialogPane.createBody(container);
let validityChanges: boolean[] = [];

View File

@@ -40,7 +40,6 @@ import { Schemas } from 'vs/base/common/network';
import { ILogService } from 'vs/platform/log/common/log';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { NotebookChangeType } from 'sql/workbench/services/notebook/common/contracts';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { find, firstIndex } from 'vs/base/common/arrays';
import { onUnexpectedError } from 'vs/base/common/errors';
@@ -129,7 +128,7 @@ export class NotebookService extends Disposable implements INotebookService {
@IFileService private readonly _fileService: IFileService,
@ILogService private readonly _logService: ILogService,
@IQueryManagementService private readonly _queryManagementService: IQueryManagementService,
@IEnvironmentService environmentService: IEnvironmentService
@ILogService private readonly logService: ILogService
) {
super();
this._providersMemento = new Memento('notebookProviders', this._storageService);
@@ -455,7 +454,7 @@ export class NotebookService extends Disposable implements INotebookService {
try {
await this._extensionService.whenInstalledExtensionsRegistered();
} catch (error) {
console.error(error);
this.logService.error(error);
}
instance = await this.waitOnProviderAvailability(providerDescriptor);
} else {