From ee3488d3a9a6290881bd6135361dcc7730429142 Mon Sep 17 00:00:00 2001 From: Hardikkumar Nai <80053762+hardiknai-techm@users.noreply.github.com> Date: Mon, 12 Jul 2021 19:25:19 +0530 Subject: [PATCH] Resolve more ESLint (#920) Co-authored-by: Steve Faulkner --- .eslintignore | 2 -- .../EditorNodePropertiesComponent.test.tsx | 11 ++++----- .../EditorNodePropertiesComponent.tsx | 24 +++++++++---------- ...ditorNodePropertiesComponent.test.tsx.snap | 14 +---------- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/.eslintignore b/.eslintignore index ab4b6cfe3..283f2f781 100644 --- a/.eslintignore +++ b/.eslintignore @@ -186,8 +186,6 @@ src/Explorer/Controls/Notebook/NotebookTerminalComponent.test.tsx src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx src/Explorer/Controls/TreeComponent/TreeComponent.tsx -src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx -src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.tsx src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx src/Explorer/Graph/GraphExplorerComponent/GraphVizComponent.tsx diff --git a/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx b/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx index c8bd96c47..55d954f33 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx @@ -1,12 +1,11 @@ -import React from "react"; import { shallow } from "enzyme"; -import { GraphHighlightedNodeData, EditedProperties } from "./GraphExplorer"; - +import React from "react"; import { EditorNodePropertiesComponent, EditorNodePropertiesComponentProps } from "./EditorNodePropertiesComponent"; describe("", () => { // Tests that: single value prop is rendered with a textbox and a delete button // multi-value prop only a delete button (cannot be edited) + const onUpdateProperties = jest.fn(); it("renders component", () => { const props: EditorNodePropertiesComponentProps = { editedProperties: { @@ -24,7 +23,6 @@ describe("", () => { { value: true, type: "boolean" }, { value: false, type: "boolean" }, { value: undefined, type: "null" }, - { value: null, type: "null" }, ], }, ], @@ -41,14 +39,13 @@ describe("", () => { { value: true, type: "boolean" }, { value: false, type: "boolean" }, { value: undefined, type: "null" }, - { value: null, type: "null" }, ], }, ], addedProperties: [], droppedKeys: [], }, - onUpdateProperties: (editedProperties: EditedProperties): void => {}, + onUpdateProperties, }; const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); @@ -81,7 +78,7 @@ describe("", () => { addedProperties: [], droppedKeys: [], }, - onUpdateProperties: (editedProperties: EditedProperties): void => {}, + onUpdateProperties, }; const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); diff --git a/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.tsx b/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.tsx index eadf9ee36..271c90ba9 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.tsx @@ -4,12 +4,12 @@ */ import * as React from "react"; -import * as ViewModels from "../../../Contracts/ViewModels"; -import { EditedProperties } from "./GraphExplorer"; -import DeleteIcon from "../../../../images/delete.svg"; import AddIcon from "../../../../images/Add-property.svg"; -import { ReadOnlyNodePropertiesComponent } from "./ReadOnlyNodePropertiesComponent"; +import DeleteIcon from "../../../../images/delete.svg"; +import * as ViewModels from "../../../Contracts/ViewModels"; import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement"; +import { EditedProperties } from "./GraphExplorer"; +import { ReadOnlyNodePropertiesComponent } from "./ReadOnlyNodePropertiesComponent"; export interface EditorNodePropertiesComponentProps { editedProperties: EditedProperties; @@ -48,7 +48,7 @@ export class EditorNodePropertiesComponent extends React.Component { singleValue.type = e.target.value as ViewModels.InputPropertyValueTypeString; if (singleValue.type === "null") { - singleValue.value = null; + singleValue.value = undefined; } this.props.onUpdateProperties(this.props.editedProperties); }} @@ -144,7 +144,7 @@ export class EditorNodePropertiesComponent extends React.Component this.removeExistingProperty(key)} + onActivated={() => this.removeExistingProperty(key)} > Delete @@ -166,7 +166,7 @@ export class EditorNodePropertiesComponent extends React.Component this.removeExistingProperty(nodeProp.key)} + onActivated={() => this.removeExistingProperty(nodeProp.key)} > Delete @@ -206,7 +206,7 @@ export class EditorNodePropertiesComponent extends React.Component { firstValue.value = e.target.value; if (firstValue.type === "null") { - firstValue.value = null; + firstValue.value = undefined; } this.props.onUpdateProperties(this.props.editedProperties); }} @@ -235,7 +235,7 @@ export class EditorNodePropertiesComponent extends React.Component this.removeAddedProperty(index)} + onActivated={() => this.removeAddedProperty(index)} > Delete diff --git a/src/Explorer/Graph/GraphExplorerComponent/__snapshots__/EditorNodePropertiesComponent.test.tsx.snap b/src/Explorer/Graph/GraphExplorerComponent/__snapshots__/EditorNodePropertiesComponent.test.tsx.snap index db74f2279..adffe505b 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/__snapshots__/EditorNodePropertiesComponent.test.tsx.snap +++ b/src/Explorer/Graph/GraphExplorerComponent/__snapshots__/EditorNodePropertiesComponent.test.tsx.snap @@ -37,7 +37,7 @@ exports[` renders component 1`] = `
renders component 1`] = ` > undefined
-
- null -
renders component 1`] = ` > undefined -
- null -