From 640d8a9c6b017fb3418465bd44c88934c6674924 Mon Sep 17 00:00:00 2001 From: Subhajit Ghosh Date: Fri, 8 Mar 2024 12:38:46 +0530 Subject: [PATCH 1/2] Fixed eslint issue apart from type checking --- bundle.js | 2 +- nightwatch/utils/TestGlobalContextProvider.tsx | 2 +- src/components/EnvironmentDropdown/index.tsx | 2 +- src/components/Separator/index.tsx | 2 +- src/components/TestDetailsView/index.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundle.js b/bundle.js index adc76d0..89e8885 100644 --- a/bundle.js +++ b/bundle.js @@ -19,7 +19,7 @@ export function bundle() { name: 'nightwatch-bundle', apply: 'serve', transformIndexHtml: { - transform(html, _ctx) { + transform(html) { const reportData = readFileSync(sampleReportPath, { encoding: 'utf8' }); return html + ``; } diff --git a/nightwatch/utils/TestGlobalContextProvider.tsx b/nightwatch/utils/TestGlobalContextProvider.tsx index 80311b5..59bc9af 100644 --- a/nightwatch/utils/TestGlobalContextProvider.tsx +++ b/nightwatch/utils/TestGlobalContextProvider.tsx @@ -3,7 +3,7 @@ import { GlobalContext } from '../../src/contexts/GlobalContext'; type GlobalContextProps = { children: ReactNode; - value: any; + value: unknown; }; export const GlobalContextProvider: React.FC = ({ children, value }) => { diff --git a/src/components/EnvironmentDropdown/index.tsx b/src/components/EnvironmentDropdown/index.tsx index 0703d8b..87c7c3a 100644 --- a/src/components/EnvironmentDropdown/index.tsx +++ b/src/components/EnvironmentDropdown/index.tsx @@ -37,7 +37,7 @@ const EnvironmentDropdown: React.FC = () => { setEnvData(data); } }); - }, [environmentName]); + }, [envDropdownData,environmentName]); return ( setDropdownOpen(open)}> diff --git a/src/components/Separator/index.tsx b/src/components/Separator/index.tsx index 44a549d..7cb3c49 100644 --- a/src/components/Separator/index.tsx +++ b/src/components/Separator/index.tsx @@ -1,4 +1,4 @@ -import styled, { css } from 'styled-components'; +import styled from 'styled-components'; type SeparatorProps = { borderColor?: string; diff --git a/src/components/TestDetailsView/index.tsx b/src/components/TestDetailsView/index.tsx index c85e1bd..085a02a 100644 --- a/src/components/TestDetailsView/index.tsx +++ b/src/components/TestDetailsView/index.tsx @@ -26,7 +26,7 @@ const TestDetailsView: React.FC = ({ testStepsData, traceP const { snapshotFilePath, snapshotUrl } = traceObject; setTrace({ url: snapshotUrl, snapshotPath: snapshotFilePath }); } - }, [filterTestSteps]); + }, [filteredTestsSteps]); return ( From ec39d69814c8e08d8a09f580496ec305353aa838 Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Thu, 21 Mar 2024 17:49:58 -0700 Subject: [PATCH 2/2] add eslint rule to remove any warnings and fix index.ts to remove null warnings --- .eslintrc.json | 3 ++- src/components/TestDetailsView/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 73c86e0..608c182 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -27,6 +27,7 @@ }, "rules": { "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn" + "react-hooks/exhaustive-deps": "warn", + "@typescript-eslint/no-explicit-any": "off" } } diff --git a/src/components/TestDetailsView/index.tsx b/src/components/TestDetailsView/index.tsx index 085a02a..73de791 100644 --- a/src/components/TestDetailsView/index.tsx +++ b/src/components/TestDetailsView/index.tsx @@ -50,7 +50,7 @@ const TestDetailsView: React.FC = ({ testStepsData, traceP active={index === activeTestStep && !!test.domSnapshot} setActiveTestStep={setActiveTestStep} setTrace={setTrace}> - {`${test.name}${validTestArgs(test.args) ? `('${joinArgs(test.args!)}')` : ''}`} + {`${test.name}${validTestArgs(test.args) ? `('${joinArgs(test.args)}')` : ''}`} ); } @@ -70,7 +70,7 @@ const TestDetailsView: React.FC = ({ testStepsData, traceP setActiveTestStep={setActiveTestStep} setTrace={setTrace} tracePresent={tracePresent}> - {`${test.name}${validTestArgs(test.args) ? `('${joinArgs(test.args!)}')` : ''}`} + {`${test.name}${validTestArgs(test.args) ? `('${joinArgs(test.args)}')` : ''}`} ); }