feat(SW-706): make eslint rule 'formatjs/no-literal-string-in-jsx' pass

This commit is contained in:
Michael Zetterberg
2025-02-07 06:51:36 +01:00
parent e22fc1f3c8
commit 440e1f92df
393 changed files with 4839 additions and 1554 deletions

View File

@@ -22,7 +22,9 @@ export default function Error({
<p>
<strong>
{intl.formatMessage(
{ id: "Breadcrumbs failed for this page ({errorId})" },
{
defaultMessage: "Breadcrumbs failed for this page ({errorId})",
},
{
errorId: `${error.digest}@${Date.now()}`,
}

View File

@@ -22,7 +22,9 @@ export default function Error({
<p>
<strong>
{intl.formatMessage(
{ id: "Error loading this page ({errorId})" },
{
defaultMessage: "Error loading this page ({errorId})",
},
{
errorId: `${error.digest}@${Date.now()}`,
}

View File

@@ -37,7 +37,11 @@ export default async function MyPages({}: PageArgs<
{content?.length ? (
<Blocks blocks={content} />
) : (
<p>{intl.formatMessage({ id: "No content published" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "No content published",
})}
</p>
)}
</main>
<TrackingSDK pageData={tracking} />

View File

@@ -25,7 +25,9 @@ export default function Error({
<p>
<strong>
{intl.formatMessage(
{ id: "An error occurred ({errorId})" },
{
defaultMessage: "An error occurred ({errorId})",
},
{
errorId: `${error.digest}@${Date.now()}`,
}

View File

@@ -128,12 +128,17 @@ export default async function DetailsPage({
<Alert
type={AlertTypeEnum.Alarm}
variant="inline"
heading={intl.formatMessage({ id: "Room sold out" })}
heading={intl.formatMessage({
defaultMessage: "Room sold out",
})}
text={intl.formatMessage({
id: "Unfortunately, one of the rooms you selected is sold out. Please choose another room to proceed.",
defaultMessage:
"Unfortunately, one of the rooms you selected is sold out. Please choose another room to proceed.",
})}
link={{
title: intl.formatMessage({ id: "Change room" }),
title: intl.formatMessage({
defaultMessage: "Change room",
}),
url: `${selectRate(lang)}?${selectRoomParams.toString()}`,
keepSearchParams: true,
}}

View File

@@ -26,6 +26,7 @@ export default function HotelReservationPage({ params }: PageArgs<LangParams>) {
}
return (
// eslint-disable-next-line formatjs/no-literal-string-in-jsx
<div className={styles.page}>
<TrackingSDK pageData={pageTrackingData} />
</div>

View File

@@ -61,7 +61,9 @@ export default function Error({
return (
<section className={styles.layout}>
<div className={styles.content}>
{intl.formatMessage({ id: "Something went wrong!" })}
{intl.formatMessage({
defaultMessage: "Something went wrong!",
})}
{env.NEXT_PUBLIC_NODE_ENV === "development" && (
<pre>{error.stack || error.message}</pre>
)}

View File

@@ -52,6 +52,7 @@ export default async function RootLayout({
id="Cookiebot"
src="https://consent.cookiebot.com/uc.js"
/>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<Script id="ensure-adobeDataLayer">{`
window.adobeDataLayer = window.adobeDataLayer || []
`}</Script>

View File

@@ -6,8 +6,9 @@ export default async function MiddlewareError({
params,
}: LayoutArgs<LangParams & StatusParams>) {
return (
// eslint-disable-next-line formatjs/no-literal-string-in-jsx
<div className={styles.layout}>
Middleware error {params.lang}: {params.status}
Middleware error {params.lang} {params.status}
</div>
)
}