Compare commits

..

1 Commits

Author SHA1 Message Date
sunilyadav840
9a1e9f7231 fixed eslint issue of ArrayByCache and ArrayByCache.test.ts 2021-10-05 15:32:01 +05:30
9 changed files with 926 additions and 33478 deletions

View File

@@ -18,7 +18,9 @@ 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
@@ -35,14 +37,13 @@ src/Definitions/svg.d.ts
src/Explorer/ComponentRegisterer.test.ts
src/Explorer/ComponentRegisterer.ts
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
src/Explorer/Controls/DynamicList/DynamicList.test.ts
src/Explorer/Controls/Editor/EditorComponent.ts
src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
src/Explorer/DataSamples/ContainerSampleGenerator.ts
src/Explorer/DataSamples/DataSamplesUtil.test.ts
src/Explorer/DataSamples/DataSamplesUtil.ts
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
@@ -149,11 +150,14 @@ 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

34351
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -5,7 +5,6 @@ import template from "./editor-component.html";
/**
* Helper class for ko component registration
*/
//eslint-disable-next-line
export class EditorComponent {
constructor() {
return {
@@ -39,7 +38,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() !== undefined &&
this.params.content() != null &&
setTimeout(() => {
this.createEditor(this.params.content(), this.configureEditor.bind(this));
});

View File

@@ -6,7 +6,7 @@ describe("Cache arrays by key", () => {
const key = "key";
cache.insert(key, 1, 0);
cache.clear();
expect(cache.retrieve(key, 0, 1)).toBe(null);
expect(cache.retrieve(key, 0, 1)).toBe(undefined);
});
it("should invalidate oldest key to keep cache size under maximum", () => {
@@ -21,7 +21,7 @@ describe("Cache arrays by key", () => {
cache.insert(key1, 2, 4);
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
expect(cache.retrieve(key2, 1, 1)).toEqual(null);
expect(cache.retrieve(key2, 1, 1)).toEqual(undefined);
});
it("should cache and retrieve cached page within boundaries", () => {
@@ -39,7 +39,7 @@ describe("Cache arrays by key", () => {
const key = "key";
cache.insert(key, 0, 0);
cache.insert(key, 1, 1);
expect(cache.retrieve(key, 2, 1)).toEqual(null);
expect(cache.retrieve(key, 2, 1)).toEqual(undefined);
});
it("should not retrieve cached page overlapping boundaries", () => {
@@ -48,7 +48,7 @@ describe("Cache arrays by key", () => {
cache.insert(key, 0, 0);
cache.insert(key, 1, 1);
cache.insert(key, 2, 2);
expect(cache.retrieve(key, 2, 4)).toEqual(null);
expect(cache.retrieve(key, 2, 4)).toEqual(undefined);
});
it("should not insert non-contiguous element", () => {
@@ -57,7 +57,7 @@ describe("Cache arrays by key", () => {
cache.insert(key, 0, 0);
cache.insert(key, 1, 1);
cache.insert(key, 3, 3);
expect(cache.retrieve(key, 3, 1)).toEqual(null);
expect(cache.retrieve(key, 3, 1)).toEqual(undefined);
});
it("should cache multiple keys", () => {

View File

@@ -61,12 +61,12 @@ export class ArraysByKeyCache<T> {
* @param pageSize
*/
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
if (!this.cache.hasOwnProperty(key)) {
return null;
if (!Object.prototype.hasOwnProperty.call(this.cache, key)) {
return undefined;
}
const elements = this.cache[key];
if (startIndex + pageSize > elements.length) {
return null;
return undefined;
}
return elements.slice(startIndex, startIndex + pageSize);

View File

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

View File

@@ -46,9 +46,7 @@ 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,5 +1,5 @@
// /* eslint jsx-a11y/no-static-element-interactions: 0 */
// /* eslint jsx-a11y/click-events-have-key-events: 0 */
/* 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";
@@ -23,7 +23,7 @@ interface DispatchProps {
type Props = ComponentProps & DispatchProps & StateProps;
export class HijackScroll extends React.Component<Props> {
el: HTMLDivElement | null | undefined = undefined;
el: HTMLDivElement | null = null;
scrollIntoViewIfNeeded(prevFocused?: boolean): void {
// Check if the element is being hovered over.
@@ -38,7 +38,6 @@ export class HijackScroll extends React.Component<Props> {
) {
if (this.el && "scrollIntoViewIfNeeded" in this.el) {
// This is only valid in Chrome, WebKit
//eslint-disable-next-line
(this.el as any).scrollIntoViewIfNeeded();
} else if (this.el) {
// Make a best guess effort for older platforms
@@ -47,7 +46,7 @@ export class HijackScroll extends React.Component<Props> {
}
}
componentDidUpdate(prevProps: Props): void {
componentDidUpdate(prevProps: Props) {
this.scrollIntoViewIfNeeded(prevProps.focused);
}
@@ -55,7 +54,7 @@ export class HijackScroll extends React.Component<Props> {
this.scrollIntoViewIfNeeded();
}
render(): JSX.Element {
render() {
return (
<div
onClick={this.props.selectCell}