From 5b08ae2829b20b59ea23452ca0522b2d192045a5 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Thu, 4 Apr 2024 12:46:32 -0700 Subject: [PATCH] chore: fix minor lint issues --- src/data/configureStore.ts | 1 + src/edx-frontend-missing-types.d.ts | 2 ++ src/head/Head.tsx | 27 +++++++++++++-------------- src/profile/ProfilePage.test.jsx | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/data/configureStore.ts b/src/data/configureStore.ts index 69403fbbf..54dd9bbe7 100644 --- a/src/data/configureStore.ts +++ b/src/data/configureStore.ts @@ -14,6 +14,7 @@ function composeMiddleware() { if (getConfig().ENVIRONMENT === 'development') { const loggerMiddleware = createLogger({ collapsed: true, + // eslint-disable-next-line @typescript-eslint/no-explicit-any }) as any; // TODO: why is this type not accepted? return composeWithDevTools(applyMiddleware(thunkMiddleware, sagaMiddleware, loggerMiddleware)); } diff --git a/src/edx-frontend-missing-types.d.ts b/src/edx-frontend-missing-types.d.ts index 18015be84..3f0f81677 100644 --- a/src/edx-frontend-missing-types.d.ts +++ b/src/edx-frontend-missing-types.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ // Declare some very minimal types for @edx packages that don't have types declare module '@edx/frontend-platform' { const APP_INIT_ERROR: string; @@ -19,6 +20,7 @@ declare module '@edx/frontend-platform/i18n' { injectIntl, intlShape, defineMessages, + IntlProvider, } from 'react-intl'; } diff --git a/src/head/Head.tsx b/src/head/Head.tsx index ac78fcf3f..2c8dd79dd 100644 --- a/src/head/Head.tsx +++ b/src/head/Head.tsx @@ -1,20 +1,19 @@ import { Helmet } from 'react-helmet'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useIntl } from '@edx/frontend-platform/i18n'; import { getConfig } from '@edx/frontend-platform'; import messages from './messages'; -const Head = ({ intl }) => ( - - - {intl.formatMessage(messages['profile.page.title'], { siteName: getConfig().SITE_NAME })} - - - -); +const Head = () => { + const intl = useIntl(); + return ( + + + {intl.formatMessage(messages['profile.page.title'], { siteName: getConfig().SITE_NAME })} + + + + ); +} -Head.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(Head); +export default Head; diff --git a/src/profile/ProfilePage.test.jsx b/src/profile/ProfilePage.test.jsx index 997a92e86..1b5c8dab3 100644 --- a/src/profile/ProfilePage.test.jsx +++ b/src/profile/ProfilePage.test.jsx @@ -32,7 +32,7 @@ const requiredProfilePageProps = { }; // Mock language cookie -Object.defineProperty(global.document, 'cookie', { +Object.defineProperty(globalThis.document, 'cookie', { writable: true, value: `${getConfig().LANGUAGE_PREFERENCE_COOKIE_NAME}=en`, });