From 5a86cbaafe3b4f63ecaa5e008e572848d868c868 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Wed, 17 Sep 2025 07:55:11 +0000 Subject: [PATCH] Merged in chore/update-eslint-configs (pull request #2812) chore: Extend eslint configs from @typescript-eslint/recommended * Change to typescript recommended in scandic-web * Remove comment * Change to recommended ts config in partner-sas * Change to recommended ts lint config in booking-flow Approved-by: Linus Flood --- apps/partner-sas/app/[lang]/debug/page.tsx | 2 +- .../payment-callback/[status]/page.tsx | 2 +- apps/partner-sas/app/utils/tracking.ts | 1 + apps/partner-sas/eslint.config.mjs | 5 ++++- .../destination_city_page/[uid]/page.tsx | 2 +- .../destination_country_page/[uid]/page.tsx | 2 +- .../(public)/(contentTypes)/hotel_page/[uid]/page.tsx | 2 +- .../(public)/(contentTypes)/start_page/[uid]/page.tsx | 2 +- .../app/[lang]/(live)/(public)/login/route.ts | 1 + .../destination_city_page/[uid]/page.tsx | 2 +- .../(contentTypes)/hotel_page/[uid]/page.tsx | 2 +- .../(protected)/sas-x-scandic/link/LinkAccountForm.tsx | 2 +- .../webview/(views)/[contentType]/[uid]/page.tsx | 2 +- .../Blocks/DynamicContent/OverviewTable/reducer.ts | 6 +++++- apps/scandic-web/components/Blocks/Table/index.tsx | 1 + .../ContentType/HotelPage/DialogshiftWidget/Client.tsx | 1 + .../components/DeprecatedJsonToHtml/renderOptions.tsx | 6 ++---- .../components/DeprecatedJsonToHtml/utils.tsx | 1 + .../components/Forms/Edit/Profile/index.tsx | 5 +---- .../AddAncillaryFlow/AddAncillaryFlowModal/index.tsx | 1 + .../Actions/GuaranteeLateArrival/Form/schema.ts | 2 +- .../HotelReservation/MyStay/TrackGuarantee.tsx | 2 ++ .../components/TempDesignSystem/Form/Input/index.tsx | 2 +- .../components/TempDesignSystem/Form/Select/select.ts | 1 + apps/scandic-web/eslint.config.mjs | 6 ++++-- apps/scandic-web/types/params.ts | 10 ++++++---- packages/booking-flow/eslint.config.mjs | 5 ++++- .../Header/Actions/ManageBooking.tsx | 2 +- .../components/BookingConfirmation/Promos/index.tsx | 2 +- .../lib/components/BookingWidget/Client.tsx | 5 +++-- .../ChildSelector/ChildInfoSelector.tsx | 2 +- .../BookingWidget/GuestsRoomsPicker/index.tsx | 2 +- .../lib/components/EnterDetails/Payment/schema.ts | 2 +- .../EnterDetails/Summary/Mobile/BottomSheet/index.tsx | 7 +++---- .../booking-flow/lib/components/SelectHotel/index.tsx | 1 + .../RoomsContainer/RateSummary/DesktopSummary.tsx | 2 +- .../Rooms/RoomsList/RoomListItem/Rates/Code.tsx | 2 ++ .../lib/contexts/SelectRate/isRateSelected.test.ts | 1 + .../booking-flow/lib/stores/enter-details/helpers.ts | 9 ++++----- packages/booking-flow/lib/trackingContext.tsx | 1 + packages/booking-flow/lib/utils/searchParams.test.ts | 1 + packages/booking-flow/lib/utils/searchParams.ts | 5 +++++ 42 files changed, 74 insertions(+), 46 deletions(-) diff --git a/apps/partner-sas/app/[lang]/debug/page.tsx b/apps/partner-sas/app/[lang]/debug/page.tsx index dd7d3dc9d..a69552e70 100644 --- a/apps/partner-sas/app/[lang]/debug/page.tsx +++ b/apps/partner-sas/app/[lang]/debug/page.tsx @@ -9,7 +9,7 @@ import { getLang } from "@/i18n/serverContext" import { ClientComponent } from "../../../components/ClientComponent" -type SearchParams = { +type SearchParams = { searchParams: Promise } diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(payment-callback)/payment-callback/[status]/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(payment-callback)/payment-callback/[status]/page.tsx index 1eb193a27..57d7c9702 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(payment-callback)/payment-callback/[status]/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(payment-callback)/payment-callback/[status]/page.tsx @@ -13,7 +13,7 @@ export default async function PaymentCallbackPage( logger.debug(`[payment-callback] callback started`) const lang = params.lang - let userAccessToken = null + const userAccessToken = null // TODO fix when auth is implemented // const session = await auth() // if (isValidSession(session)) { diff --git a/apps/partner-sas/app/utils/tracking.ts b/apps/partner-sas/app/utils/tracking.ts index aabc224da..de7a2f258 100644 --- a/apps/partner-sas/app/utils/tracking.ts +++ b/apps/partner-sas/app/utils/tracking.ts @@ -29,6 +29,7 @@ export function trackOpenSidePeek(input: { console.warn("TODO: Implement trackOpenSidePeek", { input }) } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export function trackGenericEvent(data: any) { console.warn("TODO: Implement trackGenericEvent", { data }) } diff --git a/apps/partner-sas/eslint.config.mjs b/apps/partner-sas/eslint.config.mjs index 8b311a2fb..e93ea2a0c 100644 --- a/apps/partner-sas/eslint.config.mjs +++ b/apps/partner-sas/eslint.config.mjs @@ -13,7 +13,10 @@ const compat = new FlatCompat({ export default defineConfig([ { - extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"), + extends: compat.extends( + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended" + ), plugins: { "simple-import-sort": simpleImportSort, "@typescript-eslint": typescriptEslint, diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx index b5fb5c7f6..60398aebe 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx @@ -10,7 +10,7 @@ import type { PageArgs } from "@/types/params" export { generateMetadata } from "@/utils/metadata/generateMetadata" export default async function DestinationCityPagePage( - props: PageArgs<{}, { view?: "map"; filterFromUrl?: string }> + props: PageArgs ) { const searchParams = await props.searchParams return ( diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx index f82751d36..534c37e9b 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx @@ -10,7 +10,7 @@ import type { PageArgs } from "@/types/params" export { generateMetadata } from "@/utils/metadata/generateMetadata" export default async function DestinationCountryPagePage( - props: PageArgs<{}, { view?: "map"; filterFromUrl?: string }> + props: PageArgs ) { const searchParams = await props.searchParams return ( diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx index e4d61717d..04c833416 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx @@ -13,7 +13,7 @@ import type { PageArgs } from "@/types/params" export { generateMetadata } from "@/utils/metadata/generateMetadata" export default async function HotelPagePage( - props: PageArgs<{}, { subpage?: string; view?: "map" }> + props: PageArgs ) { const searchParams = await props.searchParams const hotelPageData = await getHotelPage() diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx index e0b2209fc..56f3ec1c1 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx @@ -9,7 +9,7 @@ import type { NextSearchParams, PageArgs } from "@/types/params" export { generateMetadata } from "@/utils/metadata/generateMetadata" export default async function StartPagePage( - props: PageArgs<{}, NextSearchParams> + props: PageArgs ) { const searchParams = await props.searchParams const booking = parseBookingWidgetSearchParams(searchParams) diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/login/route.ts b/apps/scandic-web/app/[lang]/(live)/(public)/login/route.ts index d678effb7..2ec047955 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/login/route.ts +++ b/apps/scandic-web/app/[lang]/(live)/(public)/login/route.ts @@ -119,6 +119,7 @@ export async function GET( logger.debug(`[login] final redirectUrl: ${redirectTo}`) /** Record is next-auth typings */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any const params: Record = { ui_locales: contextParams.lang, scope: [ diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx index 6b64c1b80..7e23c6cfd 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx @@ -8,7 +8,7 @@ import { getLang } from "@/i18n/serverContext" import type { NextSearchParams, PageArgs } from "@/types/params" export default async function BookingWidgetDestinationCityPage( - props: PageArgs<{}, NextSearchParams> + props: PageArgs ) { const searchParams = await props.searchParams diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx index da4c72fec..abee13519 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx @@ -8,7 +8,7 @@ import { getLang } from "@/i18n/serverContext" import type { NextSearchParams, PageArgs } from "@/types/params" export default async function BookingWidgetHotelPage( - props: PageArgs<{}, NextSearchParams & { subpage?: string }> + props: PageArgs ) { const searchParams = await props.searchParams diff --git a/apps/scandic-web/app/[lang]/(partner)/(sas)/(protected)/sas-x-scandic/link/LinkAccountForm.tsx b/apps/scandic-web/app/[lang]/(partner)/(sas)/(protected)/sas-x-scandic/link/LinkAccountForm.tsx index 342ce78e8..3bb1de926 100644 --- a/apps/scandic-web/app/[lang]/(partner)/(sas)/(protected)/sas-x-scandic/link/LinkAccountForm.tsx +++ b/apps/scandic-web/app/[lang]/(partner)/(sas)/(protected)/sas-x-scandic/link/LinkAccountForm.tsx @@ -29,7 +29,7 @@ export function LinkAccountForm({ }) { const router = useRouter() const params = useParams() - let [isPending, startTransition] = useTransition() + const [isPending, startTransition] = useTransition() const intl = useIntl() const form = useForm({ defaultValues: { diff --git a/apps/scandic-web/app/[lang]/webview/(views)/[contentType]/[uid]/page.tsx b/apps/scandic-web/app/[lang]/webview/(views)/[contentType]/[uid]/page.tsx index 1161b9b8d..bded29374 100644 --- a/apps/scandic-web/app/[lang]/webview/(views)/[contentType]/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/webview/(views)/[contentType]/[uid]/page.tsx @@ -13,7 +13,7 @@ import type { } from "@/types/params" export default async function ContentTypePage( - props: PageArgs + props: PageArgs ) { const params = await props.params diff --git a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts index f97a292f9..67509200c 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts +++ b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts @@ -63,7 +63,11 @@ export function getInitialState({ } } -export function reducer(state: any, action: OverviewTableReducerAction) { +export function reducer( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + state: any, + action: OverviewTableReducerAction +) { switch (action.type) { case OverviewTableActionsEnum.SET_SELECTED_LEVEL_A_MOBILE: return { diff --git a/apps/scandic-web/components/Blocks/Table/index.tsx b/apps/scandic-web/components/Blocks/Table/index.tsx index 11d619aab..60f868d7f 100644 --- a/apps/scandic-web/components/Blocks/Table/index.tsx +++ b/apps/scandic-web/components/Blocks/Table/index.tsx @@ -28,6 +28,7 @@ export default function TableBlock({ data }: TableBlockProps) { accessorKey: col.id, header: col.header, size: col.width, + // eslint-disable-next-line @typescript-eslint/no-explicit-any cell: (info: any) => (
), diff --git a/apps/scandic-web/components/ContentType/HotelPage/DialogshiftWidget/Client.tsx b/apps/scandic-web/components/ContentType/HotelPage/DialogshiftWidget/Client.tsx index 57b88751d..8cc360d69 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/DialogshiftWidget/Client.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/DialogshiftWidget/Client.tsx @@ -17,6 +17,7 @@ export default function DialogshiftWidgetClient({ widgetId, language, }: DialogshiftWidgetClientProps) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const dialogshiftRef = useRef(null) useEffect(() => { diff --git a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx index 036d7e4a2..5326d2fe8 100644 --- a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx @@ -42,6 +42,7 @@ import type { RenderOptions } from "@/types/rte/option" function extractPossibleAttributes(attrs: Attributes | undefined) { if (!attrs) return {} + // eslint-disable-next-line @typescript-eslint/no-explicit-any const props: Record = {} if (attrs.id) { props.id = attrs.id @@ -601,7 +602,7 @@ export const renderOptions: RenderOptions = { className?: string, id?: string ) => { - let props = { + const props = { className, id, } @@ -614,9 +615,6 @@ export const renderOptions: RenderOptions = { if (className) { if (hasAvailableULFormat(className)) { - // @ts-ignore: We want to set css modules classNames even if it does not correspond - // to an existing class in the module style sheet. Due to our css modules plugin for - // typescript, we cannot do this without the ts-ignore props.className = styles[className] } } diff --git a/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx b/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx index ed8da1745..f2456083a 100644 --- a/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx +++ b/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx @@ -36,6 +36,7 @@ export function nodeChildrenToHtml( nodes: RTENode[], embeds: EmbedByUid, fullRenderOptions: RenderOptions + // eslint-disable-next-line @typescript-eslint/no-explicit-any ): any { return nodes .map((node, i) => { diff --git a/apps/scandic-web/components/Forms/Edit/Profile/index.tsx b/apps/scandic-web/components/Forms/Edit/Profile/index.tsx index e357a8d62..842a699a1 100644 --- a/apps/scandic-web/components/Forms/Edit/Profile/index.tsx +++ b/apps/scandic-web/components/Forms/Edit/Profile/index.tsx @@ -176,10 +176,7 @@ export default function Form({ user }: EditFormProps) {
card.id === data.paymentMethod diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/schema.ts b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/schema.ts index 3867ada6f..c66223238 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/schema.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/schema.ts @@ -7,4 +7,4 @@ export const paymentSchema = z.object({ }), }) -export interface GuaranteeFormData extends z.output {} +export type GuaranteeFormData = z.output diff --git a/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx b/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx index 7c3bbc415..1e60d1f02 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx @@ -95,6 +95,7 @@ export default function TrackGuarantee({ break case PaymentCallbackStatusEnum.Cancel: + // eslint-disable-next-line @typescript-eslint/no-unused-expressions isAncillaryFlow ? trackAncillaryPaymentEvent( "GuaranteeCancelAncillary", @@ -107,6 +108,7 @@ export default function TrackGuarantee({ break case PaymentCallbackStatusEnum.Error: + // eslint-disable-next-line @typescript-eslint/no-unused-expressions isAncillaryFlow ? trackAncillaryPaymentEvent( "GuaranteeFailAncillary", diff --git a/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx b/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx index 5eebd4b4f..99406f8da 100644 --- a/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx @@ -36,7 +36,7 @@ const Input = forwardRef(function Input( ) { const intl = useIntl() const { control } = useFormContext() - let numberAttributes: HTMLAttributes = {} + const numberAttributes: HTMLAttributes = {} if (type === "number") { numberAttributes.onWheel = function (evt: WheelEvent) { evt.currentTarget.blur() diff --git a/apps/scandic-web/components/TempDesignSystem/Form/Select/select.ts b/apps/scandic-web/components/TempDesignSystem/Form/Select/select.ts index 8ba070b6e..ab68d70a0 100644 --- a/apps/scandic-web/components/TempDesignSystem/Form/Select/select.ts +++ b/apps/scandic-web/components/TempDesignSystem/Form/Select/select.ts @@ -15,6 +15,7 @@ interface ReactAriaSelectProps showRadioButton?: boolean discreet?: boolean isNestedInModal?: boolean + // eslint-disable-next-line @typescript-eslint/no-explicit-any optionsIcon?: ReactElement } diff --git a/apps/scandic-web/eslint.config.mjs b/apps/scandic-web/eslint.config.mjs index 47ac58e53..53d650012 100644 --- a/apps/scandic-web/eslint.config.mjs +++ b/apps/scandic-web/eslint.config.mjs @@ -13,7 +13,10 @@ const compat = new FlatCompat({ export default defineConfig([ { - extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"), + extends: compat.extends( + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended" + ), plugins: { "simple-import-sort": simpleImportSort, "@typescript-eslint": typescriptEslint, @@ -63,7 +66,6 @@ export default defineConfig([ ], }, ], - "simple-import-sort/exports": "warn", "import/first": "warn", "import/newline-after-import": "warn", diff --git a/apps/scandic-web/types/params.ts b/apps/scandic-web/types/params.ts index 21b214ffb..562ccbbc2 100644 --- a/apps/scandic-web/types/params.ts +++ b/apps/scandic-web/types/params.ts @@ -3,11 +3,11 @@ import type { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType export type NextSearchParams = { [key: string]: string | string[] | undefined } -export type SearchParams = { +export type SearchParams = { searchParams: Promise } -export type Params

= { +export type Params

= { params: Promise

} @@ -50,7 +50,9 @@ export type PreviewParams = { live_preview?: string } -export type LayoutArgs

= P extends undefined ? {} : Params

+export type LayoutArgs

= P extends undefined + ? unknown + : Params

export type PageArgs

= LayoutArgs

& - (S extends undefined ? {} : SearchParams) + (S extends undefined ? unknown : SearchParams) diff --git a/packages/booking-flow/eslint.config.mjs b/packages/booking-flow/eslint.config.mjs index 8d3f9d121..6c8100161 100644 --- a/packages/booking-flow/eslint.config.mjs +++ b/packages/booking-flow/eslint.config.mjs @@ -18,7 +18,10 @@ const packageDir = path.dirname(fileURLToPath(import.meta.url)) export default defineConfig([ { - extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"), + extends: compat.extends( + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended" + ), plugins: { "simple-import-sort": simpleImportSort, "@typescript-eslint": typescriptEslint, diff --git a/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx b/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx index 114ab01ce..88d709123 100644 --- a/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx +++ b/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx @@ -13,7 +13,7 @@ import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConf import type { AdditionalInfoCookieValue } from "../../../../types/components/findMyBooking/additionalInfoCookieValue" -interface ManageBookingProps extends Pick {} +type ManageBookingProps = Pick export default function ManageBooking({ booking }: ManageBookingProps) { const intl = useIntl() diff --git a/packages/booking-flow/lib/components/BookingConfirmation/Promos/index.tsx b/packages/booking-flow/lib/components/BookingConfirmation/Promos/index.tsx index d01b8d664..3a11b6e07 100644 --- a/packages/booking-flow/lib/components/BookingConfirmation/Promos/index.tsx +++ b/packages/booking-flow/lib/components/BookingConfirmation/Promos/index.tsx @@ -13,7 +13,7 @@ import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConf import type { AdditionalInfoCookieValue } from "../../../types/components/findMyBooking/additionalInfoCookieValue" -export interface PromosProps extends Pick {} +export type PromosProps = Pick export function Promos({ booking }: PromosProps) { const intl = useIntl() diff --git a/packages/booking-flow/lib/components/BookingWidget/Client.tsx b/packages/booking-flow/lib/components/BookingWidget/Client.tsx index 42885d9de..354b2afac 100644 --- a/packages/booking-flow/lib/components/BookingWidget/Client.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/Client.tsx @@ -90,7 +90,7 @@ export default function BookingWidgetClient({ toDate = now.add(1, "day") } - let selectedLocation = + const selectedLocation = destinationsData?.currentSelection.hotel ?? destinationsData?.currentSelection.city @@ -199,8 +199,9 @@ export default function BookingWidgetClient({ ? JSON.parse(storedBookingCode) : undefined - initialBookingCode?.remember && + if (initialBookingCode?.remember) { methods.setValue("bookingCode", initialBookingCode) + } } }, [methods, selectedBookingCode]) diff --git a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx index a2017fc18..b6a384b7d 100644 --- a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx @@ -84,7 +84,7 @@ export default function ChildInfoSelector({ ] function getAvailableBeds(age: number) { - let availableBedTypes: ChildBed[] = [] + const availableBedTypes: ChildBed[] = [] if (age <= 5 && (adults > childrenInAdultsBed || child.bed === 0)) { availableBedTypes.push(allBedTypes[0]) } diff --git a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/index.tsx b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/index.tsx index 3637613a7..82613098f 100644 --- a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/index.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/index.tsx @@ -63,7 +63,7 @@ export default function GuestsRoomsPickerForm({ const updateHeight = useCallback(() => { // Get available space for picker to show without going beyond screen const bookingWidget = document.getElementById("booking-widget") - let maxHeight = + const maxHeight = window.innerHeight - (bookingWidget?.getBoundingClientRect().bottom ?? 0) - 50 diff --git a/packages/booking-flow/lib/components/EnterDetails/Payment/schema.ts b/packages/booking-flow/lib/components/EnterDetails/Payment/schema.ts index 2b97f78d7..e23aa6a22 100644 --- a/packages/booking-flow/lib/components/EnterDetails/Payment/schema.ts +++ b/packages/booking-flow/lib/components/EnterDetails/Payment/schema.ts @@ -13,4 +13,4 @@ export const paymentSchema = z.object({ guarantee: z.boolean(), }) -export interface PaymentFormData extends z.output {} +export type PaymentFormData = z.output diff --git a/packages/booking-flow/lib/components/EnterDetails/Summary/Mobile/BottomSheet/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Summary/Mobile/BottomSheet/index.tsx index 4f8e678c5..c5479e4c1 100644 --- a/packages/booking-flow/lib/components/EnterDetails/Summary/Mobile/BottomSheet/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Summary/Mobile/BottomSheet/index.tsx @@ -17,10 +17,9 @@ import { formId } from "../../../Payment/PaymentClient" import styles from "./bottomSheet.module.css" -interface SummaryBottomSheetProps - extends PropsWithChildren<{ - isUserLoggedIn: boolean - }> {} +type SummaryBottomSheetProps = PropsWithChildren<{ + isUserLoggedIn: boolean +}> export default function SummaryBottomSheet({ children, diff --git a/packages/booking-flow/lib/components/SelectHotel/index.tsx b/packages/booking-flow/lib/components/SelectHotel/index.tsx index eda80811d..b8465aa2d 100644 --- a/packages/booking-flow/lib/components/SelectHotel/index.tsx +++ b/packages/booking-flow/lib/components/SelectHotel/index.tsx @@ -46,6 +46,7 @@ export async function SelectHotel({ const isAllUnavailable = hotels.every( (hotel) => hotel.availability.status !== "Available" ) + // eslint-disable-next-line @typescript-eslint/no-explicit-any const isCityWithCountry = (city: any): city is { country: string } => "country" in city diff --git a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx index 47c757da1..35d66ea11 100644 --- a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx +++ b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx @@ -84,7 +84,7 @@ export function DesktopSummary({ isUserLoggedIn || selectedRates.rates.some(isBookingCodeRate) const mainRoomRate = selectedRates.rates.at(0) - let mainRoomCurrency = getRoomCurrency(mainRoomRate) + const mainRoomCurrency = getRoomCurrency(mainRoomRate) return ( <> diff --git a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx index 56f38226e..fd52b4e8c 100644 --- a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx +++ b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx @@ -159,6 +159,7 @@ function CorporateChequeCode({ handleSelectRate, isSelected, }: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any codeProduct: Extract roomIndex: number roomTypeCode: string @@ -329,6 +330,7 @@ function VoucherCode({ handleSelectRate, isSelected, }: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any codeProduct: Extract roomIndex: number roomTypeCode: string diff --git a/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts b/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts index 6b252f8cc..9698b63a4 100644 --- a/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts +++ b/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { describe, expect, it } from "vitest" import { RateEnum } from "@scandic-hotels/common/constants/rate" diff --git a/packages/booking-flow/lib/stores/enter-details/helpers.ts b/packages/booking-flow/lib/stores/enter-details/helpers.ts index 6c9192319..164f72f8e 100644 --- a/packages/booking-flow/lib/stores/enter-details/helpers.ts +++ b/packages/booking-flow/lib/stores/enter-details/helpers.ts @@ -345,11 +345,10 @@ function getRequestedAdditionalPrice( } } -interface TRoom - extends Pick< - RoomState["room"], - "adults" | "breakfast" | "guest" | "roomFeatures" | "roomRate" - > {} +type TRoom = Pick< + RoomState["room"], + "adults" | "breakfast" | "guest" | "roomFeatures" | "roomRate" +> interface TRoomCorporateCheque extends TRoom { roomRate: CorporateChequeProduct diff --git a/packages/booking-flow/lib/trackingContext.tsx b/packages/booking-flow/lib/trackingContext.tsx index c28cbddd0..303bb2dff 100644 --- a/packages/booking-flow/lib/trackingContext.tsx +++ b/packages/booking-flow/lib/trackingContext.tsx @@ -20,6 +20,7 @@ export type TrackingFunctions = { includePathname?: boolean roomTypeCode?: string | null }) => void + // eslint-disable-next-line @typescript-eslint/no-explicit-any trackGenericEvent(data: any): void trackLoginClick(position: TrackingPosition & (string & {})): void trackPaymentEvent(payment: PaymentEvent): void diff --git a/packages/booking-flow/lib/utils/searchParams.test.ts b/packages/booking-flow/lib/utils/searchParams.test.ts index ca244799c..a3081c80e 100644 --- a/packages/booking-flow/lib/utils/searchParams.test.ts +++ b/packages/booking-flow/lib/utils/searchParams.test.ts @@ -548,6 +548,7 @@ const getSearchParams = (input: string) => { return searchParamsToObject(searchParams) } const searchParamsToObject = (searchParams: URLSearchParams) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const obj: Record = {} for (const [key, value] of searchParams.entries()) { obj[key] = value diff --git a/packages/booking-flow/lib/utils/searchParams.ts b/packages/booking-flow/lib/utils/searchParams.ts index 57b3da7a2..2eb64d094 100644 --- a/packages/booking-flow/lib/utils/searchParams.ts +++ b/packages/booking-flow/lib/utils/searchParams.ts @@ -20,6 +20,7 @@ export function parseSearchParams( export function parseSearchParams( searchParams: NextSearchParams, options?: ParseOptions + // eslint-disable-next-line @typescript-eslint/no-explicit-any ): Record /** @@ -49,6 +50,7 @@ export function parseSearchParams( const buildObject = getBuilder(options || {}) + // eslint-disable-next-line @typescript-eslint/no-explicit-any const resultObject: Record = {} for (const [key, value] of entries) { const paths = key.split(".") @@ -80,6 +82,7 @@ function getBuilder(options: ParseOptions) { const typeHints = options.typeHints || {} return function buildNestedObject( + // eslint-disable-next-line @typescript-eslint/no-explicit-any obj: Record, paths: string[], value: string @@ -134,6 +137,7 @@ function getBuilder(options: ParseOptions) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any function isNotArray(value: any) { return !value || typeof value !== "object" || !Array.isArray(value) } @@ -157,6 +161,7 @@ type SerializeOptions = { * Arrays are not merged, they will always replace existing values. */ export function serializeSearchParams( + // eslint-disable-next-line @typescript-eslint/no-explicit-any obj: Record, options?: SerializeOptions ): URLSearchParams {