From 05932e1d383973df4032ca2c2298bda2f3ee0f0f Mon Sep 17 00:00:00 2001 From: Hardikkumar Nai <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 13 Apr 2021 04:36:30 +0530 Subject: [PATCH] Resolve Lint errors in NotificationConsoleComponent.ts (#527) --- .eslintignore | 2 -- .../NotificationConsoleComponent.test.tsx | 14 +++++++------- .../NotificationConsoleComponent.tsx | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1dd185bd2..294903eac 100644 --- a/.eslintignore +++ b/.eslintignore @@ -298,8 +298,6 @@ src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.t src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx src/Explorer/Menus/CommandBar/CommandBarUtil.tsx src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx -src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx -src/Explorer/Menus/NotificationConsole/NotificationConsoleComponentAdapter.tsx src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx diff --git a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx index 692793050..05df0f46f 100644 --- a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx +++ b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx @@ -1,9 +1,9 @@ -import React from "react"; import { shallow } from "enzyme"; +import React from "react"; import { - NotificationConsoleComponentProps, - NotificationConsoleComponent, ConsoleDataType, + NotificationConsoleComponent, + NotificationConsoleComponentProps, } from "./NotificationConsoleComponent"; describe("NotificationConsoleComponent", () => { @@ -12,7 +12,7 @@ describe("NotificationConsoleComponent", () => { consoleData: undefined, isConsoleExpanded: false, inProgressConsoleDataIdToBeDeleted: "", - setIsConsoleExpanded: (isExpanded: boolean): void => {}, + setIsConsoleExpanded: (): void => undefined, }; }; @@ -98,7 +98,7 @@ describe("NotificationConsoleComponent", () => { wrapper.setProps(props); expect(wrapper.find(".notificationConsoleData .date").text()).toEqual(date); expect(wrapper.find(".notificationConsoleData .message").text()).toEqual(message); - expect(wrapper.exists(`.notificationConsoleData .${iconClassName}`)); + expect(wrapper.exists(`.notificationConsoleData .${iconClassName}`)).toBe(true); }; it("renders progress notifications", () => { @@ -139,7 +139,7 @@ describe("NotificationConsoleComponent", () => { wrapper.setProps(props); wrapper.find(".clearNotificationsButton").simulate("click"); - expect(!wrapper.exists(".notificationConsoleData")); + expect(wrapper.exists(".notificationConsoleData")).toBe(true); }); it("collapses and hide content", () => { @@ -155,7 +155,7 @@ describe("NotificationConsoleComponent", () => { wrapper.setProps(props); wrapper.find(".notificationConsoleHeader").simulate("click"); - expect(!wrapper.exists(".notificationConsoleContent")); + expect(wrapper.exists(".notificationConsoleContent")).toBe(false); }); it("display latest data in header", () => { diff --git a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx index 2f4e12f5a..ff7dcfee3 100644 --- a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx +++ b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx @@ -77,7 +77,7 @@ export class NotificationConsoleComponent extends React.Component< public componentDidUpdate( prevProps: NotificationConsoleComponentProps, prevState: NotificationConsoleComponentState - ) { + ): void { const currentHeaderStatus = NotificationConsoleComponent.extractHeaderStatus(this.props.consoleData); if ( @@ -98,7 +98,7 @@ export class NotificationConsoleComponent extends React.Component< } } - public setElememntRef = (element: HTMLElement) => { + public setElememntRef = (element: HTMLElement): void => { this.consoleHeaderElement = element; }; @@ -117,7 +117,7 @@ export class NotificationConsoleComponent extends React.Component< className="notificationConsoleHeader" id="notificationConsoleHeader" ref={this.setElememntRef} - onClick={(event: React.MouseEvent) => this.expandCollapseConsole()} + onClick={() => this.expandCollapseConsole()} onKeyDown={(event: React.KeyboardEvent) => this.onExpandCollapseKeyPress(event)} tabIndex={0} >