diff --git a/.eslintrc.js b/.eslintrc.js index 0ad3cfe59b6..19d288c00ba 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -60,6 +60,12 @@ module.exports = { 'linebreak-style': process.platform === 'win32' ? 'off' : ['error', 'unix'], 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', + 'import/no-import-module-exports': [ + 'error', + { + exceptions: ['**/*/startServer.js'], + }, + ], 'import/no-extraneous-dependencies': [ 'off', { @@ -97,6 +103,14 @@ module.exports = { // adds support for type, interface and enum declarations https://typescript-eslint.io/rules/no-use-before-define/#how-to-use 'no-use-before-define': 'off', '@typescript-eslint/no-use-before-define': ['error'], + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], 'react/require-default-props': 'off', 'react/no-unused-prop-types': 'off', }, diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 62f7b891b17..09643d007c8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,9 +15,6 @@ updates: update-types: ['version-update:semver-major'] - dependency-name: '@typescript-eslint/eslint-plugin' update-types: ['version-update:semver-major'] - # https://jira.dev.bbc.co.uk/browse/WSTEAMA-1545 - Upgrade eslint-config-airbnb to the latest version - - dependency-name: eslint-config-airbnb - update-types: ['version-update:semver-major'] # https://jira.dev.bbc.co.uk/browse/NEWSWORLDSERVICE-2186: Latest version of Emotion contains a memory leak that needs resolved: https://github.com/emotion-js/emotion/issues/3221 - dependency-name: '@emotion/*' # Opera Mini unsupported packages diff --git a/.yarn/cache/@esbuild-darwin-arm64-npm-0.24.0-f33b2ff14e-10.zip b/.yarn/cache/@esbuild-darwin-arm64-npm-0.24.0-f33b2ff14e-10.zip deleted file mode 100644 index c85bd140940..00000000000 Binary files a/.yarn/cache/@esbuild-darwin-arm64-npm-0.24.0-f33b2ff14e-10.zip and /dev/null differ diff --git a/.yarn/cache/@esbuild-linux-x64-npm-0.24.0-744e76a7ed-10.zip b/.yarn/cache/@esbuild-linux-x64-npm-0.24.0-744e76a7ed-10.zip new file mode 100644 index 00000000000..cbb5afdf05f Binary files /dev/null and b/.yarn/cache/@esbuild-linux-x64-npm-0.24.0-744e76a7ed-10.zip differ diff --git a/.yarn/cache/@img-sharp-darwin-arm64-npm-0.33.5-c319591c53-10.zip b/.yarn/cache/@img-sharp-darwin-arm64-npm-0.33.5-c319591c53-10.zip deleted file mode 100644 index 2528a01baac..00000000000 Binary files a/.yarn/cache/@img-sharp-darwin-arm64-npm-0.33.5-c319591c53-10.zip and /dev/null differ diff --git a/.yarn/cache/@img-sharp-libvips-darwin-arm64-npm-1.0.4-d0d063884a-10.zip b/.yarn/cache/@img-sharp-libvips-darwin-arm64-npm-1.0.4-d0d063884a-10.zip deleted file mode 100644 index 6b3340399d0..00000000000 Binary files a/.yarn/cache/@img-sharp-libvips-darwin-arm64-npm-1.0.4-d0d063884a-10.zip and /dev/null differ diff --git a/.yarn/cache/@img-sharp-libvips-linux-x64-npm-1.0.4-0974f077b7-10.zip b/.yarn/cache/@img-sharp-libvips-linux-x64-npm-1.0.4-0974f077b7-10.zip new file mode 100644 index 00000000000..a4a5824aa57 Binary files /dev/null and b/.yarn/cache/@img-sharp-libvips-linux-x64-npm-1.0.4-0974f077b7-10.zip differ diff --git a/.yarn/cache/@img-sharp-linux-x64-npm-0.33.5-1b6c430eb4-10.zip b/.yarn/cache/@img-sharp-linux-x64-npm-0.33.5-1b6c430eb4-10.zip new file mode 100644 index 00000000000..fd9356ce5d3 Binary files /dev/null and b/.yarn/cache/@img-sharp-linux-x64-npm-0.33.5-1b6c430eb4-10.zip differ diff --git a/.yarn/cache/@next-swc-darwin-arm64-npm-15.1.5-8aadf4de48-10.zip b/.yarn/cache/@next-swc-darwin-arm64-npm-15.1.5-8aadf4de48-10.zip deleted file mode 100644 index 7f5eb739d2b..00000000000 Binary files a/.yarn/cache/@next-swc-darwin-arm64-npm-15.1.5-8aadf4de48-10.zip and /dev/null differ diff --git a/.yarn/cache/eslint-config-airbnb-base-npm-14.2.1-50131c00fb-0d679b6fe8.zip b/.yarn/cache/eslint-config-airbnb-base-npm-14.2.1-50131c00fb-0d679b6fe8.zip deleted file mode 100644 index 25d507b8887..00000000000 Binary files a/.yarn/cache/eslint-config-airbnb-base-npm-14.2.1-50131c00fb-0d679b6fe8.zip and /dev/null differ diff --git a/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-daa68a1dcb.zip b/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-daa68a1dcb.zip new file mode 100644 index 00000000000..18cd421b379 Binary files /dev/null and b/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-daa68a1dcb.zip differ diff --git a/.yarn/cache/eslint-config-airbnb-npm-18.2.1-19125926b3-0f251b0512.zip b/.yarn/cache/eslint-config-airbnb-npm-18.2.1-19125926b3-0f251b0512.zip deleted file mode 100644 index c1f22391569..00000000000 Binary files a/.yarn/cache/eslint-config-airbnb-npm-18.2.1-19125926b3-0f251b0512.zip and /dev/null differ diff --git a/.yarn/cache/eslint-config-airbnb-npm-19.0.4-a73150c84a-f2086523cf.zip b/.yarn/cache/eslint-config-airbnb-npm-19.0.4-a73150c84a-f2086523cf.zip new file mode 100644 index 00000000000..67c211412a9 Binary files /dev/null and b/.yarn/cache/eslint-config-airbnb-npm-19.0.4-a73150c84a-f2086523cf.zip differ diff --git a/.yarn/cache/fsevents-patch-6b67494872-10.zip b/.yarn/cache/fsevents-patch-6b67494872-10.zip deleted file mode 100644 index 9887ada72d9..00000000000 Binary files a/.yarn/cache/fsevents-patch-6b67494872-10.zip and /dev/null differ diff --git a/cypress/support/helpers/ampOnlyServices.js b/cypress/support/helpers/ampOnlyServices.js index df8612f50e1..bdcce005d1c 100644 --- a/cypress/support/helpers/ampOnlyServices.js +++ b/cypress/support/helpers/ampOnlyServices.js @@ -1,2 +1,2 @@ const ampOnlyServices = ['news', 'sport', 'newsround']; -export { ampOnlyServices as default }; +export default ampOnlyServices; diff --git a/package.json b/package.json index 4b4e0233a2f..c2b4b40cce0 100644 --- a/package.json +++ b/package.json @@ -213,7 +213,7 @@ "cypress-terminal-report": "7.1.0", "depcheck": "1.4.7", "eslint": "7.32.0", - "eslint-config-airbnb": "18.2.1", + "eslint-config-airbnb": "19.0.4", "eslint-config-prettier": "10.0.1", "eslint-import-resolver-alias": "1.1.2", "eslint-plugin-cypress": "4.1.0", diff --git a/src/app/components/ATIAnalytics/params/index.ts b/src/app/components/ATIAnalytics/params/index.ts index 4d3c1ee3e40..19624ac6e2a 100644 --- a/src/app/components/ATIAnalytics/params/index.ts +++ b/src/app/components/ATIAnalytics/params/index.ts @@ -121,7 +121,7 @@ type BuilderFunction = { }; type PageTypeHandlers = { - [key in PageTypes]: BuilderFunction; + [_key in PageTypes]: BuilderFunction; }; const isMigrated = (pageType: PageTypes) => diff --git a/src/app/components/Ad/Amp/AdSlot/index.tsx b/src/app/components/Ad/Amp/AdSlot/index.tsx index f5188aedeb1..ff0d851b6bd 100644 --- a/src/app/components/Ad/Amp/AdSlot/index.tsx +++ b/src/app/components/Ad/Amp/AdSlot/index.tsx @@ -68,8 +68,8 @@ interface DeviceSettings { } const slotConfigurations: { - [slot in SlotType]: { - [device in Device]?: DeviceSettings; + [_slot in SlotType]: { + [_device in Device]?: DeviceSettings; }; } = { leaderboard: { diff --git a/src/app/components/Billboard/index.styles.ts b/src/app/components/Billboard/index.styles.ts index 9d0e8f27933..f37508b797e 100644 --- a/src/app/components/Billboard/index.styles.ts +++ b/src/app/components/Billboard/index.styles.ts @@ -5,6 +5,7 @@ export default { link: ({ palette }: Theme) => css({ textDecoration: 'none', + display: 'block', color: palette.WHITE, cursor: 'pointer', '&:hover, &:focus': { diff --git a/src/app/components/Billboard/index.tsx b/src/app/components/Billboard/index.tsx index aa55dc86750..d83ab0a56bd 100644 --- a/src/app/components/Billboard/index.tsx +++ b/src/app/components/Billboard/index.tsx @@ -53,12 +53,7 @@ const Billboard = forwardRef( />
- + {showLiveLabel ? (
s?.charAt(0).toUpperCase() + s?.slice(1); +const capitalize = (s = '') => `${s?.charAt(0).toUpperCase()}${s?.slice(1)}`; const buildSectionArr = (service: Services, value: string, type: string) => [ `${capitalize(service)} - ${value}`, diff --git a/src/app/components/Curation/CurationPromo/index.tsx b/src/app/components/Curation/CurationPromo/index.tsx index 99479edad32..62757c3efce 100644 --- a/src/app/components/Curation/CurationPromo/index.tsx +++ b/src/app/components/Curation/CurationPromo/index.tsx @@ -55,11 +55,7 @@ const CurationPromo = ({ {isMedia ? ( - + {typeTranslated} @@ -71,7 +67,7 @@ const CurationPromo = ({ ) : ( - + {isLive ? {title} : title} )} diff --git a/src/app/components/Curation/HierarchicalGrid/index.tsx b/src/app/components/Curation/HierarchicalGrid/index.tsx index 9490de1711b..53506038d7b 100644 --- a/src/app/components/Curation/HierarchicalGrid/index.tsx +++ b/src/app/components/Curation/HierarchicalGrid/index.tsx @@ -107,11 +107,7 @@ const HiearchicalGrid = ({ })} > {isMedia ? ( - + {typeTranslated} @@ -125,10 +121,7 @@ const HiearchicalGrid = ({ ) : ( - + {isLive ? ( { it('with no attributes', () => { - const { getByText } = render(); + const { getByText } = render(); expect(getByText('HELLOWORLD').textContent).toEqual('HELLOWORLD'); }); it('with bold attributes', () => { const { container } = render( - , + , ); expect(container.querySelector('b')?.textContent).toEqual('BOLD TEXT'); @@ -19,7 +19,7 @@ describe('Fragment', () => { it('with italic attributes', () => { const { container } = render( - , + , ); expect(container.querySelector('i')?.textContent).toEqual('ITALIC TEXT'); @@ -27,7 +27,7 @@ describe('Fragment', () => { it('with unknown attributes', () => { const { container } = render( - , @@ -40,7 +40,7 @@ describe('Fragment', () => { it('with italic attributes in Farsi', () => { const { container } = render( - , @@ -54,7 +54,7 @@ describe('Fragment', () => { }); it('should emit a null when provided with no content', () => { - const { container } = render(); + const { container } = render(); expect(container.querySelector('div')).toBe(null); }); diff --git a/src/app/components/Fragment/index.tsx b/src/app/components/Fragment/index.tsx index da6fc472d15..3de91020bf3 100644 --- a/src/app/components/Fragment/index.tsx +++ b/src/app/components/Fragment/index.tsx @@ -1,7 +1,6 @@ /** @jsxRuntime classic */ /** @jsx jsx */ -/* @jsxFrag React.Fragment */ -import React, { PropsWithChildren } from 'react'; +import { PropsWithChildren } from 'react'; import { jsx } from '@emotion/react'; import styles from './index.style'; @@ -25,14 +24,17 @@ const Fragment = ({ text, attributes = [] }: FragmentProps) => { These components are nested inside each other as children as the array is iterated through. The text string is passed in as the initial value, so it is the first child or the returned value if there are no attributes. */ - return attributes.reduce( - (previousAttribute, attribute) => { - const Attribute = - attributeComponents[attribute as keyof typeof attributeComponents] || - fallbackAttributeComponent; // If attribute is unknown, will use a fallback component that just returns the passed children - return {previousAttribute}; - }, - <>{text}, + return ( + attributes.reduce( + // @ts-expect-error attribute will be of type string + (previousAttribute, attribute) => { + const Attribute = + attributeComponents[attribute as keyof typeof attributeComponents] || + fallbackAttributeComponent; // If attribute is unknown, will use a fallback component that just returns the passed children + return {previousAttribute}; + }, + text, + ) || '' ); }; diff --git a/src/app/components/LiveHeaderMedia/index.tsx b/src/app/components/LiveHeaderMedia/index.tsx index 00827af0835..38ad3280acc 100644 --- a/src/app/components/LiveHeaderMedia/index.tsx +++ b/src/app/components/LiveHeaderMedia/index.tsx @@ -113,30 +113,26 @@ const LiveHeaderMedia = ({ }; const description = ( - <> - - {showMedia && {closeVideo}, } - - {short} - {!titleHasPunctuation && ','} - - - {' '} - {networkName} - + + {showMedia && {closeVideo}, } + + {short} + {!titleHasPunctuation && ','} - + + {' '} + {networkName} + + ); return ( diff --git a/src/app/components/LiveRegion/LiveRegionContext/index.tsx b/src/app/components/LiveRegion/LiveRegionContext/index.tsx index 034ce9dc803..f53ded64ddd 100644 --- a/src/app/components/LiveRegion/LiveRegionContext/index.tsx +++ b/src/app/components/LiveRegion/LiveRegionContext/index.tsx @@ -2,6 +2,7 @@ import React, { PropsWithChildren, createContext, useContext, + useMemo, useState, } from 'react'; @@ -19,13 +20,16 @@ export const LiveRegionContextProvider = ({ children }: PropsWithChildren) => { setLiveRegionItem(item); }; + const memoisedLiveRegion = useMemo( + () => ({ + liveRegionItem, + replaceLiveRegionWith, + }), + [liveRegionItem], + ); + return ( - + {children} ); diff --git a/src/app/components/MediaLoader/configs/clipMedia.ts b/src/app/components/MediaLoader/configs/clipMedia.ts index c255fc4620c..060c9b6848c 100644 --- a/src/app/components/MediaLoader/configs/clipMedia.ts +++ b/src/app/components/MediaLoader/configs/clipMedia.ts @@ -30,7 +30,7 @@ export default ({ 'clipMedia', ); - const { images, video, type } = clipMediaBlock?.model; + const { images, video, type } = clipMediaBlock?.model || {}; const { source, urlTemplate: locator } = images?.[1] ?? {}; diff --git a/src/app/components/MediaLoader/configs/index.ts b/src/app/components/MediaLoader/configs/index.ts index 03177371623..91dac17d78f 100644 --- a/src/app/components/MediaLoader/configs/index.ts +++ b/src/app/components/MediaLoader/configs/index.ts @@ -25,7 +25,7 @@ const BLOCK_TYPES = [ const blockTypeMapping: Record< (typeof BLOCK_TYPES)[number], - (arg0: ConfigBuilderProps) => ConfigBuilderReturnProps + (_arg0: ConfigBuilderProps) => ConfigBuilderReturnProps > = { aresMedia, clipMedia, diff --git a/src/app/components/Metadata/index.tsx b/src/app/components/Metadata/index.tsx index 646ac34754a..897362ee250 100644 --- a/src/app/components/Metadata/index.tsx +++ b/src/app/components/Metadata/index.tsx @@ -167,6 +167,7 @@ const MetadataContainer = ({ {isoLang && !isEnglishService && alternateLinksWsSites.map(renderAlternateLinks)} + {/* eslint-disable-next-line react/no-invalid-html-attribute */} {linkToAmpPage && } {renderAppleItunesApp({ iTunesAppId, diff --git a/src/app/components/MostRead/Amp/__snapshots__/index.test.tsx.snap b/src/app/components/MostRead/Amp/__snapshots__/index.test.tsx.snap index 4f905dfb623..960161f3e20 100644 --- a/src/app/components/MostRead/Amp/__snapshots__/index.test.tsx.snap +++ b/src/app/components/MostRead/Amp/__snapshots__/index.test.tsx.snap @@ -164,7 +164,7 @@ exports[`AmpMostRead should render as expected 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -265,7 +265,7 @@ exports[`AmpMostRead should render as expected 1`] = ` dir="ltr" > {{title}} diff --git a/src/app/components/MostRead/Canonical/Item/__snapshots__/index.test.tsx.snap b/src/app/components/MostRead/Canonical/Item/__snapshots__/index.test.tsx.snap index 5aeaf767868..dece06f2b07 100644 --- a/src/app/components/MostRead/Canonical/Item/__snapshots__/index.test.tsx.snap +++ b/src/app/components/MostRead/Canonical/Item/__snapshots__/index.test.tsx.snap @@ -208,7 +208,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -508,7 +508,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -539,7 +539,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -570,7 +570,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -601,7 +601,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -632,7 +632,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -663,7 +663,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -694,7 +694,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -725,7 +725,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -756,7 +756,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -787,7 +787,7 @@ exports[`MostReadItemWrapper should render ltr correctly with 10 items 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -1006,7 +1006,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1306,7 +1306,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1337,7 +1337,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1368,7 +1368,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1399,7 +1399,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1430,7 +1430,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1461,7 +1461,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1492,7 +1492,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1523,7 +1523,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1554,7 +1554,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1585,7 +1585,7 @@ exports[`MostReadItemWrapper should render rtl correctly with 10 items 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1619,7 +1619,7 @@ exports[`MostReadLink should render ltr correctly 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1681,7 +1681,7 @@ exports[`MostReadLink should render ltr correctly 1`] = ` dir="ltr" > Tins you need to know about Babcock University @@ -1713,7 +1713,7 @@ exports[`MostReadLink should render rtl correctly 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1775,7 +1775,7 @@ exports[`MostReadLink should render rtl correctly 1`] = ` dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -1807,7 +1807,7 @@ exports[`MostReadLink should render with last updated date correctly 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1897,7 +1897,7 @@ exports[`MostReadLink should render with last updated date correctly 1`] = ` dir="ltr" > Tins you need to know about Babcock University diff --git a/src/app/components/MostRead/Canonical/Item/index.styles.ts b/src/app/components/MostRead/Canonical/Item/index.styles.ts index d82493cc2c7..0e6214a5989 100644 --- a/src/app/components/MostRead/Canonical/Item/index.styles.ts +++ b/src/app/components/MostRead/Canonical/Item/index.styles.ts @@ -2,7 +2,7 @@ import { css, Theme } from '@emotion/react'; import { grid } from '../../../../legacy/psammead/psammead-styles/src/detection'; const styles = { - link: ({ spacings, palette, fontSizes, fontVariants }: Theme) => + link: ({ palette, fontSizes, fontVariants }: Theme) => css({ ...fontSizes.pica, ...fontVariants.serifMedium, @@ -10,7 +10,7 @@ const styles = { position: 'static', color: palette.EBON, textDecoration: 'none', - marginBottom: `${spacings.FULL}rem`, + display: 'inline-block', '&:hover, &:focus': { textDecoration: 'underline', diff --git a/src/app/components/MostRead/Canonical/Item/index.tsx b/src/app/components/MostRead/Canonical/Item/index.tsx index f85ef329874..9b993182848 100755 --- a/src/app/components/MostRead/Canonical/Item/index.tsx +++ b/src/app/components/MostRead/Canonical/Item/index.tsx @@ -54,7 +54,6 @@ export const MostReadLink = ({ css={[styles.link, size === 'default' && styles.defaultLink]} href={href} onClick={clickTrackerHandler} - className="focusIndicatorDisplayTableCell" > {title} diff --git a/src/app/components/MostRead/Canonical/List/__snapshots__/index.test.tsx.snap b/src/app/components/MostRead/Canonical/List/__snapshots__/index.test.tsx.snap index cf68edc141e..2bf0c17cd08 100644 --- a/src/app/components/MostRead/Canonical/List/__snapshots__/index.test.tsx.snap +++ b/src/app/components/MostRead/Canonical/List/__snapshots__/index.test.tsx.snap @@ -273,7 +273,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -358,7 +358,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -389,7 +389,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -420,7 +420,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -451,7 +451,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -482,7 +482,7 @@ exports[`MostReadList should render burmese most read with a one column layout 1 dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -779,7 +779,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1084,7 +1084,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1115,7 +1115,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1146,7 +1146,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1177,7 +1177,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1208,7 +1208,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1239,7 +1239,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1270,7 +1270,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1301,7 +1301,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1332,7 +1332,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1363,7 +1363,7 @@ exports[`MostReadList should render with ltr bengali items with correct dir 1`] dir="ltr" > ভিসা ফুরিয়ে যাওয়ায় ক্রিকেটার সাইফের জরিমানা @@ -1648,7 +1648,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -1953,7 +1953,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -1984,7 +1984,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2015,7 +2015,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2046,7 +2046,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2077,7 +2077,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2108,7 +2108,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2139,7 +2139,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2170,7 +2170,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2201,7 +2201,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2232,7 +2232,7 @@ exports[`MostReadList should render with ltr burmese items with correct dir 1`] dir="ltr" > အောက်စဖို့ဒ် ဆရာတော် ပါမောက္ခ ဒေါက်တာအရှင်ဓမ္မသာမိ @@ -2449,7 +2449,7 @@ exports[`MostReadList should render with ltr news items with a max of one column color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -2534,7 +2534,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2565,7 +2565,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2596,7 +2596,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2627,7 +2627,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2658,7 +2658,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2689,7 +2689,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2720,7 +2720,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2751,7 +2751,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2782,7 +2782,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -2813,7 +2813,7 @@ exports[`MostReadList should render with ltr news items with a max of one column dir="ltr" > Could a computer ever create better art than a human? @@ -3098,7 +3098,7 @@ exports[`MostReadList should render with ltr news items with a max of two column color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -3297,7 +3297,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3328,7 +3328,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3359,7 +3359,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3390,7 +3390,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3421,7 +3421,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3452,7 +3452,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3483,7 +3483,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3514,7 +3514,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3545,7 +3545,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3576,7 +3576,7 @@ exports[`MostReadList should render with ltr news items with a max of two column dir="ltr" > Could a computer ever create better art than a human? @@ -3873,7 +3873,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -4178,7 +4178,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4209,7 +4209,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4240,7 +4240,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4271,7 +4271,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4302,7 +4302,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4333,7 +4333,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4364,7 +4364,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4395,7 +4395,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4426,7 +4426,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4457,7 +4457,7 @@ exports[`MostReadList should render with ltr news items with a multi column layo dir="ltr" > Could a computer ever create better art than a human? @@ -4754,7 +4754,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -5059,7 +5059,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5090,7 +5090,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5121,7 +5121,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5152,7 +5152,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5183,7 +5183,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5214,7 +5214,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5245,7 +5245,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5276,7 +5276,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5307,7 +5307,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5338,7 +5338,7 @@ exports[`MostReadList should render with ltr news items with correct dir 1`] = ` dir="ltr" > Could a computer ever create better art than a human? @@ -5635,7 +5635,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -5940,7 +5940,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -5971,7 +5971,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6002,7 +6002,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6033,7 +6033,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6064,7 +6064,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6095,7 +6095,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6126,7 +6126,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6157,7 +6157,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6188,7 +6188,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد @@ -6219,7 +6219,7 @@ exports[`MostReadList should render with rtl persian items with correct dir 1`] dir="rtl" > در این جشنواره برای نخستین بار از کارگران افغانستان در شهر تهران تقدیر شد diff --git a/src/app/legacy/components/Promo/a.jsx b/src/app/legacy/components/Promo/a.jsx index c7f39456c2a..83922ee9d05 100644 --- a/src/app/legacy/components/Promo/a.jsx +++ b/src/app/legacy/components/Promo/a.jsx @@ -3,6 +3,7 @@ import styled from '@emotion/styled'; const A = styled.a` color: ${props => props.theme.palette.GREY_10}; text-decoration: none; + display: block; &:hover, &:focus { text-decoration: underline; diff --git a/src/app/legacy/components/Promo/image.jsx b/src/app/legacy/components/Promo/image.jsx index 778bfa11659..8d824ad0a34 100644 --- a/src/app/legacy/components/Promo/image.jsx +++ b/src/app/legacy/components/Promo/image.jsx @@ -19,7 +19,7 @@ const ChildWrapper = styled.div` // promos with images via Programmes (which can be of type audio and possibly others) use a different iChef recipe requiring a second set of resolutions // https://github.com/bbc/programme-images/tree/master/webapp/ichef/recipes -const createSrcSet = (imageUrl, suffix = '', isProgrammeImage) => { +const createSrcSet = (imageUrl, isProgrammeImage, suffix = '') => { const imageResolutions = [85, 120, 170, 232, 325, 450, 660, 800]; const imageResolutionsProgrammes = [96, 128, 176, 240, 352, 464, 672, 800]; @@ -63,9 +63,9 @@ const Image = props => { 'https://ichef.bbci.co.uk/images/ic/', ); const suffix = src.endsWith('.webp') ? '' : '.webp'; - const primarySrcSet = createSrcSet(src, suffix, isProgrammeImage); + const primarySrcSet = createSrcSet(src, isProgrammeImage, suffix); - const fallbackSrcSet = createSrcSet(src, '', isProgrammeImage).replaceAll( + const fallbackSrcSet = createSrcSet(src, isProgrammeImage).replaceAll( '.webp', '', ); diff --git a/src/app/legacy/containers/App/index.test.jsx b/src/app/legacy/containers/App/index.test.jsx index 5b775912b7f..121c0d29cf5 100644 --- a/src/app/legacy/containers/App/index.test.jsx +++ b/src/app/legacy/containers/App/index.test.jsx @@ -22,7 +22,7 @@ describe('ClientApp', () => { it('BrowserRouter should be called with the correct props', () => { const actualBrowserRouter = ReactRouter.BrowserRouter; - ReactRouter.BrowserRouter = jest.fn(() => <>); + ReactRouter.BrowserRouter = jest.fn(() => 'Browser Router'); renderClientApp(); expect(ReactRouter.BrowserRouter).toHaveBeenCalledWith( { @@ -63,7 +63,7 @@ describe('ServerApp', () => { it('StaticRouter should be called with the correct props', () => { const actualStaticRouter = ReactRouter.StaticRouter; - ReactRouter.StaticRouter = jest.fn(() => <>); + ReactRouter.StaticRouter = jest.fn(() => 'Static Router'); renderServerApp(); expect(ReactRouter.StaticRouter).toHaveBeenCalledWith( { diff --git a/src/app/legacy/containers/Footer/index.test.jsx b/src/app/legacy/containers/Footer/index.test.jsx index 657e5403541..3cc92b19aff 100644 --- a/src/app/legacy/containers/Footer/index.test.jsx +++ b/src/app/legacy/containers/Footer/index.test.jsx @@ -3,21 +3,9 @@ import React from 'react'; import { render } from '../../../components/react-testing-library-with-providers'; import FooterContainer from '.'; -const RealDate = Date; - describe(`FooterContainer`, () => { beforeEach(() => { - // eslint-disable-next-line prettier/prettier - global.Date = class extends RealDate { - constructor() { - super(); - return new RealDate('3000-01-01T12:00:00'); - } - }; - }); - - afterEach(() => { - global.Date = RealDate; + jest.useFakeTimers().setSystemTime(new Date('3000-01-01T12:00:00Z')); }); describe('snapshots', () => { diff --git a/src/app/legacy/containers/Fragment/index.test.jsx b/src/app/legacy/containers/Fragment/index.test.jsx index 432673708aa..13834f60f44 100644 --- a/src/app/legacy/containers/Fragment/index.test.jsx +++ b/src/app/legacy/containers/Fragment/index.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { shouldMatchSnapshot } from '#psammead/psammead-test-helpers/src'; import { ServiceContext } from '../../../contexts/ServiceContext'; -import Fragment from './index'; +import FragmentContainer from './index'; const newsContext = { service: 'news', @@ -18,7 +18,7 @@ const CreateFragment = ({ text = '', } = {}) => ( - + ); diff --git a/src/app/legacy/containers/PodcastPromo/components/card-episodes-text.jsx b/src/app/legacy/containers/PodcastPromo/components/card-episodes-text.jsx index df019200924..eccb9fe8ea5 100644 --- a/src/app/legacy/containers/PodcastPromo/components/card-episodes-text.jsx +++ b/src/app/legacy/containers/PodcastPromo/components/card-episodes-text.jsx @@ -25,12 +25,10 @@ const EpisodesText = styled.p` `; const CardEpisodesText = ({ children, ...props }) => ( - <> - - {mediaIcons.seriesstack} - {children} - - + + {mediaIcons.seriesstack} + {children} + ); export default CardEpisodesText; diff --git a/src/app/legacy/containers/StoryPromo/index.jsx b/src/app/legacy/containers/StoryPromo/index.jsx index 2bd4bfb2fd1..faa9fec450d 100644 --- a/src/app/legacy/containers/StoryPromo/index.jsx +++ b/src/app/legacy/containers/StoryPromo/index.jsx @@ -50,9 +50,9 @@ const extractAltText = blocks => { if (block.model && block.model.blocks) { return extractAltText(block.model.blocks); } - return ''; } }; + const getBlockByType = (blocks, blockType) => { let blockData; blocks.forEach(block => { diff --git a/src/app/legacy/containers/Text/fixtures.js b/src/app/legacy/containers/Text/fixtures.js index a05d118af71..c35916d2b65 100644 --- a/src/app/legacy/containers/Text/fixtures.js +++ b/src/app/legacy/containers/Text/fixtures.js @@ -1,4 +1,4 @@ -export const fragmentBlock = (id = null, text, attributes = []) => ({ +export const fragmentBlock = (id, text, attributes = []) => ({ id, type: 'fragment', model: { @@ -7,7 +7,7 @@ export const fragmentBlock = (id = null, text, attributes = []) => ({ }, }); -export const paragraphBlock = (id = null, blocks) => ({ +export const paragraphBlock = (id, blocks) => ({ id, type: 'paragraph', model: { diff --git a/src/app/legacy/containers/Text/index.test.jsx b/src/app/legacy/containers/Text/index.test.jsx index 4076b48b4dd..0fe04889a7c 100644 --- a/src/app/legacy/containers/Text/index.test.jsx +++ b/src/app/legacy/containers/Text/index.test.jsx @@ -15,7 +15,7 @@ const defaultToggles = { }, }; -const listItemBlock = (id = null, listBlocks) => ({ +const listItemBlock = (id, listBlocks) => ({ id, type: 'listItem', model: { @@ -23,7 +23,7 @@ const listItemBlock = (id = null, listBlocks) => ({ }, }); -const listBlock = (id = null, blocks, type = 'unorderedList') => ({ +const listBlock = (id, blocks, type = 'unorderedList') => ({ id, type, model: { diff --git a/src/app/legacy/psammead/psammead-brand/src/index.jsx b/src/app/legacy/psammead/psammead-brand/src/index.jsx index 4fd2d5cb28a..d195672f411 100644 --- a/src/app/legacy/psammead/psammead-brand/src/index.jsx +++ b/src/app/legacy/psammead/psammead-brand/src/index.jsx @@ -148,35 +148,33 @@ const StyledBrand = ({ serviceLocalisedName = null, svg, isLongBrand, -}) => ( - <> - {svg && ( - <> - - - - )} - -); +}) => { + return svg ? ( + <> + + + + ) : null; +}; const Brand = forwardRef((props, ref) => { const { diff --git a/src/app/legacy/psammead/psammead-navigation/src/index.jsx b/src/app/legacy/psammead/psammead-navigation/src/index.jsx index c639b527e33..14d82f73fd2 100644 --- a/src/app/legacy/psammead/psammead-navigation/src/index.jsx +++ b/src/app/legacy/psammead/psammead-navigation/src/index.jsx @@ -137,18 +137,16 @@ const CurrentLink = ({ script, currentPageText = null, }) => ( - <> - - {`${currentPageText}, `} - {link} - - + + {`${currentPageText}, `} + {link} + ); export const NavigationUl = ({ children, ...props }) => ( diff --git a/src/app/legacy/psammead/psammead-topic-tags/src/index.jsx b/src/app/legacy/psammead/psammead-topic-tags/src/index.jsx index 694b9470cf3..e4638bb8baa 100644 --- a/src/app/legacy/psammead/psammead-topic-tags/src/index.jsx +++ b/src/app/legacy/psammead/psammead-topic-tags/src/index.jsx @@ -74,38 +74,34 @@ export const TopicTags = ({ }) => { const hasMultipleChildren = children.length > 1; - return ( - <> - {hasMultipleChildren ? ( - - {children.map((child, index) => { - if (child.type !== TopicTag) return null; + return hasMultipleChildren ? ( + + {children.map((child, index) => { + if (child.type !== TopicTag) return null; - return ( - - {child} - - ); - })} - - ) : ( - + return ( - {children.type === TopicTag && children} + {child} - - )} - + ); + })} + + ) : ( + + + {children.type === TopicTag && children} + + ); }; diff --git a/src/app/models/types/serviceConfig.ts b/src/app/models/types/serviceConfig.ts index 8a9981214f4..c29cc1abdb0 100644 --- a/src/app/models/types/serviceConfig.ts +++ b/src/app/models/types/serviceConfig.ts @@ -12,27 +12,27 @@ import { import { Translations } from './translations'; export type DefaultServiceConfig = { - [key in ServicesWithNoVariants['variant']]: ServiceConfig; + [_key in ServicesWithNoVariants['variant']]: ServiceConfig; }; export type SerbianConfig = { - [key in SerbianService['variant']]: ServiceConfig; + [_key in SerbianService['variant']]: ServiceConfig; }; export type ChineseConfig = { - [key in ChineseService['variant']]: ServiceConfig; + [_key in ChineseService['variant']]: ServiceConfig; }; export type ZhongwenConfig = { - [key in ZhongwenService['variant']]: ServiceConfig; + [_key in ZhongwenService['variant']]: ServiceConfig; }; export type UkrainianConfig = { - [key in UkrainianService['variant']]: ServiceConfig; + [_key in UkrainianService['variant']]: ServiceConfig; }; export type UzbekConfig = { - [key in UzbekService['variant']]: ServiceConfig; + [_key in UzbekService['variant']]: ServiceConfig; }; export type ServiceConfig = { diff --git a/src/app/pages/ArticlePage/__snapshots__/index.test.tsx.snap b/src/app/pages/ArticlePage/__snapshots__/index.test.tsx.snap index 3545aefb062..3cad7115055 100644 --- a/src/app/pages/ArticlePage/__snapshots__/index.test.tsx.snap +++ b/src/app/pages/ArticlePage/__snapshots__/index.test.tsx.snap @@ -738,7 +738,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -926,7 +926,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc dir="ltr" > Teams wey qualify for Afcon 2023 and how things stand for each group @@ -967,7 +967,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc dir="ltr" > 'We dey hear gospel songs den screaming' - Woman tok of Uganda school attack @@ -1008,7 +1008,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc dir="ltr" > Super Eagles qualify for Nations Cup afta beating Sierra Leone for Monrovia @@ -1049,7 +1049,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc dir="ltr" > Forbes top ten list of highest paid athletes for 2023 and wetin dem earn @@ -1090,7 +1090,7 @@ exports[`Article Page should render a ltr article (pidgin) with most read correc dir="ltr" > Tins to sabi about 2023 Sierra Leone general election @@ -1911,7 +1911,7 @@ exports[`Article Page should render a news article correctly 1`] = ` color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -2363,7 +2363,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Why the oxygen timeline on sub may not be so fixed @@ -2404,7 +2404,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > MasterChef contestant jailed for child abuse images @@ -2445,7 +2445,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Musk and Zuckerberg agree to hold cage fight @@ -2486,7 +2486,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Cindy Beale returns to EastEnders after 25 years @@ -2527,7 +2527,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Mosquito-borne diseases risk increasing in Europe @@ -2568,7 +2568,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Teenager guilty of murdering boy at train station @@ -2609,7 +2609,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > At least 30 migrants feared dead off Canary Islands @@ -2650,7 +2650,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Bank boss warns interest rate hike hard for many @@ -2691,7 +2691,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > Ukraine strikes bridge to Crimea, says Russia @@ -2732,7 +2732,7 @@ exports[`Article Page should render a news article correctly 1`] = ` dir="ltr" > The woman who wants to end abortion in America @@ -4092,7 +4092,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre color: #222222; -webkit-text-decoration: none; text-decoration: none; - margin-bottom: 0.5rem; + display: inline-block; } @media (min-width: 20rem) and (max-width: 37.4375rem) { @@ -4500,7 +4500,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > ایران در آستانه بحران بنزین؛ تابستانی دشوار برای دولت رئیسی در پیش است @@ -4541,7 +4541,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > پرونده حمید نوری؛ وکلای مدافع: نوری فریب خورد @@ -4582,7 +4582,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > اما رادوکانو: گاهی آرزو می‌کنم که ای کاش قهرمان اوپن آمریکا نمی‌شدم @@ -4623,7 +4623,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > ملی‌پوش سابق هلند برای چاقو زدن به فامیلش به ۱۸ ماه حبس محکوم شد @@ -4664,7 +4664,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > وزیر خارجه آمریکا در پکن؛ شی: پیشرفت‌هایی در روابط حاصل شده است، بلینکن: رقابت نباید بدل به دشمنی شود @@ -4705,7 +4705,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > سگم سرطان پستان مرا تشخیص داد @@ -4746,7 +4746,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > لوح ۲۸۰۰ ساله از ایتالیا به عراق بازگردانده شد @@ -4787,7 +4787,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > نمایندگان کشورها و نهادها در اجلاس سازمان ملل خواستار پایان یافتن سیاست‌های تبعیض‌آمیز طالبان علیه زنان شدند @@ -4828,7 +4828,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > چرا موبایل داغ می‌کند و چطور آن را خنک نگه داریم؟ @@ -4869,7 +4869,7 @@ exports[`Article Page should render a rtl article (persian) with most read corre dir="rtl" > هشتگ «داستان_ما_یکیست» در چهلمین سالگرد اعدام ۱۰ زن بهائی در شیراز diff --git a/src/app/pages/ArticlePage/index.stories.tsx b/src/app/pages/ArticlePage/index.stories.tsx index f0f2cd55fc1..d0a1a3e455b 100644 --- a/src/app/pages/ArticlePage/index.stories.tsx +++ b/src/app/pages/ArticlePage/index.stories.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import React from 'react'; +import React, { useMemo } from 'react'; import ThemeProvider from '#app/components/ThemeProvider'; import { ToggleContextProvider } from '#contexts/ToggleContext'; import { @@ -112,6 +112,11 @@ const ComponentWithServiceContext = ({ podcastEnabled = false, electionBanner = false, }: Props) => { + const memoisedServiceContext = useMemo( + () => ({ ...serviceContextMock, service }), + [service], + ); + return ( Teams wey qualify for Afcon 2023 and how things stand for each group @@ -655,7 +655,7 @@ exports[`Most Read Page Main should match snapshot for most read page 1`] = ` dir="ltr" > 'We dey hear gospel songs den screaming' - Woman tok of Uganda school attack @@ -696,7 +696,7 @@ exports[`Most Read Page Main should match snapshot for most read page 1`] = ` dir="ltr" > Super Eagles qualify for Nations Cup afta beating Sierra Leone for Monrovia @@ -737,7 +737,7 @@ exports[`Most Read Page Main should match snapshot for most read page 1`] = ` dir="ltr" > Forbes top ten list of highest paid athletes for 2023 and wetin dem earn @@ -778,7 +778,7 @@ exports[`Most Read Page Main should match snapshot for most read page 1`] = ` dir="ltr" > Tins to sabi about 2023 Sierra Leone general election diff --git a/src/app/pages/utils/getNthCurationByStyleAndProminence/index.ts b/src/app/pages/utils/getNthCurationByStyleAndProminence/index.ts index 372f93d4901..585d27d58fe 100644 --- a/src/app/pages/utils/getNthCurationByStyleAndProminence/index.ts +++ b/src/app/pages/utils/getNthCurationByStyleAndProminence/index.ts @@ -39,5 +39,5 @@ export default ({ `${visualStyle}_${visualProminence}`, ); - return positions?.findIndex((x: number) => x === position) + 1; + return positions.findIndex((x: number) => x === position) + 1; }; diff --git a/src/app/routes/homePage/getInitialData/page-config.ts b/src/app/routes/homePage/getInitialData/page-config.ts index a2a7ae3bb6a..421a73edde7 100644 --- a/src/app/routes/homePage/getInitialData/page-config.ts +++ b/src/app/routes/homePage/getInitialData/page-config.ts @@ -3,7 +3,7 @@ import { Services } from '../../../models/types/global'; type Envs = 'test' | 'live'; export const HOME_PAGE_CONFIG: { - [service in Services]: { [env in Envs]: string }; + [_service in Services]: { [_env in Envs]: string }; } = { kyrgyz: { test: 'cm7682qz7v1t', diff --git a/src/app/routes/onDemandAudio/getInitialData/index.ts b/src/app/routes/onDemandAudio/getInitialData/index.ts index b953b2f85b8..37ab93d02ff 100644 --- a/src/app/routes/onDemandAudio/getInitialData/index.ts +++ b/src/app/routes/onDemandAudio/getInitialData/index.ts @@ -59,8 +59,8 @@ export default async ({ ? await getPodcastExternalLinks( service, brandId, - variant, externalLinkVersionId, + variant, ) : []; return { diff --git a/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.js b/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.js index 5f9a4d9e187..dee305e8a5c 100644 --- a/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.js +++ b/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.js @@ -38,8 +38,8 @@ const getDownloadLink = versionId => ({ export const getPodcastExternalLinks = async ( service, brandPid, - variant = 'default', versionId, + variant = 'default', ) => { try { const linkData = await podcastExternalLinks[service](); diff --git a/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.test.js b/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.test.js index e3da1adc608..1a72396e486 100644 --- a/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.test.js +++ b/src/app/routes/onDemandAudio/tempData/podcastExternalLinks/index.test.js @@ -7,7 +7,6 @@ describe('getPodcastExternalLinks', () => { const links = await getPodcastExternalLinks( 'hausa', 'p08mlgcb', - 'default', 'p0967t2j', ); const expectedLinks = [ @@ -38,12 +37,7 @@ describe('getPodcastExternalLinks', () => { }); it('should return rss feed when brand is not found', async () => { - const otherLinks = await getPodcastExternalLinks( - 'hausa', - 'bar', - 'default', - 'h455a', - ); + const otherLinks = await getPodcastExternalLinks('hausa', 'bar', 'h455a'); expect(otherLinks).toEqual([ { linkText: 'RSS', @@ -63,8 +57,8 @@ describe('getPodcastExternalLinks', () => { const links = await getPodcastExternalLinks( 'zhongwen', 'p02pc9xp', - 'simp', 'p0967t2j', + 'simp', ); const expectedLinks = [ ...zhongwenExternalLinks.simp.p02pc9xp, @@ -87,8 +81,8 @@ describe('getPodcastExternalLinks', () => { const links = await getPodcastExternalLinks( 'burmese', 'p02pc9lh', - undefined, 'p0967t2j', + undefined, ); expect(links[3].linkUrl).toEqual( 'https://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download-low/proto/https/vpid/p0967t2j.mp3', diff --git a/src/app/routes/topic/getInitialData/page-config.ts b/src/app/routes/topic/getInitialData/page-config.ts index 5c09a74c351..02ad2d5f76f 100644 --- a/src/app/routes/topic/getInitialData/page-config.ts +++ b/src/app/routes/topic/getInitialData/page-config.ts @@ -3,7 +3,7 @@ import { Environments } from '../../../models/types/global'; export type TopicPagePaths = '/persian/afghanistan'; export const TOPIC_PAGE_CONFIG: { - [path in TopicPagePaths]: { [env in Environments]: string }; + [_path in TopicPagePaths]: { [_env in Environments]: string }; } = { '/persian/afghanistan': { local: 'crezq2dg9zwt', diff --git a/src/server/Document/__snapshots__/component.test.jsx.snap b/src/server/Document/__snapshots__/component.test.jsx.snap index 703ad019c11..7e6f161f9d1 100644 --- a/src/server/Document/__snapshots__/component.test.jsx.snap +++ b/src/server/Document/__snapshots__/component.test.jsx.snap @@ -135,15 +135,15 @@ exports[`Document Component should render APP version correctly 1`] = `
@@ -275,15 +275,15 @@ exports[`Document Component should render correctly 1`] = `
diff --git a/src/server/Document/component.test.jsx b/src/server/Document/component.test.jsx index 88300a0ae5c..e3bc3ab0971 100644 --- a/src/server/Document/component.test.jsx +++ b/src/server/Document/component.test.jsx @@ -36,9 +36,9 @@ describe('Document Component', () => { ); const links = ( <> - - - + + + ); diff --git a/src/server/utilities/serviceConfigs/index.ts b/src/server/utilities/serviceConfigs/index.ts index ff0d7987f8a..341df90a6fd 100644 --- a/src/server/utilities/serviceConfigs/index.ts +++ b/src/server/utilities/serviceConfigs/index.ts @@ -58,8 +58,8 @@ import { Services, Variants } from '../../../app/models/types/global'; import { ServiceConfig } from '../../../app/models/types/serviceConfig'; type AllServices = { - [s in Services]: { - [v in Variants]: ServiceConfig; + [_service in Services]: { + [_variant in Variants]: ServiceConfig; }; }; diff --git a/yarn.lock b/yarn.lock index 11cb417c187..8c4b1881c85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9912,34 +9912,35 @@ __metadata: languageName: node linkType: hard -"eslint-config-airbnb-base@npm:^14.2.1": - version: 14.2.1 - resolution: "eslint-config-airbnb-base@npm:14.2.1" +"eslint-config-airbnb-base@npm:^15.0.0": + version: 15.0.0 + resolution: "eslint-config-airbnb-base@npm:15.0.0" dependencies: confusing-browser-globals: "npm:^1.0.10" object.assign: "npm:^4.1.2" - object.entries: "npm:^1.1.2" + object.entries: "npm:^1.1.5" + semver: "npm:^6.3.0" peerDependencies: - eslint: ^5.16.0 || ^6.8.0 || ^7.2.0 - eslint-plugin-import: ^2.22.1 - checksum: 10/0d679b6fe8030e18be9d5876bdf4d112988f9a1bc23fbb87a835447d448877041191caae6f9f656238bf5b883da8ea80199d6769075fe3493018c5e74d5fa0dd + eslint: ^7.32.0 || ^8.2.0 + eslint-plugin-import: ^2.25.2 + checksum: 10/daa68a1dcb7bff338747a952723b5fa9d159980ec3554c395a4b52a7f7d4f00a45e7b465420eb6d4d87a82cef6361e4cfd6dbb38c2f3f52f2140b6cf13654803 languageName: node linkType: hard -"eslint-config-airbnb@npm:18.2.1": - version: 18.2.1 - resolution: "eslint-config-airbnb@npm:18.2.1" +"eslint-config-airbnb@npm:19.0.4": + version: 19.0.4 + resolution: "eslint-config-airbnb@npm:19.0.4" dependencies: - eslint-config-airbnb-base: "npm:^14.2.1" + eslint-config-airbnb-base: "npm:^15.0.0" object.assign: "npm:^4.1.2" - object.entries: "npm:^1.1.2" + object.entries: "npm:^1.1.5" peerDependencies: - eslint: ^5.16.0 || ^6.8.0 || ^7.2.0 - eslint-plugin-import: ^2.22.1 - eslint-plugin-jsx-a11y: ^6.4.1 - eslint-plugin-react: ^7.21.5 - eslint-plugin-react-hooks: ^4 || ^3 || ^2.3.0 || ^1.7.0 - checksum: 10/0f251b051222dc67371baba4ec6f25ac5f613425dd0c27d505456e617bec5f54f47756b8add71951e5494c24dda866b8cbd205d3adc8b12b5fa90d620e251880 + eslint: ^7.32.0 || ^8.2.0 + eslint-plugin-import: ^2.25.3 + eslint-plugin-jsx-a11y: ^6.5.1 + eslint-plugin-react: ^7.28.0 + eslint-plugin-react-hooks: ^4.3.0 + checksum: 10/f2086523cfd20c42fd620c757281bd028aa8ce9dadc7293c5c23ea60947a2d3ca04404ede77b40f5a65250fe3c04502acafc4f2f6946819fe6c257d76d9644e5 languageName: node linkType: hard @@ -14895,7 +14896,7 @@ __metadata: languageName: node linkType: hard -"object.entries@npm:^1.1.2, object.entries@npm:^1.1.8": +"object.entries@npm:^1.1.5, object.entries@npm:^1.1.8": version: 1.1.8 resolution: "object.entries@npm:1.1.8" dependencies: @@ -17231,7 +17232,7 @@ __metadata: depcheck: "npm:1.4.7" dotenv: "npm:16.4.7" eslint: "npm:7.32.0" - eslint-config-airbnb: "npm:18.2.1" + eslint-config-airbnb: "npm:19.0.4" eslint-config-prettier: "npm:10.0.1" eslint-import-resolver-alias: "npm:1.1.2" eslint-plugin-cypress: "npm:4.1.0"