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

@@ -72,7 +72,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
} = bookedRoom
const mainBedWidthValueMsg = intl.formatMessage(
{ id: "{value} cm" },
{
defaultMessage: "{value} cm",
},
{
value: bedType.mainBed.widthRange.min,
}
@@ -80,7 +82,7 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
const mainBedWidthRangeMsg = intl.formatMessage(
{
id: "{min}{max} cm",
defaultMessage: "{min}{max} cm",
},
{
min: bedType.mainBed.widthRange.min,
@@ -89,7 +91,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
)
const adultsMsg = intl.formatMessage(
{ id: "{adults, plural, one {# adult} other {# adults}}" },
{
defaultMessage: "{adults, plural, one {# adult} other {# adults}}",
},
{
adults,
}
@@ -97,7 +101,7 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
const childrenMsg = intl.formatMessage(
{
id: "{children, plural, one {# child} other {# children}}",
defaultMessage: "{children, plural, one {# child} other {# children}}",
},
{
children: childrenAges.length,
@@ -114,7 +118,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
)
const breakfastText = rateDefinition.breakfastIncluded
? intl.formatMessage({ id: "Included" })
? intl.formatMessage({
defaultMessage: "Included",
})
: breakfast
? formatPrice(
intl,
@@ -135,7 +141,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
<Typography variant="Tag/sm">
<span>
{intl.formatMessage(
{ id: "Room {roomIndex}" },
{
defaultMessage: "Room {roomIndex}",
},
{
roomIndex: bookedRoom.roomNumber,
}
@@ -145,7 +153,13 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
</div>
<div className={styles.reference}>
<Typography variant="Body/Paragraph/mdBold">
<span>{intl.formatMessage({ id: "Reference" })}:</span>
<span>
{intl.formatMessage({
defaultMessage: "Reference",
})}
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{":"}
</span>
</Typography>
<Typography variant="Body/Paragraph/mdRegular">
<span>{confirmationNumber}</span>
@@ -209,7 +223,11 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
size={20}
/>
<Typography variant="Body/Paragraph/mdBold">
<p>{intl.formatMessage({ id: "Guests" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "Guests",
})}
</p>
</Typography>
</span>
<div className={styles.rowContent}>
@@ -230,7 +248,11 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
size={20}
/>
<Typography variant="Body/Paragraph/mdBold">
<p>{intl.formatMessage({ id: "Terms" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "Terms",
})}
</p>
</Typography>
</span>
<div className={styles.rowContent}>
@@ -250,14 +272,20 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
size={20}
/>
<Typography variant="Body/Paragraph/mdBold">
<p>{intl.formatMessage({ id: "Modify By" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "Modify By",
})}
</p>
</Typography>
</span>
<div className={styles.rowContent}>
<Typography variant="Body/Paragraph/mdRegular">
<p color="uiTextHighContrast">
{intl.formatMessage(
{ id: "Until {time}, {date}" },
{
defaultMessage: "Until {time}, {date}",
},
{
time: "18:00",
date: fromDate.format("dddd D MMM"),
@@ -277,7 +305,11 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
size={20}
/>
<Typography variant="Body/Paragraph/mdBold">
<p>{intl.formatMessage({ id: "Breakfast" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "Breakfast",
})}
</p>
</Typography>
</span>
<div className={styles.rowContent}>
@@ -297,7 +329,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
/>
<Typography variant="Body/Paragraph/mdBold">
<p>
{intl.formatMessage({ id: "Room classification" })}
{intl.formatMessage({
defaultMessage: "Room classification",
})}
</p>
</Typography>
</span>
@@ -322,7 +356,11 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
<span className={styles.rowTitle}>
<MaterialIcon icon="bed" color="Icon/Default" size={20} />
<Typography variant="Body/Paragraph/mdBold">
<p>{intl.formatMessage({ id: "Bed preference" })}</p>
<p>
{intl.formatMessage({
defaultMessage: "Bed preference",
})}
</p>
</Typography>
</span>
<div className={styles.rowContent}>
@@ -331,8 +369,10 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
{bedType.mainBed.description}
{bedType.mainBed.widthRange.min ===
bedType.mainBed.widthRange.max
? ` (${mainBedWidthValueMsg})`
: ` (${mainBedWidthRangeMsg})`}
? // eslint-disable-next-line formatjs/no-literal-string-in-jsx
` (${mainBedWidthValueMsg})`
: // eslint-disable-next-line formatjs/no-literal-string-in-jsx
` (${mainBedWidthRangeMsg})`}
</p>
</Typography>
</div>
@@ -355,7 +395,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
icon={<DiscountIcon color="Icon/Feedback/Information" />}
>
{intl.formatMessage(
{ id: "<strong>Booking code</strong>: {value}" },
{
defaultMessage: "<strong>Booking code</strong>: {value}",
},
{
value: bookingCode,
strong: (text) => (
@@ -372,7 +414,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
<div className={styles.price}>
<Typography variant="Body/Lead text">
<p color="uiTextHighContrast">
{intl.formatMessage({ id: "Room total" })}
{intl.formatMessage({
defaultMessage: "Room total",
})}
</p>
</Typography>
{priceType === "points" ? (
@@ -381,7 +425,9 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
<Typography variant="Title/Subtitle/lg">
<p>
{intl.formatMessage(
{ id: "{count} voucher" },
{
defaultMessage: "{count} voucher",
},
{ count: vouchers }
)}
</p>