From 2cff6927c6e48033545370facf0c0af699ef8e30 Mon Sep 17 00:00:00 2001 From: Dan Labrecque Date: Thu, 23 Feb 2023 21:43:30 -0500 Subject: [PATCH 1/2] Fix hasFilters reference --- src/routes/views/components/dataToolbar/dataToolbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/views/components/dataToolbar/dataToolbar.tsx b/src/routes/views/components/dataToolbar/dataToolbar.tsx index e3c9db9a2..f5229df2d 100644 --- a/src/routes/views/components/dataToolbar/dataToolbar.tsx +++ b/src/routes/views/components/dataToolbar/dataToolbar.tsx @@ -910,7 +910,7 @@ export class DataToolbarBase extends React.Component { showToolbarItem={currentCategory === tagKey && currentTagKey === tagKeyOption.key} > Date: Thu, 23 Feb 2023 21:43:56 -0500 Subject: [PATCH 2/2] Add react-hooks plugin for lint --- .eslintrc.json | 4 +++- src/components/pageTitle/pageTitle.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2f6fe2f84..27c826549 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,7 +18,8 @@ "@redhat-cloud-services/eslint-config-redhat-cloud-services", "eslint:recommended", "plugin:@typescript-eslint/recommended", - "plugin:react/recommended" + "plugin:react/recommended", + "plugin:react-hooks/recommended" ], "parserOptions": { // "project": ["./tsconfig.json"], @@ -128,6 +129,7 @@ "error", "as-needed" ], + "react-hooks/exhaustive-deps": 0, // "warn", "react/display-name": 0, "react/no-unescaped-entities": ["error", { "forbid": [">", "}"]}], "react/no-unknown-property": ["error", { "ignore": ["key"]}], diff --git a/src/components/pageTitle/pageTitle.tsx b/src/components/pageTitle/pageTitle.tsx index 3754367c6..897bf5748 100644 --- a/src/components/pageTitle/pageTitle.tsx +++ b/src/components/pageTitle/pageTitle.tsx @@ -12,7 +12,7 @@ interface PageTitleOwnProps { type PageTitleProps = PageTitleOwnProps & WrappedComponentProps; const PageTitleBase: React.FC = ({ children = null, intl }) => { - const getPageTitle = () => { + const usePageTitle = () => { const pathname = usePathname(); switch (pathname) { case formatPath(routes.explorer.path): @@ -25,7 +25,7 @@ const PageTitleBase: React.FC = ({ children = null, intl }) => { }; // Set page title - document.title = intl.formatMessage(getPageTitle()); + document.title = intl.formatMessage(usePageTitle()); return <>{children}; };