diff --git a/.eslintignore b/.eslintignore index 3de1fdee0..720d65059 100644 --- a/.eslintignore +++ b/.eslintignore @@ -48,11 +48,9 @@ src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts -src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts -src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts src/Explorer/Menus/ContextMenu.ts @@ -107,7 +105,6 @@ src/Explorer/Tabs/TabComponents.ts src/Explorer/Tabs/TabsBase.ts src/Explorer/Tabs/TriggerTab.ts src/Explorer/Tabs/UserDefinedFunctionTab.ts -src/Explorer/Tree/AccessibleVerticalList.ts src/Explorer/Tree/Collection.ts src/Explorer/Tree/ConflictId.ts src/Explorer/Tree/DocumentId.ts diff --git a/src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts b/src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts index 575412675..857ea6464 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ /** * Wrapper around GremlinSimpleClient using Q promises and tailored to cosmosdb authentication */ @@ -55,7 +56,7 @@ export class GremlinClient { this.flushResult(result.requestId); } }, - failureCallback: (result: Result, error: any) => { + failureCallback: (result: Result, error: string) => { const errorMessage = getErrorMessage(error); const requestId = result.requestId; @@ -68,7 +69,7 @@ export class GremlinClient { // Fail all pending requests if no request id (fatal) if (!requestId) { for (const reqId of this.pendingResults.keys()) { - this.abortPendingRequest(reqId, errorMessage, null); + this.abortPendingRequest(reqId, errorMessage, undefined); } } } else { @@ -89,7 +90,7 @@ export class GremlinClient { }, deferred: deferred, timeoutId: window.setTimeout( - () => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, null), + () => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, undefined), GremlinClient.PENDING_REQUEST_TIMEOUT_MS ), }); @@ -101,7 +102,7 @@ export class GremlinClient { return; } this.client.close(); - this.client = null; + this.client = undefined; } /** @@ -110,7 +111,8 @@ export class GremlinClient { * @return request charge or empty string */ public static getRequestChargeString(requestCharge: string | number): string { - return requestCharge == undefined || requestCharge == null ? "" : `(${requestCharge} RUs)`; + // eslint-disable-next-line no-null/no-null + return requestCharge === undefined || requestCharge === null ? "" : `(${requestCharge} RUs)`; } /** diff --git a/src/Explorer/Tree/AccessibleVerticalList.ts b/src/Explorer/Tree/AccessibleVerticalList.ts index be701bb93..f3446ffc8 100644 --- a/src/Explorer/Tree/AccessibleVerticalList.ts +++ b/src/Explorer/Tree/AccessibleVerticalList.ts @@ -1,5 +1,5 @@ -import * as _ from "underscore"; import * as ko from "knockout"; +import * as _ from "underscore"; enum ScrollPosition { Top, @@ -7,25 +7,25 @@ enum ScrollPosition { } export class AccessibleVerticalList { - private items: any[] = []; - private onSelect?: (item: any) => void; + private items: unknown[] = []; + private onSelect?: (item: unknown) => void; public currentItemIndex: ko.Observable; - public currentItem: ko.Computed; + public currentItem: ko.Computed; - constructor(initialSetOfItems: any[]) { + constructor(initialSetOfItems: unknown[]) { this.items = initialSetOfItems; - this.currentItemIndex = this.items != null && this.items.length > 0 ? ko.observable(0) : ko.observable(-1); - this.currentItem = ko.computed(() => this.items[this.currentItemIndex()]); + this.currentItemIndex = this.items !== undefined && this.items.length > 0 ? ko.observable(0) : ko.observable(-1); + this.currentItem = ko.computed(() => this.items[this.currentItemIndex()]); } - public setOnSelect(onSelect: (item: any) => void): void { + public setOnSelect(onSelect: (item: unknown) => void): void { this.onSelect = onSelect; } public onKeyDown = (_src: unknown, event: KeyboardEvent): boolean => { const targetContainer: Element = event.target; - if (this.items == null || this.items.length === 0) { + if (this.items === undefined || this.items.length === 0) { // no items so this should be a noop return true; } @@ -62,8 +62,8 @@ export class AccessibleVerticalList { return true; }; - public updateItemList(newItemList: any[]) { - if (newItemList == null || newItemList.length === 0) { + public updateItemList(newItemList: unknown[]): void { + if (newItemList === undefined || newItemList.length === 0) { this.currentItemIndex(-1); this.items = []; return; @@ -73,7 +73,7 @@ export class AccessibleVerticalList { this.items = newItemList; } - public updateCurrentItem(item: any) { + public updateCurrentItem(item: unknown): void { const updatedIndex: number = this.isItemListEmpty() ? -1 : _.indexOf(this.items, item); this.currentItemIndex(updatedIndex); } @@ -118,6 +118,6 @@ export class AccessibleVerticalList { } private isItemListEmpty(): boolean { - return this.items == null || this.items.length === 0; + return this.items === undefined || this.items.length === 0; } }