From 80c33274194409bb0f65352d40e44a9499fe0436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Wed, 27 Aug 2025 09:22:37 +0000 Subject: [PATCH] Merged in fix/linting (pull request #2708) Fix/linting * fix import issues and add lint check no-extraneous-dependencies * fix use type HotelType instead of string Approved-by: Anton Gunnarsson --- apps/partner-sas/eslint.config.mjs | 2 +- .../Map/MapContent/Marker/index.tsx | 4 ++- .../ContentType/HotelMapPage/Client.tsx | 2 +- .../ContentType/HotelMapPage/index.tsx | 4 ++- .../ContentType/HotelPage/index.tsx | 4 ++- .../components/hotelPage/map/staticMap.ts | 2 +- packages/booking-flow/eslint.config.mjs | 2 +- packages/booking-flow/lint-staged.config.mjs | 6 +++- packages/common/eslint.config.mjs | 2 +- packages/common/lint-staged.config.js | 6 +++- packages/design-system/eslint.config.mjs | 33 ++++++++++++++++++- .../BookingCodeChip.stories.tsx | 2 +- .../lib/components/BookingCodeChip/index.tsx | 10 +++--- .../lib/components/Button/Button.stories.tsx | 2 -- .../lib/components/Chip/index.tsx | 2 +- .../lib/components/DeprecatedSelect/index.tsx | 4 ++- .../FacilityToIcon/FacilityToIcon.stories.tsx | 2 +- .../HotelCard/HotelCard.stories.tsx | 8 ++--- .../HotelCard/HotelCardDialogImage/index.tsx | 4 +-- .../HotelCard/HotelCardSkeleton.tsx | 2 +- .../HotelCard/HotelChequeCard/index.tsx | 17 ++++++++-- .../StandaloneHotelCardDialog.stories.tsx | 2 +- .../StandaloneHotelCardDialog/index.tsx | 20 +++++------ .../HotelCard/HotelPointsRow/index.tsx | 4 +-- .../HotelCard/HotelPriceCard/index.tsx | 8 ++--- .../HotelCard/HotelVoucherCard/index.tsx | 8 +++-- .../HotelCard/NoPriceAvailableCard/index.tsx | 4 +-- .../lib/components/HotelCard/index.tsx | 16 ++++----- .../components/JsonToHtml/renderOptions.tsx | 14 ++++---- .../components/Lightbox/FullView/index.tsx | 1 + .../HotelListingMapContent/HotelPin/index.tsx | 8 ++--- .../InteractiveMap/PoiMapMarkers/index.tsx | 6 ++-- .../components/Map/InteractiveMap/index.tsx | 12 +++---- .../Map/Markers/HotelMarkerByType.stories.tsx | 10 +++--- .../Map/Markers/HotelMarkerByType.tsx | 25 +++++++------- .../Map/Markers/PoiMarker/index.tsx | 2 +- .../lib/components/Map/Markers/utils.ts | 2 +- .../design-system/lib/components/Map/types.ts | 27 +++++++++++++++ .../AlternateOpeningHours/index.tsx | 4 +-- .../OpeningHours/openingHours.test.ts | 18 +++++----- .../ParkingPrices/index.tsx | 1 + .../components/RateCard/Campaign/index.tsx | 4 +++ .../lib/components/RateCard/Code/index.tsx | 3 ++ .../RateCard/NoRateAvailable/index.tsx | 1 + .../lib/components/RateCard/Points/index.tsx | 4 +++ .../lib/components/RateCard/Regular/index.tsx | 4 +++ .../lib/components/SkeletonShimmer/index.tsx | 1 + .../lib/components/TripAdvisorChip/index.tsx | 4 +-- packages/design-system/lib/tokens/Colors.tsx | 1 + packages/design-system/lint-staged.config.js | 6 +++- packages/design-system/package.json | 4 +++ packages/trpc/eslint.config.mjs | 2 +- packages/trpc/lint-staged.config.mjs | 6 +++- turbo.json | 30 ++++++++--------- yarn.lock | 3 ++ 55 files changed, 250 insertions(+), 135 deletions(-) diff --git a/apps/partner-sas/eslint.config.mjs b/apps/partner-sas/eslint.config.mjs index 655d9fd40..8b311a2fb 100644 --- a/apps/partner-sas/eslint.config.mjs +++ b/apps/partner-sas/eslint.config.mjs @@ -29,7 +29,7 @@ export default defineConfig([ "react/function-component-definition": "error", "import/no-relative-packages": "error", "simple-import-sort/imports": [ - "error", + "warn", { groups: [ ["^\\u0000"], diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Map/MapContent/Marker/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Map/MapContent/Marker/index.tsx index 5443269ae..720d8eb0b 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Map/MapContent/Marker/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Map/MapContent/Marker/index.tsx @@ -16,6 +16,8 @@ import { trackMapClick } from "@/utils/tracking/destinationPage" import HotelMapCard from "../../../HotelMapCard" +import type { HotelType } from "@scandic-hotels/common/constants/hotelType" + import type { MarkerProperties } from "@/types/components/maps/destinationMarkers" interface MarkerProps { @@ -60,7 +62,7 @@ export default function Marker({ position, properties }: MarkerProps) { {isActive && isDesktop && ( diff --git a/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx b/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx index 05fe81a3f..879cd9c8a 100644 --- a/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx +++ b/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx @@ -24,8 +24,8 @@ import Sidebar from "./Sidebar" import styles from "./hotelMapPage.module.css" +import type { MarkerInfo } from "@scandic-hotels/design-system/Map/types" import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" -import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker" import type { Coordinates } from "@/types/components/maps/coordinates" diff --git a/apps/scandic-web/components/ContentType/HotelMapPage/index.tsx b/apps/scandic-web/components/ContentType/HotelMapPage/index.tsx index 3f18d6a39..ec4a344e5 100644 --- a/apps/scandic-web/components/ContentType/HotelMapPage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelMapPage/index.tsx @@ -7,6 +7,8 @@ import { getLang } from "@/i18n/serverContext" import HotelMapPageClient from "./Client" +import type { HotelType } from "@scandic-hotels/common/constants/hotelType" + interface HotelMapPageProps { hotelId: string } @@ -35,7 +37,7 @@ export default async function HotelMapPage({ hotelId }: HotelMapPageProps) { apiKey={env.GOOGLE_STATIC_MAP_KEY} mapId={env.GOOGLE_DYNAMIC_MAP_ID} hotelName={name} - markerInfo={{ hotelId, hotelType }} + markerInfo={{ hotelId, hotelType: hotelType as HotelType }} // TODO: Update attributes schema instead coordinates={coordinates} pointsOfInterest={pointsOfInterest} /> diff --git a/apps/scandic-web/components/ContentType/HotelPage/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/index.tsx index 834394167..2dd2f6f47 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/index.tsx @@ -51,6 +51,8 @@ import { import styles from "./hotelPage.module.css" +import type { HotelType } from "@scandic-hotels/common/constants/hotelType" + import type { HotelPageProps } from "@/types/components/hotelPage/hotelPage" import { AlertName } from "@/types/enums/alert" import { HotelHashValues } from "@/types/enums/hotelPage" @@ -242,7 +244,7 @@ export default async function HotelPage({ hotelId }: HotelPageProps) { "tsc -p tsconfig.json --noEmit", "prettier --write"], + "*.{ts,tsx}": [ + () => "yarn lint", + () => "tsc -p tsconfig.json --noEmit", + "prettier --write", + ], "*.{js,cjs,mjs}": "prettier --write", } diff --git a/packages/common/eslint.config.mjs b/packages/common/eslint.config.mjs index 6aa5464e2..2ddf3bd80 100644 --- a/packages/common/eslint.config.mjs +++ b/packages/common/eslint.config.mjs @@ -33,7 +33,7 @@ export default defineConfig([ "no-unused-vars": "off", "import/no-relative-packages": "error", "simple-import-sort/imports": [ - "error", + "warn", { groups: [ ["^\\u0000"], diff --git a/packages/common/lint-staged.config.js b/packages/common/lint-staged.config.js index e314384e5..87a7ea8f8 100644 --- a/packages/common/lint-staged.config.js +++ b/packages/common/lint-staged.config.js @@ -1,5 +1,9 @@ const config = { - "*.{ts,tsx}": [() => "tsc -p tsconfig.json --noEmit", "prettier --write"], + "*.{ts,tsx}": [ + () => "yarn lint", + () => "tsc -p tsconfig.json --noEmit", + "prettier --write", + ], "*.{json,md}": "prettier --write", "*.{html,js,cjs,mjs,css}": "prettier --write", } diff --git a/packages/design-system/eslint.config.mjs b/packages/design-system/eslint.config.mjs index e4749dda2..e58a3805c 100644 --- a/packages/design-system/eslint.config.mjs +++ b/packages/design-system/eslint.config.mjs @@ -7,11 +7,16 @@ import js from '@eslint/js' import importPlugin from 'eslint-plugin-import' import formatjs from 'eslint-plugin-formatjs' +import { fileURLToPath } from 'node:url' +import path from 'node:path' + const compat = new FlatCompat({ recommendedConfig: js.configs.recommended, allConfig: js.configs.all, }) +const packageDir = path.dirname(fileURLToPath(import.meta.url)) + export default defineConfig([ { languageOptions: { @@ -31,8 +36,28 @@ export default defineConfig([ import: importPlugin, formatjs, }, + settings: { + // Ensure the plugin can resolve workspace packages and TS path aliases + 'import/resolver': { + typescript: { + project: [path.join(packageDir, 'tsconfig.json')], + alwaysTryTypes: true, + }, + node: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + }, + }, + }, rules: { 'import/no-relative-packages': 'error', + 'import/no-extraneous-dependencies': [ + 'error', + { + includeInternal: true, + includeTypes: true, + packageDir: [packageDir], + }, + ], 'react-refresh/only-export-components': [ 'warn', { @@ -53,5 +78,11 @@ export default defineConfig([ 'formatjs/prefer-pound-in-plural': ['error'], }, }, - globalIgnores(['**/dist', '**/.eslintrc.cjs']), + { + files: ['**/*.stories.tsx'], + rules: { + 'formatjs/no-literal-string-in-jsx': 'off', + }, + }, + globalIgnores(['**/dist', '**/.eslintrc.cjs', '**/storybook-static']), ]) diff --git a/packages/design-system/lib/components/BookingCodeChip/BookingCodeChip.stories.tsx b/packages/design-system/lib/components/BookingCodeChip/BookingCodeChip.stories.tsx index 63c7b624e..8f30ec938 100644 --- a/packages/design-system/lib/components/BookingCodeChip/BookingCodeChip.stories.tsx +++ b/packages/design-system/lib/components/BookingCodeChip/BookingCodeChip.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { fn } from 'storybook/test' import { BookingCodeChip } from './index' diff --git a/packages/design-system/lib/components/BookingCodeChip/index.tsx b/packages/design-system/lib/components/BookingCodeChip/index.tsx index 5c81519b7..b07d3a8a4 100644 --- a/packages/design-system/lib/components/BookingCodeChip/index.tsx +++ b/packages/design-system/lib/components/BookingCodeChip/index.tsx @@ -1,11 +1,11 @@ import { Button as ButtonRAC } from 'react-aria-components' import { useIntl } from 'react-intl' -import IconChip from '@scandic-hotels/design-system/IconChip' -import DiscountIcon from '@scandic-hotels/design-system/Icons/DiscountIcon' -import FilledDiscountIcon from '@scandic-hotels/design-system/Icons/FilledDiscountIcon' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' -import { Typography } from '@scandic-hotels/design-system/Typography' +import IconChip from '../IconChip' +import DiscountIcon from '../Icons/Nucleo/Benefits/discount-2-2' +import FilledDiscountIcon from '../Icons/Nucleo/Benefits/FilledDiscount' +import { MaterialIcon } from '../Icons/MaterialIcon' +import { Typography } from '../Typography' import styles from './bookingCodeChip.module.css' diff --git a/packages/design-system/lib/components/Button/Button.stories.tsx b/packages/design-system/lib/components/Button/Button.stories.tsx index 9990cd671..33cfeebd0 100644 --- a/packages/design-system/lib/components/Button/Button.stories.tsx +++ b/packages/design-system/lib/components/Button/Button.stories.tsx @@ -556,7 +556,6 @@ export const TextWithIcon: Story = { args: { onPress: fn(), children: ( - // eslint-disable-next-line formatjs/no-literal-string-in-jsx <> Text with icon @@ -578,7 +577,6 @@ export const TextWithIconInverted: Story = { args: { onPress: fn(), children: ( - // eslint-disable-next-line formatjs/no-literal-string-in-jsx <> Text with icon diff --git a/packages/design-system/lib/components/Chip/index.tsx b/packages/design-system/lib/components/Chip/index.tsx index d5a5740d4..4421efc76 100644 --- a/packages/design-system/lib/components/Chip/index.tsx +++ b/packages/design-system/lib/components/Chip/index.tsx @@ -1,4 +1,4 @@ -import Footnote from '@scandic-hotels/design-system/Footnote' +import Footnote from '../Footnote' import { chipVariants } from './variants' import { VariantProps } from 'class-variance-authority' diff --git a/packages/design-system/lib/components/DeprecatedSelect/index.tsx b/packages/design-system/lib/components/DeprecatedSelect/index.tsx index 5ef0e7e40..f2d71bc46 100644 --- a/packages/design-system/lib/components/DeprecatedSelect/index.tsx +++ b/packages/design-system/lib/components/DeprecatedSelect/index.tsx @@ -35,6 +35,8 @@ interface SelectProps type SelectPortalContainer = HTMLDivElement | undefined type SelectPortalContainerArgs = HTMLDivElement | null +const DELIMITER = ':' + /** * @deprecated Do not use. */ @@ -102,7 +104,7 @@ export default function Select({ size={discreet ? 'discreet' : 'regular'} > {label} - {discreet && `:`} + {discreet && DELIMITER} {selectedText && ( diff --git a/packages/design-system/lib/components/FacilityToIcon/FacilityToIcon.stories.tsx b/packages/design-system/lib/components/FacilityToIcon/FacilityToIcon.stories.tsx index b7524430f..8c94b4598 100644 --- a/packages/design-system/lib/components/FacilityToIcon/FacilityToIcon.stories.tsx +++ b/packages/design-system/lib/components/FacilityToIcon/FacilityToIcon.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { FacilityEnum } from '@scandic-hotels/common/constants/facilities' diff --git a/packages/design-system/lib/components/HotelCard/HotelCard.stories.tsx b/packages/design-system/lib/components/HotelCard/HotelCard.stories.tsx index 6aff911df..4037d047f 100644 --- a/packages/design-system/lib/components/HotelCard/HotelCard.stories.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelCard.stories.tsx @@ -1,10 +1,9 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { HotelCard } from './index' import { fn } from 'storybook/test' import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType' -import { HotelTypeEnum } from '@scandic-hotels/trpc/enums/hotelType' -import { Button } from '@scandic-hotels/design-system/Button' +import { Button } from '../Button' import { MaterialIcon } from '../Icons/MaterialIcon' const meta: Meta = { @@ -37,7 +36,7 @@ export const Default: Story = { name: 'Test Hotel', address: { streetAddress: '123 Test Street', city: 'Test City' }, description: 'A great place to stay.', - hotelType: HotelTypeEnum.Signature, + hotelType: 'signature', detailedFacilities: [], ratings: { tripAdvisor: 4, @@ -81,7 +80,6 @@ export const Default: Story = { onPress={() => fn()} variant="Text" typography="Body/Paragraph/mdBold" - // eslint-disable-next-line formatjs/no-literal-string-in-jsx > Read more diff --git a/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx b/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx index e84ed04e5..70fa45f6b 100644 --- a/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx @@ -1,7 +1,7 @@ -import Image from '@scandic-hotels/design-system/Image' +import Image from '../../Image' import { hotelCardDialogImageVariants } from './variants' -import { TripAdvisorChip } from '@scandic-hotels/design-system/TripAdvisorChip' +import { TripAdvisorChip } from '../../TripAdvisorChip' import styles from './hotelCardDialogImage.module.css' diff --git a/packages/design-system/lib/components/HotelCard/HotelCardSkeleton.tsx b/packages/design-system/lib/components/HotelCard/HotelCardSkeleton.tsx index 66c553f91..00dcd6558 100644 --- a/packages/design-system/lib/components/HotelCard/HotelCardSkeleton.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelCardSkeleton.tsx @@ -1,4 +1,4 @@ -import SkeletonShimmer from '@scandic-hotels/design-system/SkeletonShimmer' +import SkeletonShimmer from '../SkeletonShimmer' import styles from './HotelCardSkeleton.module.css' diff --git a/packages/design-system/lib/components/HotelCard/HotelChequeCard/index.tsx b/packages/design-system/lib/components/HotelCard/HotelChequeCard/index.tsx index be0343c32..b9b70802a 100644 --- a/packages/design-system/lib/components/HotelCard/HotelChequeCard/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelChequeCard/index.tsx @@ -1,12 +1,23 @@ import { useIntl } from 'react-intl' import { CurrencyEnum } from '@scandic-hotels/common/constants/currency' -import Caption from '@scandic-hotels/design-system/Caption' -import Subtitle from '@scandic-hotels/design-system/Subtitle' +import Caption from '../../Caption' +import Subtitle from '../../Subtitle' import styles from './hotelChequeCard.module.css' -import type { ProductTypeCheque } from '@scandic-hotels/trpc/types/availability' +type ProductTypeCheque = { + localPrice: { + numberOfCheques: number + additionalPricePerStay: number + currency: CurrencyEnum | null | undefined + } + requestedPrice?: { + numberOfCheques: number + additionalPricePerStay: number + currency: CurrencyEnum | null | undefined + } +} export default function HotelChequeCard({ productTypeCheque, diff --git a/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/StandaloneHotelCardDialog.stories.tsx b/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/StandaloneHotelCardDialog.stories.tsx index 9c45db049..0a98b30d9 100644 --- a/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/StandaloneHotelCardDialog.stories.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/StandaloneHotelCardDialog.stories.tsx @@ -1,4 +1,4 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' +import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { StandaloneHotelCardDialog } from './index' import { fn } from 'storybook/test' diff --git a/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/index.tsx b/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/index.tsx index c468309f5..d64e1edc5 100644 --- a/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelDialogCard/StandaloneHotelCardDialog/index.tsx @@ -4,15 +4,15 @@ import { useState } from 'react' import { useIntl } from 'react-intl' import { selectRate } from '@scandic-hotels/common/constants/routes/hotelReservation' -import Body from '@scandic-hotels/design-system/Body' -import Caption from '@scandic-hotels/design-system/Caption' -import Footnote from '@scandic-hotels/design-system/Footnote' -import { IconButton } from '@scandic-hotels/design-system/IconButton' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' -import Link from '@scandic-hotels/design-system/Link' -import { OldDSButton as Button } from '@scandic-hotels/design-system/OldDSButton' -import Subtitle from '@scandic-hotels/design-system/Subtitle' -import { Typography } from '@scandic-hotels/design-system/Typography' +import Body from '../../../Body' +import Caption from '../../../Caption' +import Footnote from '../../../Footnote' +import { IconButton } from '../../../IconButton' +import { MaterialIcon } from '../../../Icons/MaterialIcon' +import Link from '../../../Link' +import { OldDSButton as Button } from '../../../OldDSButton' +import Subtitle from '../../../Subtitle' +import { Typography } from '../../../Typography' import { NoPriceAvailableCard } from '../../NoPriceAvailableCard' import { HotelCardDialogImage } from '../../HotelCardDialogImage' @@ -20,7 +20,7 @@ import { HotelCardDialogImage } from '../../HotelCardDialogImage' import styles from './standaloneHotelCardDialog.module.css' import { Lang } from '@scandic-hotels/common/constants/language' import { HotelPin } from '../../../Map/types' -import { FacilityToIcon } from '@scandic-hotels/design-system/FacilityToIcon' +import { FacilityToIcon } from '../../../FacilityToIcon' import { HotelPointsRow } from '../../HotelPointsRow' interface StandaloneHotelCardProps { diff --git a/packages/design-system/lib/components/HotelCard/HotelPointsRow/index.tsx b/packages/design-system/lib/components/HotelCard/HotelPointsRow/index.tsx index 555b4695f..1514fb59d 100644 --- a/packages/design-system/lib/components/HotelCard/HotelPointsRow/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelPointsRow/index.tsx @@ -1,7 +1,7 @@ import { useIntl } from 'react-intl' -import Caption from '@scandic-hotels/design-system/Caption' -import Subtitle from '@scandic-hotels/design-system/Subtitle' +import Caption from '../../Caption' +import Subtitle from '../../Subtitle' import styles from './hotelPointsRow.module.css' diff --git a/packages/design-system/lib/components/HotelCard/HotelPriceCard/index.tsx b/packages/design-system/lib/components/HotelCard/HotelPriceCard/index.tsx index 138a53f07..411289fec 100644 --- a/packages/design-system/lib/components/HotelCard/HotelPriceCard/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelPriceCard/index.tsx @@ -1,10 +1,10 @@ import { cx } from 'class-variance-authority' import { useIntl } from 'react-intl' -import Body from '@scandic-hotels/design-system/Body' -import Caption from '@scandic-hotels/design-system/Caption' -import { Divider } from '@scandic-hotels/design-system/Divider' -import Subtitle from '@scandic-hotels/design-system/Subtitle' +import Body from '../../Body' +import Caption from '../../Caption' +import { Divider } from '../../Divider' +import Subtitle from '../../Subtitle' import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType' import styles from './hotelPriceCard.module.css' diff --git a/packages/design-system/lib/components/HotelCard/HotelVoucherCard/index.tsx b/packages/design-system/lib/components/HotelCard/HotelVoucherCard/index.tsx index d2e38c466..e96967359 100644 --- a/packages/design-system/lib/components/HotelCard/HotelVoucherCard/index.tsx +++ b/packages/design-system/lib/components/HotelCard/HotelVoucherCard/index.tsx @@ -1,12 +1,14 @@ import { useIntl } from 'react-intl' import { CurrencyEnum } from '@scandic-hotels/common/constants/currency' -import Caption from '@scandic-hotels/design-system/Caption' -import Subtitle from '@scandic-hotels/design-system/Subtitle' +import Caption from '../../Caption' +import Subtitle from '../../Subtitle' import styles from './hotelVoucherCard.module.css' -import type { ProductTypeVoucher } from '@scandic-hotels/trpc/types/availability' +type ProductTypeVoucher = { + numberOfVouchers: number +} export default function HotelVoucherCard({ productTypeVoucher, diff --git a/packages/design-system/lib/components/HotelCard/NoPriceAvailableCard/index.tsx b/packages/design-system/lib/components/HotelCard/NoPriceAvailableCard/index.tsx index 4f9efa925..f79081426 100644 --- a/packages/design-system/lib/components/HotelCard/NoPriceAvailableCard/index.tsx +++ b/packages/design-system/lib/components/HotelCard/NoPriceAvailableCard/index.tsx @@ -1,7 +1,7 @@ import { useIntl } from 'react-intl' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { MaterialIcon } from '../../Icons/MaterialIcon' +import { Typography } from '../../Typography' import styles from './noPriceAvailable.module.css' diff --git a/packages/design-system/lib/components/HotelCard/index.tsx b/packages/design-system/lib/components/HotelCard/index.tsx index c0558fa22..a2061cc37 100644 --- a/packages/design-system/lib/components/HotelCard/index.tsx +++ b/packages/design-system/lib/components/HotelCard/index.tsx @@ -11,17 +11,15 @@ import { selectRate, } from '@scandic-hotels/common/constants/routes/hotelReservation' import { getSingleDecimal } from '@scandic-hotels/common/utils/numberFormatting' -import Caption from '@scandic-hotels/design-system/Caption' -import { Divider } from '@scandic-hotels/design-system/Divider' -import { FacilityToIcon } from '@scandic-hotels/design-system/FacilityToIcon' -import HotelLogoIcon from '@scandic-hotels/design-system/Icons/HotelLogoIcon' -import ImageGallery, { - GalleryImage, -} from '@scandic-hotels/design-system/ImageGallery' +import Caption from '../Caption' +import { Divider } from '../Divider' +import { FacilityToIcon } from '../FacilityToIcon' +import HotelLogoIcon from '../Icons/Logos' +import ImageGallery, { GalleryImage } from '../ImageGallery' import { HotelPointsRow } from './HotelPointsRow' import { NoPriceAvailableCard } from './NoPriceAvailableCard' -import Link from '@scandic-hotels/design-system/Link' -import { Typography } from '@scandic-hotels/design-system/Typography' +import Link from '../Link' +import { Typography } from '../Typography' import HotelChequeCard from './HotelChequeCard' import { HotelPriceCard } from './HotelPriceCard' diff --git a/packages/design-system/lib/components/JsonToHtml/renderOptions.tsx b/packages/design-system/lib/components/JsonToHtml/renderOptions.tsx index c8e708838..be2ab06b9 100644 --- a/packages/design-system/lib/components/JsonToHtml/renderOptions.tsx +++ b/packages/design-system/lib/components/JsonToHtml/renderOptions.tsx @@ -1,12 +1,12 @@ import { cx } from 'class-variance-authority' -import { Divider } from '@scandic-hotels/design-system/Divider' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' -import Image from '@scandic-hotels/design-system/Image' -import ImageContainer from '@scandic-hotels/design-system/ImageContainer' -import Link from '@scandic-hotels/design-system/Link' -import Table from '@scandic-hotels/design-system/Table' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { Divider } from '../Divider' +import { MaterialIcon } from '../Icons/MaterialIcon' +import Image from '../Image' +import ImageContainer from '../ImageContainer' +import Link from '../Link' +import Table from '../Table' +import { Typography } from '../Typography' import { hasAvailableParagraphFormat, diff --git a/packages/design-system/lib/components/Lightbox/FullView/index.tsx b/packages/design-system/lib/components/Lightbox/FullView/index.tsx index 7b0b78744..02ec26615 100644 --- a/packages/design-system/lib/components/Lightbox/FullView/index.tsx +++ b/packages/design-system/lib/components/Lightbox/FullView/index.tsx @@ -94,6 +94,7 @@ export default function FullView({
+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${currentIndex + 1} / ${totalImages}`} diff --git a/packages/design-system/lib/components/Map/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx b/packages/design-system/lib/components/Map/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx index 064d28817..e0871de33 100644 --- a/packages/design-system/lib/components/Map/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx +++ b/packages/design-system/lib/components/Map/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx @@ -1,8 +1,8 @@ import { useIntl } from 'react-intl' import { formatPrice } from '@scandic-hotels/common/utils/numberFormatting' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { MaterialIcon } from '../../../../Icons/MaterialIcon' +import { Typography } from '../../../../Typography' import HotelMarker from '../../../Markers/HotelMarker' @@ -15,7 +15,7 @@ interface HotelPinProps { hotelAdditionalPrice?: number hotelAdditionalCurrency?: string } - +const NOT_AVAILABLE = '-' export function HotelPin({ isActive, hotelPrice, @@ -45,7 +45,7 @@ export function HotelPin({

{isNotAvailable - ? '—' + ? NOT_AVAILABLE : formatPrice( intl, hotelPrice, diff --git a/packages/design-system/lib/components/Map/InteractiveMap/PoiMapMarkers/index.tsx b/packages/design-system/lib/components/Map/InteractiveMap/PoiMapMarkers/index.tsx index c8a6d26a7..481a65dbd 100644 --- a/packages/design-system/lib/components/Map/InteractiveMap/PoiMapMarkers/index.tsx +++ b/packages/design-system/lib/components/Map/InteractiveMap/PoiMapMarkers/index.tsx @@ -4,15 +4,13 @@ import { } from '@vis.gl/react-google-maps' import { useIntl } from 'react-intl' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { Typography } from '../../../Typography' import { HotelMarkerByType } from '../../Markers/HotelMarkerByType' import { PoiMarker } from '../../Markers/PoiMarker' import styles from './poiMapMarkers.module.css' - -import type { PointOfInterest } from '@scandic-hotels/trpc/types/hotel' -import type { MarkerInfo } from '@scandic-hotels/trpc/types/marker' +import { MarkerInfo, PointOfInterest } from '../../types' export type PoiMapMarkersProps = { activePoi?: string | null diff --git a/packages/design-system/lib/components/Map/InteractiveMap/index.tsx b/packages/design-system/lib/components/Map/InteractiveMap/index.tsx index 00d4269ea..5ecc8dc9d 100644 --- a/packages/design-system/lib/components/Map/InteractiveMap/index.tsx +++ b/packages/design-system/lib/components/Map/InteractiveMap/index.tsx @@ -4,8 +4,8 @@ import { Map, type MapProps, useMap } from '@vis.gl/react-google-maps' import { useEffect, useState } from 'react' import { useIntl } from 'react-intl' -import { IconButton } from '@scandic-hotels/design-system/IconButton' -import { MaterialIcon } from '@scandic-hotels/design-system/Icons/MaterialIcon' +import { IconButton } from '../../IconButton' +import { MaterialIcon } from '../../Icons/MaterialIcon' import { DEFAULT_ZOOM, @@ -21,9 +21,7 @@ import PoiMapMarkers from './PoiMapMarkers' import styles from './interactiveMap.module.css' -import type { PointOfInterest } from '@scandic-hotels/trpc/types/hotel' -import type { MarkerInfo } from '@scandic-hotels/trpc/types/marker' -import { HotelPin } from '../types' +import { HotelPin, MarkerInfo, PointOfInterest } from '../types' import { Lang } from '@scandic-hotels/common/constants/language' export type InteractiveMapProps = { @@ -32,7 +30,7 @@ export type InteractiveMapProps = { lat: number lng: number } - activePoi?: PointOfInterest['name'] | null + activePoi?: string | null hotelPins?: HotelPin[] pointsOfInterest?: PointOfInterest[] markerInfo?: MarkerInfo @@ -44,7 +42,7 @@ export type InteractiveMapProps = { isUserLoggedIn: boolean onTilesLoaded?: () => void - onActivePoiChange?: (poi: PointOfInterest['name'] | null) => void + onActivePoiChange?: (poi: string | null) => void onClickHotel?: (hotelId: string) => void diff --git a/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.stories.tsx b/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.stories.tsx index 44d6ab436..8c066f331 100644 --- a/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.stories.tsx +++ b/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.stories.tsx @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { HotelMarkerByType } from './HotelMarkerByType' import { SignatureHotelEnum } from '@scandic-hotels/common/constants/signatureHotels' -import { Typography } from 'lib/components/Typography' +import { Typography } from '../../Typography' const meta: Meta = { title: 'Components/Map/Hotel Marker By Type', @@ -48,7 +48,7 @@ type Story = StoryObj export const PrimaryDefault: Story = { args: { hotelId: 'Other', - hotelType: 'Regular', + hotelType: 'regular', size: 'large', }, } @@ -56,7 +56,7 @@ export const PrimaryDefault: Story = { export const ScandicGo: Story = { args: { hotelId: 'Other', - hotelType: 'Scandic Go', + hotelType: 'scandicgo', size: 'large', }, argTypes: { @@ -76,7 +76,7 @@ export const ScandicGo: Story = { export const Signature: Story = { args: { hotelId: 'DowntownCamper', - hotelType: 'Signature', + hotelType: 'signature', size: 'large', }, argTypes: { @@ -100,7 +100,7 @@ const exampleMarkers = [ { name: 'Default', hotelId: 'Other', - hotelType: 'Regular', + hotelType: 'regular', }, { name: 'Scandic Go', diff --git a/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.tsx b/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.tsx index 6eeedc198..da2036a76 100644 --- a/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.tsx +++ b/packages/design-system/lib/components/Map/Markers/HotelMarkerByType.tsx @@ -1,5 +1,3 @@ -import { HotelTypeEnum } from '@scandic-hotels/trpc/enums/hotelType' - import { DowntownCamperMarker } from './HotelMarker/SignatureHotel/DowntownCamper' import { DowntownCamperSmallMarker } from './HotelMarker/SignatureHotel/DowntownCamperSmall' import { GrandHotelMarker } from './HotelMarker/SignatureHotel/GrandHotel' @@ -17,9 +15,14 @@ import { ScandicSmallMarker } from './HotelMarker/SignatureHotel/ScandicSmall' import { TheDockMarker } from './HotelMarker/SignatureHotel/TheDock' import { TheDockSmallMarker } from './HotelMarker/SignatureHotel/TheDockSmall' -import type { MarkerInfo } from '@scandic-hotels/trpc/types/marker' import { SignatureHotelEnum } from '@scandic-hotels/common/constants/signatureHotels' +import { + HotelTypes, + type HotelType, +} from '@scandic-hotels/common/constants/hotelType' +import { MarkerInfo } from '../types' + export interface HotelMarkerByTypeProps extends MarkerInfo, React.SVGAttributes { @@ -35,12 +38,6 @@ export function HotelMarkerByType({ size = 'large', ...props }: HotelMarkerByTypeProps) { - const typeEntry = byHotelType[hotelType as keyof typeof byHotelType] - if (typeEntry) { - const Cmp = typeEntry[size] - return - } - const sigatureHotelEntry = bySignatureHotel[hotelId as keyof typeof bySignatureHotel] if (sigatureHotelEntry) { @@ -48,6 +45,12 @@ export function HotelMarkerByType({ return } + const typeEntry = byHotelType[hotelType as keyof typeof byHotelType] + if (typeEntry) { + const Cmp = typeEntry[size] + return + } + const Cmp = defaultMarkers[size] return } @@ -58,10 +61,10 @@ const defaultMarkers: Record<'large' | 'small', MarkerComponent> = { } const byHotelType: Record< - Exclude, + Exclude, Record<'large' | 'small', MarkerComponent> > = { - [HotelTypeEnum.ScandicGo]: { + [HotelTypes.ScandicGo]: { large: ScandicGoMarker, small: ScandicGoSmallMarker, }, diff --git a/packages/design-system/lib/components/Map/Markers/PoiMarker/index.tsx b/packages/design-system/lib/components/Map/Markers/PoiMarker/index.tsx index f0d38aed4..7ec361224 100644 --- a/packages/design-system/lib/components/Map/Markers/PoiMarker/index.tsx +++ b/packages/design-system/lib/components/Map/Markers/PoiMarker/index.tsx @@ -1,4 +1,4 @@ -import { IconByIconName } from '@scandic-hotels/design-system/Icons/IconByIconName' +import { IconByIconName } from '../../../Icons/IconByIconName' import { getIconByPoiGroupAndCategory } from '../utils' import { poiVariants } from './variants' diff --git a/packages/design-system/lib/components/Map/Markers/utils.ts b/packages/design-system/lib/components/Map/Markers/utils.ts index 533fcabf0..5a17879c0 100644 --- a/packages/design-system/lib/components/Map/Markers/utils.ts +++ b/packages/design-system/lib/components/Map/Markers/utils.ts @@ -1,4 +1,4 @@ -import { IconName } from '@scandic-hotels/design-system/Icons/iconName' +import { IconName } from '../../Icons/iconName' import { PointOfInterestGroup } from './PoiMarker' export function getIconByPoiGroupAndCategory( diff --git a/packages/design-system/lib/components/Map/types.ts b/packages/design-system/lib/components/Map/types.ts index f3f3a4548..450f14f1f 100644 --- a/packages/design-system/lib/components/Map/types.ts +++ b/packages/design-system/lib/components/Map/types.ts @@ -1,5 +1,6 @@ import { CurrencyEnum } from '@scandic-hotels/common/constants/currency' import { FacilityEnum } from '@scandic-hotels/common/constants/facilities' +import { HotelType } from '@scandic-hotels/common/constants/hotelType' export type HotelPin = { bookingCode?: string | null @@ -40,3 +41,29 @@ export type HotelPin = { facilityIds: number[] hasEnoughPoints: boolean } + +export const PointOfInterestGroups = { + PublicTransport: 'Public transport', + Attractions: 'Attractions', + Business: 'Business', + Location: 'Location', + Parking: 'Parking', + ShoppingAndDining: 'Shopping & Dining', +} as const + +export type PointOfInterestGroup = + (typeof PointOfInterestGroups)[keyof typeof PointOfInterestGroups] + +export type PointOfInterest = { + id: string + categoryName: string + coordinates: { lat: number; lng: number } + distance: number + group: PointOfInterestGroup + name: string +} + +export type MarkerInfo = { + hotelId: string + hotelType: HotelType +} diff --git a/packages/design-system/lib/components/OpeningHours/AlternateOpeningHours/index.tsx b/packages/design-system/lib/components/OpeningHours/AlternateOpeningHours/index.tsx index 056dbc646..d3eeca70a 100644 --- a/packages/design-system/lib/components/OpeningHours/AlternateOpeningHours/index.tsx +++ b/packages/design-system/lib/components/OpeningHours/AlternateOpeningHours/index.tsx @@ -2,8 +2,8 @@ import { useIntl } from 'react-intl' -import { Divider } from '@scandic-hotels/design-system/Divider' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { Divider } from '../../Divider' +import { Typography } from '../../Typography' import { getGroupedOpeningHours } from '../utils' diff --git a/packages/design-system/lib/components/OpeningHours/openingHours.test.ts b/packages/design-system/lib/components/OpeningHours/openingHours.test.ts index 36d2bdcbb..3162ee847 100644 --- a/packages/design-system/lib/components/OpeningHours/openingHours.test.ts +++ b/packages/design-system/lib/components/OpeningHours/openingHours.test.ts @@ -2,8 +2,8 @@ import { describe, expect, it } from 'vitest' import { getGroupedOpeningHours } from './utils' -import type { RestaurantOpeningHours } from '@scandic-hotels/trpc/types/hotel' import type { IntlShape } from 'react-intl' +import { OpeningHours } from './openingHoursTypes' // Mock IntlShape for testing const mockIntl = { @@ -25,7 +25,7 @@ const mockIntl = { describe('getGroupedOpeningHours', () => { it('should group all days as closed', () => { - const allDaysClosed: RestaurantOpeningHours = { + const allDaysClosed: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -84,7 +84,7 @@ describe('getGroupedOpeningHours', () => { }) it('should group all days with same opening hours', () => { - const allDaysSameHours: RestaurantOpeningHours = { + const allDaysSameHours: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -143,7 +143,7 @@ describe('getGroupedOpeningHours', () => { }) it('should handle mixed opening hours', () => { - const mixedOpeningHours: RestaurantOpeningHours = { + const mixedOpeningHours: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -206,7 +206,7 @@ describe('getGroupedOpeningHours', () => { }) it('should handle always open days', () => { - const someAlwaysOpen: RestaurantOpeningHours = { + const someAlwaysOpen: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -269,7 +269,7 @@ describe('getGroupedOpeningHours', () => { }) it('should handle missing days', () => { - const missingDays: RestaurantOpeningHours = { + const missingDays: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -304,7 +304,7 @@ describe('getGroupedOpeningHours', () => { }) it('should not group non-consecutive days with same hours', () => { - const nonConsecutiveSameHours: RestaurantOpeningHours = { + const nonConsecutiveSameHours: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -339,7 +339,7 @@ describe('getGroupedOpeningHours', () => { }) it('should handle nullable opening/closing times', () => { - const nullableHours: RestaurantOpeningHours = { + const nullableHours: OpeningHours = { isActive: true, name: 'Opening hours', nameEnglish: 'Opening hours', @@ -374,7 +374,7 @@ describe('getGroupedOpeningHours', () => { }) it('should handle inactive restaurant hours', () => { - const inactiveHours: RestaurantOpeningHours = { + const inactiveHours: OpeningHours = { isActive: false, name: 'Opening hours', nameEnglish: 'Opening hours', diff --git a/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx index f9be58309..b98daae85 100644 --- a/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx +++ b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx @@ -73,6 +73,7 @@ export default function ParkingPrices({

{intl.formatMessage({ defaultMessage: 'From' })}
+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{`${startTime}-${endTime}`}
diff --git a/packages/design-system/lib/components/RateCard/Campaign/index.tsx b/packages/design-system/lib/components/RateCard/Campaign/index.tsx index f9101e45c..e56c2952b 100644 --- a/packages/design-system/lib/components/RateCard/Campaign/index.tsx +++ b/packages/design-system/lib/components/RateCard/Campaign/index.tsx @@ -99,6 +99,7 @@ export default function CampaignRateCard({ {rateTitle} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {` / ${paymentTerm}`} @@ -116,6 +117,7 @@ export default function CampaignRateCard({

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.price} `} {rate.unit} @@ -130,6 +132,7 @@ export default function CampaignRateCard({

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${memberRate.price} `} {memberRate.unit} @@ -144,6 +147,7 @@ export default function CampaignRateCard({

{comparisonRate.price} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {' '} diff --git a/packages/design-system/lib/components/RateCard/Code/index.tsx b/packages/design-system/lib/components/RateCard/Code/index.tsx index 0ec9e0c45..c1d4e86df 100644 --- a/packages/design-system/lib/components/RateCard/Code/index.tsx +++ b/packages/design-system/lib/components/RateCard/Code/index.tsx @@ -95,6 +95,7 @@ export default function CodeRateCard({ {rateTitle} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {` / ${paymentTerm}`} @@ -112,6 +113,7 @@ export default function CodeRateCard({

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.price} `} {rate.unit} @@ -125,6 +127,7 @@ export default function CodeRateCard({

{comparisonRate.price} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {' '} diff --git a/packages/design-system/lib/components/RateCard/NoRateAvailable/index.tsx b/packages/design-system/lib/components/RateCard/NoRateAvailable/index.tsx index b69fae1f0..594ed3ea1 100644 --- a/packages/design-system/lib/components/RateCard/NoRateAvailable/index.tsx +++ b/packages/design-system/lib/components/RateCard/NoRateAvailable/index.tsx @@ -37,6 +37,7 @@ export default function NoRateAvailableCard({ + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rateTitle} / ${paymentTerm}`} diff --git a/packages/design-system/lib/components/RateCard/Points/index.tsx b/packages/design-system/lib/components/RateCard/Points/index.tsx index 2829a1348..05a57c961 100644 --- a/packages/design-system/lib/components/RateCard/Points/index.tsx +++ b/packages/design-system/lib/components/RateCard/Points/index.tsx @@ -77,6 +77,7 @@ export default function PointsRateCard({ {rateTitle} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {` / ${paymentTerm}`} @@ -97,9 +98,11 @@ export default function PointsRateCard({

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.points} `} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.currency} ${rate.additionalPrice ? ' + ' : ''}`} @@ -108,6 +111,7 @@ export default function PointsRateCard({ {rate.additionalPrice && (

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.additionalPrice.price} `} {rate.additionalPrice.currency} diff --git a/packages/design-system/lib/components/RateCard/Regular/index.tsx b/packages/design-system/lib/components/RateCard/Regular/index.tsx index bf50ae152..8b5ba1f7b 100644 --- a/packages/design-system/lib/components/RateCard/Regular/index.tsx +++ b/packages/design-system/lib/components/RateCard/Regular/index.tsx @@ -88,6 +88,7 @@ export default function RegularRateCard({ {rateTitle} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {` / ${paymentTerm}`} @@ -104,6 +105,7 @@ export default function RegularRateCard({

+ {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.price} `} {rate.unit} @@ -119,6 +121,7 @@ export default function RegularRateCard({ + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${memberRate.price} `} {memberRate.unit} @@ -133,6 +136,7 @@ export default function RegularRateCard({ className={`${styles.rateRow} ${styles.strikeThroughRate}`} > + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {`${rate.price} `} {rate.unit} diff --git a/packages/design-system/lib/components/SkeletonShimmer/index.tsx b/packages/design-system/lib/components/SkeletonShimmer/index.tsx index a07b3a4ac..80f3feeb4 100644 --- a/packages/design-system/lib/components/SkeletonShimmer/index.tsx +++ b/packages/design-system/lib/components/SkeletonShimmer/index.tsx @@ -42,6 +42,7 @@ export default function SkeletonShimmer({ }} > {/* zero width space, allows for font styles to affect height */} + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} ) diff --git a/packages/design-system/lib/components/TripAdvisorChip/index.tsx b/packages/design-system/lib/components/TripAdvisorChip/index.tsx index 878d56c94..4eea72bfb 100644 --- a/packages/design-system/lib/components/TripAdvisorChip/index.tsx +++ b/packages/design-system/lib/components/TripAdvisorChip/index.tsx @@ -1,7 +1,7 @@ import { cva, type VariantProps } from 'class-variance-authority' -import TripadvisorIcon from '@scandic-hotels/design-system/Icons/TripadvisorIcon' +import TripadvisorIcon from '../Icons/Customised/Socials/Tripadvisor' import styles from './tripAdvisorChip.module.css' -import { Typography } from '@scandic-hotels/design-system/Typography' +import { Typography } from '../Typography' const container = cva(styles.container, { variants: { diff --git a/packages/design-system/lib/tokens/Colors.tsx b/packages/design-system/lib/tokens/Colors.tsx index 4b47fd644..5ba418fef 100644 --- a/packages/design-system/lib/tokens/Colors.tsx +++ b/packages/design-system/lib/tokens/Colors.tsx @@ -1,3 +1,4 @@ +/* eslint-disable formatjs/no-literal-string-in-jsx */ import copy from 'copy-to-clipboard' import { kebabify } from '../../generate/utils' diff --git a/packages/design-system/lint-staged.config.js b/packages/design-system/lint-staged.config.js index 33b4f7b24..b5e8f3b6c 100644 --- a/packages/design-system/lint-staged.config.js +++ b/packages/design-system/lint-staged.config.js @@ -1,5 +1,9 @@ const config = { - '*.{ts,tsx}': [() => 'tsc -p tsconfig.json --noEmit', 'prettier --write'], + '*.{ts,tsx}': [ + () => 'yarn lint', + () => 'tsc -p tsconfig.json --noEmit', + 'prettier --write', + ], '*.{json,md}': 'prettier --write', '*.{html,js,cjs,mjs,css}': 'prettier --write', } diff --git a/packages/design-system/package.json b/packages/design-system/package.json index bf88d6050..0c268c126 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -133,6 +133,7 @@ "./Map/mapConstants": "./lib/components/Map/mapConstants.ts", "./Map/Markers/HotelMarkerByType": "./lib/components/Map/Markers/HotelMarkerByType.tsx", "./Map/Markers/PoiMarker": "./lib/components/Map/Markers/PoiMarker/index.tsx", + "./Map/types": "./lib/components/Map/types.ts", "./Modal": "./lib/components/Modal/index.tsx", "./Modal/ModalContentWithActions": "./lib/components/Modal/ModalContentWithActions/index.tsx", "./NoRateAvailableCard": "./lib/components/RateCard/NoRateAvailable/index.tsx", @@ -198,6 +199,8 @@ "@scandic-hotels/common": "workspace:*" }, "peerDependencies": { + "@babel/core": "^7.27.4", + "@hookform/error-message": "^2.0.1", "@internationalized/date": "^3.8.0", "@radix-ui/react-slot": "^1.2.2", "@vis.gl/react-google-maps": "^1.5.2", @@ -233,6 +236,7 @@ "copy-to-clipboard": "^3.3.3", "deepmerge-ts": "^7.1.5", "eslint": "^9", + "eslint-plugin-formatjs": "^5.3.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", diff --git a/packages/trpc/eslint.config.mjs b/packages/trpc/eslint.config.mjs index 6aa5464e2..2ddf3bd80 100644 --- a/packages/trpc/eslint.config.mjs +++ b/packages/trpc/eslint.config.mjs @@ -33,7 +33,7 @@ export default defineConfig([ "no-unused-vars": "off", "import/no-relative-packages": "error", "simple-import-sort/imports": [ - "error", + "warn", { groups: [ ["^\\u0000"], diff --git a/packages/trpc/lint-staged.config.mjs b/packages/trpc/lint-staged.config.mjs index e6ae14b2a..ae7bcfcb5 100644 --- a/packages/trpc/lint-staged.config.mjs +++ b/packages/trpc/lint-staged.config.mjs @@ -1,5 +1,9 @@ const config = { - "*.{ts,tsx}": [() => "tsc -p tsconfig.json --noEmit", "prettier --write"], + "*.{ts,tsx}": [ + () => "yarn lint", + () => "tsc -p tsconfig.json --noEmit", + "prettier --write", + ], "*.{js,cjs,mjs}": "prettier --write", } diff --git a/turbo.json b/turbo.json index c166ec478..06f204cb4 100644 --- a/turbo.json +++ b/turbo.json @@ -1,17 +1,17 @@ { - "$schema": "https://turbo.build/schema.json", - "tasks": { - "build": { - "inputs": ["$TURBO_DEFAULT$", ".env*"], - "dependsOn": ["^build"], - "outputs": [".next/**", "!.next/cache/**"] - }, - "dev": { - "persistent": true, - "cache": false - }, - "lint": {}, - "test": {}, - "check-types": {} - } + "$schema": "https://turbo.build/schema.json", + "tasks": { + "build": { + "inputs": ["$TURBO_DEFAULT$", ".env*"], + "dependsOn": ["^build"], + "outputs": [".next/**", "!.next/cache/**"] + }, + "dev": { + "persistent": true, + "cache": false + }, + "lint": { "dependsOn": [] }, + "test": {}, + "check-types": {} + } } diff --git a/yarn.lock b/yarn.lock index f71e4b58d..3256bead1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6192,6 +6192,7 @@ __metadata: copy-to-clipboard: "npm:^3.3.3" deepmerge-ts: "npm:^7.1.5" eslint: "npm:^9" + eslint-plugin-formatjs: "npm:^5.3.1" eslint-plugin-import: "npm:^2.31.0" eslint-plugin-react-hooks: "npm:^5.2.0" eslint-plugin-react-refresh: "npm:^0.4.20" @@ -6217,6 +6218,8 @@ __metadata: vitest: "npm:^3.2.4" vitest-browser-react: "npm:^1.0.1" peerDependencies: + "@babel/core": ^7.27.4 + "@hookform/error-message": ^2.0.1 "@internationalized/date": ^3.8.0 "@radix-ui/react-slot": ^1.2.2 "@vis.gl/react-google-maps": ^1.5.2