Compare commits

..

4 Commits

Author SHA1 Message Date
vaidankarswapnil
ed79737603 Merge branch 'master' of https://github.com/Azure/cosmos-explorer into fix_eslint_issues_2 2021-10-06 11:56:04 +05:30
vaidankarswapnil
92acc63103 Implemented few changes 2021-10-06 11:54:50 +05:30
vaidankarswapnil
22f6670184 Fix ESLint for few files 2021-10-05 15:57:36 +05:30
vaidankarswapnil
315a67e4dd Fix eslint issue for NotebookComponentAdapter.tsx 2021-10-05 13:02:04 +05:30
8 changed files with 34 additions and 39 deletions

View File

@@ -18,9 +18,7 @@ src/Common/MessageHandler.test.ts
src/Common/MessageHandler.ts
src/Common/MongoProxyClient.test.ts
src/Common/MongoUtility.ts
src/Common/NotificationsClientBase.ts
src/Common/QueriesClient.ts
src/Common/Splitter.ts
src/Controls/Heatmap/Heatmap.test.ts
src/Controls/Heatmap/Heatmap.ts
src/Definitions/datatables.d.ts
@@ -34,11 +32,7 @@ src/Definitions/jquery.d.ts
src/Definitions/plotly.js-cartesian-dist.d-min.ts
src/Definitions/png.d.ts
src/Definitions/svg.d.ts
src/Explorer/ComponentRegisterer.test.ts
src/Explorer/ComponentRegisterer.ts
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
src/Explorer/Controls/Editor/EditorComponent.ts
src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
src/Explorer/DataSamples/ContainerSampleGenerator.ts
@@ -48,9 +42,11 @@ 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
@@ -105,6 +101,7 @@ 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
@@ -149,14 +146,11 @@ src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx
src/Explorer/Notebook/NotebookComponent/contents/index.tsx
src/Explorer/Notebook/NotebookRenderer/NotebookReadOnlyRenderer.tsx
src/Explorer/Notebook/NotebookRenderer/NotebookRenderer.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/draggable/index.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/index.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
src/Explorer/Tree/ResourceTreeAdapter.tsx

View File

@@ -35,8 +35,11 @@ export class Splitter {
this.initialize();
}
public initialize() {
if (document.getElementById(this.splitterId) !== null && document.getElementById(this.leftSideId) != null) {
public initialize(): void {
if (
document.getElementById(this.splitterId) !== undefined &&
document.getElementById(this.leftSideId) !== undefined
) {
this.splitter = <HTMLElement>document.getElementById(this.splitterId);
this.leftSide = <HTMLElement>document.getElementById(this.leftSideId);
}

View File

@@ -5,6 +5,7 @@ import template from "./editor-component.html";
/**
* Helper class for ko component registration
*/
//eslint-disable-next-line
export class EditorComponent {
constructor() {
return {
@@ -38,7 +39,7 @@ class EditorViewModel extends JsonEditorViewModel {
* setTimeout is needed as creating the edtior manipulates the dom directly and expects
* Knockout to have completed all of the initial bindings for the component
*/
this.params.content() != null &&
this.params.content() !== undefined &&
setTimeout(() => {
this.createEditor(this.params.content(), this.configureEditor.bind(this));
});

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Wrapper around GremlinSimpleClient using Q promises and tailored to cosmosdb authentication
*/
@@ -56,7 +55,7 @@ export class GremlinClient {
this.flushResult(result.requestId);
}
},
failureCallback: (result: Result, error: string) => {
failureCallback: (result: Result, error: any) => {
const errorMessage = getErrorMessage(error);
const requestId = result.requestId;
@@ -69,7 +68,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, undefined);
this.abortPendingRequest(reqId, errorMessage, null);
}
}
} else {
@@ -90,7 +89,7 @@ export class GremlinClient {
},
deferred: deferred,
timeoutId: window.setTimeout(
() => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, undefined),
() => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, null),
GremlinClient.PENDING_REQUEST_TIMEOUT_MS
),
});
@@ -102,7 +101,7 @@ export class GremlinClient {
return;
}
this.client.close();
this.client = undefined;
this.client = null;
}
/**
@@ -111,8 +110,7 @@ export class GremlinClient {
* @return request charge or empty string
*/
public static getRequestChargeString(requestCharge: string | number): string {
// eslint-disable-next-line no-null/no-null
return requestCharge === undefined || requestCharge === null ? "" : `(${requestCharge} RUs)`;
return requestCharge == undefined || requestCharge == null ? "" : `(${requestCharge} RUs)`;
}
/**

View File

@@ -16,7 +16,7 @@ export interface NotebookComponentAdapterOptions {
export class NotebookComponentAdapter extends NotebookComponentBootstrapper implements ReactAdapter {
private onUpdateKernelInfo: () => void;
public parameters: any;
public parameters: unknown;
constructor(options: NotebookComponentAdapterOptions) {
super({

View File

@@ -46,7 +46,9 @@ const makeMapStateToProps = (
const { contentRef } = initialProps;
const mapStateToProps = (state: AppState) => {
const content = selectors.content(state, { contentRef });
let kernelStatus, kernelSpecName, currentCellType;
let kernelStatus,
kernelSpecName,
currentCellType = "";
if (!content || content.type !== "notebook") {
return {

View File

@@ -1,6 +1,3 @@
/* eslint jsx-a11y/no-static-element-interactions: 0 */
/* eslint jsx-a11y/click-events-have-key-events: 0 */
import { actions, AppState, ContentRef, selectors } from "@nteract/core";
import React from "react";
import { connect } from "react-redux";
@@ -23,7 +20,7 @@ interface DispatchProps {
type Props = ComponentProps & DispatchProps & StateProps;
export class HijackScroll extends React.Component<Props> {
el: HTMLDivElement | null = null;
el: HTMLDivElement | null | undefined = undefined;
scrollIntoViewIfNeeded(prevFocused?: boolean): void {
// Check if the element is being hovered over.
@@ -38,7 +35,7 @@ export class HijackScroll extends React.Component<Props> {
) {
if (this.el && "scrollIntoViewIfNeeded" in this.el) {
// This is only valid in Chrome, WebKit
(this.el as any).scrollIntoViewIfNeeded();
((this.el as unknown) as HijackScroll).scrollIntoViewIfNeeded();
} else if (this.el) {
// Make a best guess effort for older platforms
this.el.scrollIntoView();

View File

@@ -1,5 +1,5 @@
import * as ko from "knockout";
import * as _ from "underscore";
import * as ko from "knockout";
enum ScrollPosition {
Top,
@@ -7,25 +7,25 @@ enum ScrollPosition {
}
export class AccessibleVerticalList {
private items: unknown[] = [];
private onSelect?: (item: unknown) => void;
private items: any[] = [];
private onSelect?: (item: any) => void;
public currentItemIndex: ko.Observable<number>;
public currentItem: ko.Computed<unknown>;
public currentItem: ko.Computed<any>;
constructor(initialSetOfItems: unknown[]) {
constructor(initialSetOfItems: any[]) {
this.items = initialSetOfItems;
this.currentItemIndex = this.items !== undefined && this.items.length > 0 ? ko.observable(0) : ko.observable(-1);
this.currentItem = ko.computed<unknown>(() => this.items[this.currentItemIndex()]);
this.currentItemIndex = this.items != null && this.items.length > 0 ? ko.observable(0) : ko.observable(-1);
this.currentItem = ko.computed<any>(() => this.items[this.currentItemIndex()]);
}
public setOnSelect(onSelect: (item: unknown) => void): void {
public setOnSelect(onSelect: (item: any) => void): void {
this.onSelect = onSelect;
}
public onKeyDown = (_src: unknown, event: KeyboardEvent): boolean => {
const targetContainer: Element = <Element>event.target;
if (this.items === undefined || this.items.length === 0) {
if (this.items == null || 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: unknown[]): void {
if (newItemList === undefined || newItemList.length === 0) {
public updateItemList(newItemList: any[]) {
if (newItemList == null || newItemList.length === 0) {
this.currentItemIndex(-1);
this.items = [];
return;
@@ -73,7 +73,7 @@ export class AccessibleVerticalList {
this.items = newItemList;
}
public updateCurrentItem(item: unknown): void {
public updateCurrentItem(item: any) {
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 === undefined || this.items.length === 0;
return this.items == null || this.items.length === 0;
}
}