Merged in fix/3697-prettier-configs (pull request #3396)

fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2026-01-07 12:45:50 +00:00
parent 932413412b
commit d0546926a9
500 changed files with 18367 additions and 18419 deletions

View File

@@ -1,25 +1,25 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { HotelCard } from './index'
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
import { HotelCard } from "./index"
import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType'
import { fn } from 'storybook/test'
import { Button } from '../Button'
import { MaterialIcon } from '../Icons/MaterialIcon'
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
import { fn } from "storybook/test"
import { Button } from "../Button"
import { MaterialIcon } from "../Icons/MaterialIcon"
const meta: Meta<typeof HotelCard> = {
title: 'Product Components/HotelCard/HotelCard',
title: "Product Components/HotelCard/HotelCard",
component: HotelCard,
argTypes: {
state: {
control: {
type: 'select',
options: ['default', 'active'],
type: "select",
options: ["default", "active"],
},
},
type: {
control: {
type: 'select',
options: ['mapListing', 'pageListing'],
type: "select",
options: ["mapListing", "pageListing"],
},
},
},
@@ -32,11 +32,11 @@ type Story = StoryObj<typeof HotelCard>
export const Default: Story = {
args: {
hotel: {
id: '1',
name: 'Test Hotel',
address: { streetAddress: '123 Test Street', city: 'Test City' },
description: 'A great place to stay.',
hotelType: 'signature',
id: "1",
name: "Test Hotel",
address: { streetAddress: "123 Test Street", city: "Test City" },
description: "A great place to stay.",
hotelType: "signature",
detailedFacilities: [],
ratings: {
tripAdvisor: 4,
@@ -46,7 +46,7 @@ export const Default: Story = {
public: {
rateType: RateTypeEnum.Regular,
localPrice: {
currency: 'SEK',
currency: "SEK",
pricePerNight: 1000,
pricePerStay: 1000,
},
@@ -54,24 +54,24 @@ export const Default: Story = {
member: {
rateType: RateTypeEnum.Regular,
localPrice: {
currency: 'SEK',
currency: "SEK",
pricePerNight: 800,
pricePerStay: 800,
},
},
},
state: 'default',
state: "default",
isAlternative: false,
isPartnerBrand: false,
type: 'pageListing',
type: "pageListing",
isUserLoggedIn: false,
distanceToCityCenter: 0,
bookingCode: 'ABC123',
bookingCode: "ABC123",
images: [
{
src: 'img/img2.jpg',
alt: 'Alt text',
caption: 'Caption',
src: "img/img2.jpg",
alt: "Alt text",
caption: "Caption",
},
],
@@ -92,7 +92,7 @@ export const Default: Story = {
export const MapListing: Story = {
args: {
...Default.args,
type: 'mapListing',
type: "mapListing",
},
}

View File

@@ -1,9 +1,9 @@
import Image from '../../Image'
import Image from "../../Image"
import { TripAdvisorChip } from '../../TripAdvisorChip'
import { hotelCardDialogImageVariants } from './variants'
import { TripAdvisorChip } from "../../TripAdvisorChip"
import { hotelCardDialogImageVariants } from "./variants"
import ImageFallback from '../../ImageFallback'
import ImageFallback from "../../ImageFallback"
export type HotelCardDialogImageProps = {
imageSrc?: string
@@ -11,7 +11,7 @@ export type HotelCardDialogImageProps = {
rating?: { tripAdvisor?: number | null }
imageError: boolean
setImageError: (error: boolean) => void
position: 'top' | 'left'
position: "top" | "left"
}
export function HotelCardDialogImage({
@@ -31,16 +31,16 @@ export function HotelCardDialogImage({
) : (
<Image
src={imageSrc}
alt={altText || ''}
alt={altText || ""}
fill
sizes={position === 'top' ? '200px' : '450px'}
sizes={position === "top" ? "200px" : "450px"}
onError={() => setImageError(true)}
/>
)}
{rating?.tripAdvisor && (
<TripAdvisorChip
rating={rating.tripAdvisor}
size={position === 'top' ? 'small' : 'default'}
size={position === "top" ? "small" : "default"}
/>
)}
</div>

View File

@@ -1,6 +1,6 @@
import { cva } from 'class-variance-authority'
import { cva } from "class-variance-authority"
import styles from './hotelCardDialogImage.module.css'
import styles from "./hotelCardDialogImage.module.css"
export const hotelCardDialogImageVariants = cva(styles.imageContainer, {
variants: {
@@ -10,6 +10,6 @@ export const hotelCardDialogImageVariants = cva(styles.imageContainer, {
},
},
defaultVariants: {
position: 'top',
position: "top",
},
})

View File

@@ -1,6 +1,6 @@
import SkeletonShimmer from '../SkeletonShimmer'
import SkeletonShimmer from "../SkeletonShimmer"
import styles from './HotelCardSkeleton.module.css'
import styles from "./HotelCardSkeleton.module.css"
export function HotelCardSkeleton() {
return (

View File

@@ -1,10 +1,10 @@
import { useIntl } from 'react-intl'
import { useIntl } from "react-intl"
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
import Caption from '../../Caption'
import Subtitle from '../../Subtitle'
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import Caption from "../../Caption"
import Subtitle from "../../Subtitle"
import styles from './hotelChequeCard.module.css'
import styles from "./hotelChequeCard.module.css"
type ProductTypeCheque = {
localPrice: {
@@ -30,8 +30,8 @@ export default function HotelChequeCard({
<div className={styles.chequeRow}>
<Caption>
{intl.formatMessage({
id: 'common.from',
defaultMessage: 'From',
id: "common.from",
defaultMessage: "From",
})}
</Caption>
<div className={styles.cheque}>
@@ -58,16 +58,16 @@ export default function HotelChequeCard({
<div className={styles.chequeRow}>
<Caption color="uiTextMediumContrast">
{intl.formatMessage({
id: 'booking.approx',
defaultMessage: 'Approx.',
id: "booking.approx",
defaultMessage: "Approx.",
})}
</Caption>
<Caption color="uiTextMediumContrast">
{productTypeCheque.requestedPrice.numberOfCheques} {CurrencyEnum.CC}
{productTypeCheque.requestedPrice.additionalPricePerStay
? // eslint-disable-next-line formatjs/no-literal-string-in-jsx
' + '
: ''}
" + "
: ""}
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{`${productTypeCheque.requestedPrice.additionalPricePerStay} ${productTypeCheque.requestedPrice.currency}`}
</Caption>

View File

@@ -1,12 +1,12 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { StandaloneHotelCardDialog } from './index'
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
import { StandaloneHotelCardDialog } from "./index"
import { Lang } from '@scandic-hotels/common/constants/language'
import { fn } from 'storybook/test'
import { hotelPins } from '../../../Map/InteractiveMap/storybookData'
import { Lang } from "@scandic-hotels/common/constants/language"
import { fn } from "storybook/test"
import { hotelPins } from "../../../Map/InteractiveMap/storybookData"
const meta: Meta<typeof StandaloneHotelCardDialog> = {
title: 'Product Components/HotelCard/StandaloneHotelCardDialog',
title: "Product Components/HotelCard/StandaloneHotelCardDialog",
component: StandaloneHotelCardDialog,
argTypes: {},
}

View File

@@ -1,24 +1,24 @@
'use client'
"use client"
import { useState } from 'react'
import { useIntl } from 'react-intl'
import { useState } from "react"
import { useIntl } from "react-intl"
import { IconButton } from '../../../IconButton'
import { Typography } from '../../../Typography'
import { IconButton } from "../../../IconButton"
import { Typography } from "../../../Typography"
import { HotelCardDialogImage } from '../../HotelCardDialogImage'
import { NoPriceAvailableCard } from '../../NoPriceAvailableCard'
import { HotelCardDialogImage } from "../../HotelCardDialogImage"
import { NoPriceAvailableCard } from "../../NoPriceAvailableCard"
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
import { Lang } from '@scandic-hotels/common/constants/language'
import { selectRate } from '@scandic-hotels/common/constants/routes/hotelReservation'
import { useUrlWithSearchParam } from '@scandic-hotels/common/hooks/useUrlWithSearchParam'
import ButtonLink from '../../../ButtonLink'
import { FacilityToIcon } from '../../../FacilityToIcon'
import { HotelPin } from '../../../Map/types'
import { HotelPointsRow } from '../../HotelPointsRow'
import { RoomPrice } from '../../RoomPrice'
import styles from './standaloneHotelCardDialog.module.css'
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { Lang } from "@scandic-hotels/common/constants/language"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { useUrlWithSearchParam } from "@scandic-hotels/common/hooks/useUrlWithSearchParam"
import ButtonLink from "../../../ButtonLink"
import { FacilityToIcon } from "../../../FacilityToIcon"
import { HotelPin } from "../../../Map/types"
import { HotelPointsRow } from "../../HotelPointsRow"
import { RoomPrice } from "../../RoomPrice"
import styles from "./standaloneHotelCardDialog.module.css"
interface StandaloneHotelCardProps {
lang: Lang
@@ -55,13 +55,13 @@ export function StandaloneHotelCardDialog({
} = data
const notEnoughPointsLabel = intl.formatMessage({
id: 'booking.notEnoughPoints',
defaultMessage: 'Not enough points',
id: "booking.notEnoughPoints",
defaultMessage: "Not enough points",
})
const shouldShowNotEnoughPoints = redemptionPrice && !hasEnoughPoints
const selectRateUrl = useUrlWithSearchParam(
{ key: 'hotel', value: operaId },
{ key: "hotel", value: operaId },
selectRate(lang)
)
const showPriceCard = !!(
@@ -80,8 +80,8 @@ export function StandaloneHotelCardDialog({
className={styles.closeButton}
onPress={handleClose}
aria-label={intl.formatMessage({
id: 'common.close',
defaultMessage: 'Close',
id: "common.close",
defaultMessage: "Close",
})}
iconName="close"
/>
@@ -119,12 +119,12 @@ export function StandaloneHotelCardDialog({
<p>
{redemptionPrice
? intl.formatMessage({
id: 'hotelCard.availableRates',
defaultMessage: 'Available rates',
id: "hotelCard.availableRates",
defaultMessage: "Available rates",
})
: intl.formatMessage({
id: 'common.from',
defaultMessage: 'From',
id: "common.from",
defaultMessage: "From",
})}
</p>
</Typography>
@@ -189,8 +189,8 @@ export function StandaloneHotelCardDialog({
onClick={onClick}
>
{intl.formatMessage({
id: 'common.seeRooms',
defaultMessage: 'See rooms',
id: "common.seeRooms",
defaultMessage: "See rooms",
})}
</ButtonLink>
)}

View File

@@ -1,10 +1,10 @@
import { useIntl } from 'react-intl'
import { useIntl } from "react-intl"
import { RoomPrice } from '../../HotelCard/RoomPrice'
import { Typography } from '../../Typography'
import { RoomPrice } from "../../HotelCard/RoomPrice"
import { Typography } from "../../Typography"
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
import styles from './hotelPointsRow.module.css'
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import styles from "./hotelPointsRow.module.css"
export type PointsRowProps = {
pointsPerStay: number
@@ -27,8 +27,8 @@ export function HotelPointsRow({
currency={
pointsCurrency ??
intl.formatMessage({
id: 'common.points',
defaultMessage: 'Points',
id: "common.points",
defaultMessage: "Points",
})
}
includePerNight={false}

View File

@@ -1,10 +1,10 @@
import { cx } from 'class-variance-authority'
import { useIntl } from 'react-intl'
import { cx } from "class-variance-authority"
import { useIntl } from "react-intl"
import { Divider } from '../../Divider'
import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType'
import { Typography } from '../../Typography'
import styles from './hotelPriceCard.module.css'
import { Divider } from "../../Divider"
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
import { Typography } from "../../Typography"
import styles from "./hotelPriceCard.module.css"
type Price = {
pricePerStay: number
@@ -49,16 +49,16 @@ export function HotelPriceCard({
<p>
{isPartnerBrand
? intl.formatMessage({
id: 'booking.scandicFriendsMemberPrice',
defaultMessage: 'Scandic Friends member price',
id: "booking.scandicFriendsMemberPrice",
defaultMessage: "Scandic Friends member price",
description: {
context:
'Member price label in white label partner sites',
"Member price label in white label partner sites",
},
})
: intl.formatMessage({
id: 'booking.memberPrice',
defaultMessage: 'Member price',
id: "booking.memberPrice",
defaultMessage: "Member price",
})}
</p>
</Typography>
@@ -73,8 +73,8 @@ export function HotelPriceCard({
>
<p>
{intl.formatMessage({
id: 'booking.standardPrice',
defaultMessage: 'Standard price',
id: "booking.standardPrice",
defaultMessage: "Standard price",
})}
</p>
</Typography>
@@ -89,8 +89,8 @@ export function HotelPriceCard({
>
<p>
{intl.formatMessage({
id: 'common.from',
defaultMessage: 'From',
id: "common.from",
defaultMessage: "From",
})}
</p>
</Typography>
@@ -121,8 +121,8 @@ export function HotelPriceCard({
<span className={styles.perNight}>
/
{intl.formatMessage({
id: 'common.night',
defaultMessage: 'night',
id: "common.night",
defaultMessage: "night",
})}
</span>
</p>
@@ -139,8 +139,8 @@ export function HotelPriceCard({
>
<p>
{intl.formatMessage({
id: 'booking.approx',
defaultMessage: 'Approx.',
id: "booking.approx",
defaultMessage: "Approx.",
})}
</p>
</Typography>
@@ -173,8 +173,8 @@ export function HotelPriceCard({
>
<p>
{intl.formatMessage({
id: 'common.total',
defaultMessage: 'Total',
id: "common.total",
defaultMessage: "Total",
})}
</p>
</Typography>

View File

@@ -1,9 +1,9 @@
import { useIntl } from 'react-intl'
import { useIntl } from "react-intl"
import Caption from '../../Caption'
import Subtitle from '../../Subtitle'
import Caption from "../../Caption"
import Subtitle from "../../Subtitle"
import styles from './hotelVoucherCard.module.css'
import styles from "./hotelVoucherCard.module.css"
type ProductTypeVoucher = {
numberOfVouchers: number
@@ -20,8 +20,8 @@ export default function HotelVoucherCard({
<div className={styles.voucherRow}>
<Caption>
{intl.formatMessage({
id: 'common.from',
defaultMessage: 'From',
id: "common.from",
defaultMessage: "From",
})}
</Caption>
<div className={styles.voucher}>
@@ -31,9 +31,9 @@ export default function HotelVoucherCard({
<Caption color="uiTextHighContrast" className={styles.currency}>
{intl.formatMessage(
{
id: 'price.numberOfVouchers',
id: "price.numberOfVouchers",
defaultMessage:
'{numberOfVouchers, plural, one {Voucher} other {Vouchers}}',
"{numberOfVouchers, plural, one {Voucher} other {Vouchers}}",
},
{
numberOfVouchers: productTypeVoucher.numberOfVouchers,

View File

@@ -1,9 +1,9 @@
import { useIntl } from 'react-intl'
import { useIntl } from "react-intl"
import { MaterialIcon } from '../../Icons/MaterialIcon'
import { Typography } from '../../Typography'
import { MaterialIcon } from "../../Icons/MaterialIcon"
import { Typography } from "../../Typography"
import styles from './noPriceAvailable.module.css'
import styles from "./noPriceAvailable.module.css"
export function NoPriceAvailableCard() {
const intl = useIntl()
@@ -14,9 +14,9 @@ export function NoPriceAvailableCard() {
<Typography variant="Body/Paragraph/mdRegular">
<span>
{intl.formatMessage({
id: 'booking.noRoomsAvailable',
id: "booking.noRoomsAvailable",
defaultMessage:
'There are no rooms available that match your request.',
"There are no rooms available that match your request.",
})}
</span>
</Typography>

View File

@@ -1,5 +1,5 @@
import { useIntl } from 'react-intl'
import { Typography } from '../../Typography'
import { useIntl } from "react-intl"
import { Typography } from "../../Typography"
interface RoomPriceProps extends React.HTMLAttributes<HTMLParagraphElement> {
price: number
@@ -31,8 +31,8 @@ export function RoomPrice({
<span>
/
{intl.formatMessage({
id: 'common.night',
defaultMessage: 'night',
id: "common.night",
defaultMessage: "night",
})}
</span>
</Typography>

View File

@@ -1,42 +1,42 @@
'use client'
"use client"
import NextLink from 'next/link'
import { type ReadonlyURLSearchParams, useSearchParams } from 'next/navigation'
import { memo, useState } from 'react'
import { useFocusWithin } from 'react-aria'
import { useIntl } from 'react-intl'
import NextLink from "next/link"
import { type ReadonlyURLSearchParams, useSearchParams } from "next/navigation"
import { memo, useState } from "react"
import { useFocusWithin } from "react-aria"
import { useIntl } from "react-intl"
import {
alternativeHotelsMap,
selectHotelMap,
selectRate,
} from '@scandic-hotels/common/constants/routes/hotelReservation'
import { getSingleDecimal } from '@scandic-hotels/common/utils/numberFormatting'
import Caption from '../Caption'
import { Divider } from '../Divider'
import { FacilityToIcon } from '../FacilityToIcon'
import HotelLogoIcon from '../Icons/Logos'
import ImageGallery, { GalleryImage } from '../ImageGallery'
import Link from '../OldDSLink'
import { Typography } from '../Typography'
import { HotelPointsRow } from './HotelPointsRow'
import { NoPriceAvailableCard } from './NoPriceAvailableCard'
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting"
import Caption from "../Caption"
import { Divider } from "../Divider"
import { FacilityToIcon } from "../FacilityToIcon"
import HotelLogoIcon from "../Icons/Logos"
import ImageGallery, { GalleryImage } from "../ImageGallery"
import Link from "../OldDSLink"
import { Typography } from "../Typography"
import { HotelPointsRow } from "./HotelPointsRow"
import { NoPriceAvailableCard } from "./NoPriceAvailableCard"
import HotelChequeCard from './HotelChequeCard'
import { HotelPriceCard } from './HotelPriceCard'
import HotelVoucherCard from './HotelVoucherCard'
import { hotelCardVariants } from './variants'
import HotelChequeCard from "./HotelChequeCard"
import { HotelPriceCard } from "./HotelPriceCard"
import HotelVoucherCard from "./HotelVoucherCard"
import { hotelCardVariants } from "./variants"
import styles from './hotelCard.module.css'
import styles from "./hotelCard.module.css"
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
import { FacilityEnum } from '@scandic-hotels/common/constants/facilities'
import { HotelType } from '@scandic-hotels/common/constants/hotelType'
import type { Lang } from '@scandic-hotels/common/constants/language'
import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType'
import { BookingCodeChip } from '../BookingCodeChip'
import { FakeButton } from '../FakeButton'
import { TripAdvisorChip } from '../TripAdvisorChip'
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { FacilityEnum } from "@scandic-hotels/common/constants/facilities"
import { HotelType } from "@scandic-hotels/common/constants/hotelType"
import type { Lang } from "@scandic-hotels/common/constants/language"
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
import { BookingCodeChip } from "../BookingCodeChip"
import { FakeButton } from "../FakeButton"
import { TripAdvisorChip } from "../TripAdvisorChip"
type Price = {
pricePerStay: number
@@ -104,8 +104,8 @@ export type HotelCardProps = {
images: GalleryImage[]
distanceToCityCenter: number
isUserLoggedIn: boolean
type?: 'mapListing' | 'pageListing'
state?: 'default' | 'active'
type?: "mapListing" | "pageListing"
state?: "default" | "active"
bookingCode?: string | null
isAlternative?: boolean
isPartnerBrand: boolean
@@ -129,9 +129,9 @@ export const HotelCardComponent = memo(
hotel,
distanceToCityCenter,
isUserLoggedIn,
state = 'default',
type = 'pageListing',
bookingCode = '',
state = "default",
type = "pageListing",
bookingCode = "",
isAlternative,
isPartnerBrand,
pointsCurrency,
@@ -179,8 +179,8 @@ export const HotelCardComponent = memo(
(r) => r.hasEnoughPoints
)
const notEnoughPointsLabel = intl.formatMessage({
id: 'booking.notEnoughPoints',
defaultMessage: 'Not enough points',
id: "booking.notEnoughPoints",
defaultMessage: "Not enough points",
})
const isDisabled = prices?.redemptions?.length && hasInsufficientPoints
@@ -230,12 +230,12 @@ export const HotelCardComponent = memo(
</Typography>
<div className={styles.addressContainer}>
<address className={styles.address}>
{type == 'mapListing' && (
{type == "mapListing" && (
<Typography variant="Body/Supporting text (caption)/smRegular">
<p>{addressStr}</p>
</Typography>
)}
{type === 'pageListing' && (
{type === "pageListing" && (
<Link
size="small"
textDecoration="underline"
@@ -243,8 +243,8 @@ export const HotelCardComponent = memo(
href={mapUrl}
keepSearchParams
aria-label={intl.formatMessage({
id: 'destination.seeOnMap',
defaultMessage: 'See on map',
id: "destination.seeOnMap",
defaultMessage: "See on map",
})}
>
<Typography variant="Body/Supporting text (caption)/smRegular">
@@ -261,8 +261,8 @@ export const HotelCardComponent = memo(
<span>
{intl.formatMessage(
{
id: 'common.kmToCityCenter',
defaultMessage: '{number} km to city center',
id: "common.kmToCityCenter",
defaultMessage: "{number} km to city center",
},
{
number: getSingleDecimal(distanceToCityCenter / 1000),
@@ -343,8 +343,8 @@ export const HotelCardComponent = memo(
<div className={styles.pointsCard}>
<Caption>
{intl.formatMessage({
id: 'hotelCard.availableRates',
defaultMessage: 'Available rates',
id: "hotelCard.availableRates",
defaultMessage: "Available rates",
})}
</Caption>
{prices.redemptions.map((redemption) => (
@@ -371,8 +371,8 @@ export const HotelCardComponent = memo(
{isDisabled
? notEnoughPointsLabel
: intl.formatMessage({
id: 'common.seeRooms',
defaultMessage: 'See rooms',
id: "common.seeRooms",
defaultMessage: "See rooms",
})}
</FakeButton>
</>
@@ -415,11 +415,11 @@ function PricesWrapper({
}
const params = new URLSearchParams(searchParams)
params.delete('city')
params.set('hotel', hotelId)
params.delete("city")
params.set("hotel", hotelId)
if (removeBookingCodeFromSearchParams) {
params.delete('bookingCode')
params.delete("bookingCode")
}
const href = `${pathname}?${params.toString()}`

View File

@@ -1,6 +1,6 @@
import { cva } from 'class-variance-authority'
import { cva } from "class-variance-authority"
import styles from './hotelCard.module.css'
import styles from "./hotelCard.module.css"
export const hotelCardVariants = cva(styles.card, {
variants: {
@@ -14,7 +14,7 @@ export const hotelCardVariants = cva(styles.card, {
},
},
defaultVariants: {
type: 'pageListing',
state: 'default',
type: "pageListing",
state: "default",
},
})