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
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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<BookingConfirmation, "booking"> {}
|
||||
type ManageBookingProps = Pick<BookingConfirmation, "booking">
|
||||
|
||||
export default function ManageBooking({ booking }: ManageBookingProps) {
|
||||
const intl = useIntl()
|
||||
|
||||
@@ -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<BookingConfirmation, "booking"> {}
|
||||
export type PromosProps = Pick<BookingConfirmation, "booking">
|
||||
|
||||
export function Promos({ booking }: PromosProps) {
|
||||
const intl = useIntl()
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
@@ -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])
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,4 +13,4 @@ export const paymentSchema = z.object({
|
||||
guarantee: z.boolean(),
|
||||
})
|
||||
|
||||
export interface PaymentFormData extends z.output<typeof paymentSchema> {}
|
||||
export type PaymentFormData = z.output<typeof paymentSchema>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
|
||||
@@ -159,6 +159,7 @@ function CorporateChequeCode({
|
||||
handleSelectRate,
|
||||
isSelected,
|
||||
}: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
codeProduct: Extract<CodeProduct, { corporateCheque: any }>
|
||||
roomIndex: number
|
||||
roomTypeCode: string
|
||||
@@ -329,6 +330,7 @@ function VoucherCode({
|
||||
handleSelectRate,
|
||||
isSelected,
|
||||
}: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
codeProduct: Extract<CodeProduct, { voucher: any }>
|
||||
roomIndex: number
|
||||
roomTypeCode: string
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<string, any> = {}
|
||||
for (const [key, value] of searchParams.entries()) {
|
||||
obj[key] = value
|
||||
|
||||
@@ -20,6 +20,7 @@ export function parseSearchParams<T extends z.ZodRawShape>(
|
||||
export function parseSearchParams<T extends z.ZodRawShape>(
|
||||
searchParams: NextSearchParams,
|
||||
options?: ParseOptions<T>
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Record<string, any>
|
||||
|
||||
/**
|
||||
@@ -49,6 +50,7 @@ export function parseSearchParams<T extends z.ZodRawShape>(
|
||||
|
||||
const buildObject = getBuilder(options || {})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const resultObject: Record<string, any> = {}
|
||||
for (const [key, value] of entries) {
|
||||
const paths = key.split(".")
|
||||
@@ -80,6 +82,7 @@ function getBuilder<T extends z.ZodRawShape>(options: ParseOptions<T>) {
|
||||
const typeHints = options.typeHints || {}
|
||||
|
||||
return function buildNestedObject(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
obj: Record<string, any>,
|
||||
paths: string[],
|
||||
value: string
|
||||
@@ -134,6 +137,7 @@ function getBuilder<T extends z.ZodRawShape>(options: ParseOptions<T>) {
|
||||
}
|
||||
}
|
||||
|
||||
// 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<string, any>,
|
||||
options?: SerializeOptions
|
||||
): URLSearchParams {
|
||||
|
||||
Reference in New Issue
Block a user