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

@@ -56,7 +56,9 @@ export default function OneTimePasswordForm({
if (requestOtp.isError) {
const cause = requestOtp.error?.data?.cause as RequestOtpError
const title = intl.formatMessage({ id: "Error requesting OTP" })
const title = intl.formatMessage({
defaultMessage: "Error requesting OTP",
})
const body = getRequestErrorBody(intl, cause?.errorCode)
return (
@@ -125,11 +127,12 @@ export default function OneTimePasswordForm({
const errorMessages: Record<OtpError, ReactNode> = {
invalidCode: intl.formatMessage({
id: "The code you've entered is incorrect.",
defaultMessage: "The code you've entered is incorrect.",
}),
expiredCode: intl.formatMessage(
{
id: "This code has expired. <resendOtpLink>Send new code.</resendOtpLink>",
defaultMessage:
"This code has expired. <resendOtpLink>Send new code.</resendOtpLink>",
},
{
resendOtpLink: getResendOtpLink,
@@ -189,7 +192,8 @@ export default function OneTimePasswordForm({
<p>
{intl.formatMessage(
{
id: "Didn't receive a code? <resendOtpLink>Resend code</resendOtpLink>",
defaultMessage:
"Didn't receive a code? <resendOtpLink>Resend code</resendOtpLink>",
},
{
resendOtpLink: getResendOtpLink,
@@ -226,11 +230,11 @@ const getRequestErrorBody = (
switch (errorCode) {
case "TOO_MANY_REQUESTS":
return intl.formatMessage({
id: "Too many requests. Please try again later.",
defaultMessage: "Too many requests. Please try again later.",
})
default:
return intl.formatMessage({
id: "An error occurred while requesting a new OTP",
defaultMessage: "An error occurred while requesting a new OTP",
})
}
}

View File

@@ -16,7 +16,7 @@ export default function Loading() {
<Typography variant="Body/Paragraph/mdRegular">
<p>
{intl.formatMessage({
id: "Hang tight...",
defaultMessage: "Hang tight...",
})}
</p>
</Typography>

View File

@@ -110,19 +110,22 @@ export default async function SASxScandicOneTimePasswordPage({
const intentDescriptions: Record<Intent, ReactNode> = {
link: intl.formatMessage(
{
id: "Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to confirm your account linking.",
defaultMessage:
"Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to confirm your account linking.",
},
{ maskedContactInfo }
),
unlink: intl.formatMessage(
{
id: "Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to unlink your accounts.",
defaultMessage:
"Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to unlink your accounts.",
},
{ maskedContactInfo }
),
transfer: intl.formatMessage(
{
id: "Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to transfer your points.",
defaultMessage:
"Please enter the code sent to <maskedContactInfo></maskedContactInfo> in order to transfer your points.",
},
{ maskedContactInfo }
),
@@ -130,10 +133,12 @@ export default async function SASxScandicOneTimePasswordPage({
return (
<OneTimePasswordForm
heading={intl.formatMessage({ id: "Verification code" })}
heading={intl.formatMessage({
defaultMessage: "Verification code",
})}
ingress={intentDescriptions[intent]}
footnote={intl.formatMessage({
id: "This verifcation is needed for additional security.",
defaultMessage: "This verifcation is needed for additional security.",
})}
otpLength={6}
onSubmit={handleOtpVerified}