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

@@ -54,7 +54,8 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
icon="straighten"
color="Icon/Interactive/Placeholder"
/>
<Caption color="uiTextPlaceholder">{room.size} m2</Caption>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<Caption color="uiTextPlaceholder">{room.size} m²</Caption>
</div>
<div className={styles.iconText}>
<MaterialIcon
@@ -64,7 +65,9 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
/>
<Caption color="uiTextPlaceholder">
{intl.formatMessage(
{ id: "max {seatings} pers" },
{
defaultMessage: "max {seatings} pers",
},
{ seatings: maxSeatings }
)}
</Caption>
@@ -89,7 +92,9 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
</Caption>
<Caption color="uiTextHighContrast">
{intl.formatMessage(
{ id: "{number} people" },
{
defaultMessage: "{number} people",
},
{ number: seating.capacity }
)}
</Caption>
@@ -101,12 +106,14 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
<div className={styles.capacity}>
<Caption color="uiTextMediumContrast">
{intl.formatMessage({
id: "Location in hotel",
defaultMessage: "Location in hotel",
})}
</Caption>
<Caption color="uiTextHighContrast">
{intl.formatMessage(
{ id: "Floor {floorNumber}" },
{
defaultMessage: "Floor {floorNumber}",
},
{
floorNumber: `${room.floorNumber}`,
}
@@ -116,7 +123,7 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
<div className={styles.capacity}>
<Caption color="uiTextMediumContrast">
{intl.formatMessage({
id: "Lighting",
defaultMessage: "Lighting",
})}
</Caption>
<Caption color="uiTextHighContrast">
@@ -127,10 +134,11 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
<div className={styles.capacity}>
<Caption color="uiTextMediumContrast">
{intl.formatMessage({
id: "Access size",
defaultMessage: "Access size",
})}
</Caption>
<Caption color="uiTextHighContrast">
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{room.doorHeight} x {room.doorWidth} m
</Caption>
</div>
@@ -139,10 +147,11 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) {
<div className={styles.capacity}>
<Caption color="uiTextMediumContrast">
{intl.formatMessage({
id: "Dimensions",
defaultMessage: "Dimensions",
})}
</Caption>
<Caption color="uiTextHighContrast">
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{room.length} x {room.width} x {room.height} m
</Caption>
</div>

View File

@@ -6,35 +6,37 @@ export function translateRoomLighting(option: string, intl: IntlShape) {
switch (option) {
case RoomLighting.WindowsNaturalDaylight:
return intl.formatMessage({
id: "Windows with natural daylight",
defaultMessage: "Windows with natural daylight",
})
case RoomLighting.IndoorWindowsExcellentLighting:
return intl.formatMessage({
id: "Indoor windows and excellent lighting",
defaultMessage: "Indoor windows and excellent lighting",
})
case RoomLighting.IndoorWindowsFacingHotel:
return intl.formatMessage({
id: "Indoor windows facing the hotel",
defaultMessage: "Indoor windows facing the hotel",
})
case RoomLighting.NoWindows:
return intl.formatMessage({
id: "No windows",
defaultMessage: "No windows",
})
case RoomLighting.NoWindowsExcellentLighting:
return intl.formatMessage({
id: "No windows but excellent lighting",
defaultMessage: "No windows but excellent lighting",
})
case RoomLighting.WindowsNaturalDaylightBlackoutFacilities:
return intl.formatMessage({
id: "Windows natural daylight and blackout facilities",
defaultMessage: "Windows natural daylight and blackout facilities",
})
case RoomLighting.WindowsNaturalDaylightExcellentView:
return intl.formatMessage({
id: "Windows natural daylight and excellent view",
defaultMessage: "Windows natural daylight and excellent view",
})
default:
console.warn(`Unsupported conference room ligthing option: ${option}`)
return intl.formatMessage({ id: "N/A" })
return intl.formatMessage({
defaultMessage: "N/A",
})
}
}
@@ -42,38 +44,40 @@ export function translateSeatingType(type: string, intl: IntlShape) {
switch (type) {
case SeatingType.Boardroom:
return intl.formatMessage({
id: "Boardroom",
defaultMessage: "Boardroom",
})
case SeatingType.Cabaret:
return intl.formatMessage({
id: "Cabaret seating",
defaultMessage: "Cabaret seating",
})
case SeatingType.Classroom:
return intl.formatMessage({
id: "Classroom",
defaultMessage: "Classroom",
})
case SeatingType.FullCircle:
return intl.formatMessage({
id: "Full circle",
defaultMessage: "Full circle",
})
case SeatingType.HalfCircle:
return intl.formatMessage({
id: "Half circle",
defaultMessage: "Half circle",
})
case SeatingType.StandingTable:
return intl.formatMessage({
id: "Standing table",
defaultMessage: "Standing table",
})
case SeatingType.Theatre:
return intl.formatMessage({
id: "Theatre",
defaultMessage: "Theatre",
})
case SeatingType.UShape:
return intl.formatMessage({
id: "U-shape",
defaultMessage: "U-shape",
})
default:
console.warn(`Unsupported conference room type : ${type}`)
return intl.formatMessage({ id: "N/A" })
return intl.formatMessage({
defaultMessage: "N/A",
})
}
}