chore: add no unused vars lint rule

This commit is contained in:
Christian Andolf
2025-02-14 10:24:52 +01:00
parent 1116bdafa8
commit 06d861fb6f
54 changed files with 47 additions and 143 deletions

View File

@@ -1,7 +1,6 @@
"use client"
import { useState } from "react"
import { useIntl } from "react-intl"
import JsonToHtml from "@/components/JsonToHtml"
import SectionContainer from "@/components/Section/Container"
@@ -17,8 +16,6 @@ import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
import type { RTENode } from "@/types/transitionTypes/rte/node"
export default function AccordionSection({ accordion, title }: AccordionProps) {
const intl = useIntl()
const showToggleButton = accordion.length > 5
const [allAccordionsVisible, setAllAccordionsVisible] =
useState(!showToggleButton)

View File

@@ -12,11 +12,6 @@ export default async function HowItWorks({
firstItem,
}: HowItWorksProps) {
const intl = await getIntl()
const displayHeader = !!(
dynamic_content.link ||
dynamic_content.subtitle ||
dynamic_content.title
)
return (
<SectionWrapper dynamic_content={dynamic_content} firstItem={firstItem}>
<section className={styles.container}>

View File

@@ -10,16 +10,7 @@ import Pagination from "@/components/MyPages/Pagination"
import ClientTable from "./ClientTable"
import type { Transactions } from "@/types/components/myPages/myPage/earnAndBurn"
export default function TransactionTable({
initialJourneyTransactions,
}: {
initialJourneyTransactions: {
data: { transactions: Transactions }
meta: { totalPages: number }
}
}) {
export default function TransactionTable() {
const limit = 5
const [page, setPage] = useState(1)
const { data, isFetching, isLoading } =
@@ -29,8 +20,6 @@ export default function TransactionTable({
page,
},
{
// TODO: fix the initial data issues on page load
// initialData: initialJourneyTransactions,
placeholderData: keepPreviousData,
}
)

View File

@@ -1,18 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import ClientJourney from "./Client"
export default async function JourneyTable() {
const initialJourneyTransactions =
await serverClient().user.transaction.friendTransactions({
page: 1,
limit: 5,
})
if (!initialJourneyTransactions?.data) {
return null
}
return (
<ClientJourney initialJourneyTransactions={initialJourneyTransactions} />
)
return <ClientJourney />
}

View File

@@ -4,8 +4,6 @@ import { createContext, useCallback, useContext, useEffect } from "react"
import { trpc } from "@/lib/trpc/client"
import useLang from "@/hooks/useLang"
import type { RedeemFlowContext } from "@/types/components/myPages/myPage/accountPage"
import type { RewardWithRedeem } from "@/server/routers/contentstack/reward/output"
@@ -27,7 +25,6 @@ export default function useRedeemFlow() {
timeRemaining,
setTimeRemaining,
} = useContext(RedeemContext)
const lang = useLang()
const update = trpc.contentstack.rewards.redeem.useMutation<{
rewards: RewardWithRedeem[]

View File

@@ -53,7 +53,6 @@ function getIconForRewardId(rewardId: RewardId): IconName {
return IconName.GiftOpen
default: {
const unhandledRewardId: never = rewardId
return IconName.GiftOpen
}
}

View File

@@ -1,7 +1,6 @@
"use client"
import { useState } from "react"
import { useIntl } from "react-intl"
import { dt } from "@/lib/dt"
@@ -19,7 +18,6 @@ import type { StayCardProps } from "@/types/components/myPages/stays/stayCard"
export default function StayCard({ stay }: StayCardProps) {
const lang = useLang()
const intl = useIntl()
// TODO: Temporary loading. Remove when current web is deleted.
const [loading, setLoading] = useState(false)

View File

@@ -25,7 +25,7 @@ export default function Marker({
properties,
onMarkerClick,
}: MarkerProps) {
const [markerRef, marker] = useAdvancedMarkerRef()
const [markerRef] = useAdvancedMarkerRef()
const handleClick = useCallback(() => {
if (onMarkerClick) {
onMarkerClick(position, properties)

View File

@@ -1,11 +1,8 @@
import { activities } from "@/constants/routes/hotelPageParams"
import Button from "@/components/TempDesignSystem/Button"
import Link from "@/components/TempDesignSystem/Link"
import SidePeek from "@/components/TempDesignSystem/SidePeek"
import Preamble from "@/components/TempDesignSystem/Text/Preamble"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import styles from "./activities.module.css"
@@ -16,7 +13,6 @@ export default async function ActivitiesSidePeek({
sidepeekCTA,
sidepeekSlug,
}: ActivitiesSidePeekProps) {
const lang = getLang()
const intl = await getIntl()
const { href, preamble } = contentPage
return (

View File

@@ -19,8 +19,6 @@ import type { ReactNode } from "react"
import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown"
export default function MyPagesMobileDropdown() {
const { data: myPagesNavigation } = useMyPagesNavigation()
const intl = useIntl()
const { toggleDropdown, isMyPagesMobileMenuOpen } = useDropdownStore()

View File

@@ -89,7 +89,7 @@ export async function TopMenuSkeleton() {
<div className={styles.topMenu}>
<div className={styles.container}>
<ul className={styles.list}>
{links.map((link, i) => (
{links.map((_link, i) => (
<li key={i} className={styles.skeletonWrapper}>
<SkeletonShimmer width="100px" height="16px" />
</li>

View File

@@ -1,7 +1,7 @@
"use client"
import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"
import { useEffect } from "react"
import type {
SiteSectionObject,
@@ -19,7 +19,7 @@ function createPageObject(trackingData: TrackingData) {
.filter((seg: string) => seg)
function getSiteSections(segments: string[]): SiteSectionObject {
/*
/*
Adobe expects the properties sitesection1 - sitessection6, hence the for-loop below
The segments ['explore-scandic', 'wifi'] should result in:
{
@@ -29,7 +29,7 @@ function createPageObject(trackingData: TrackingData) {
sitesection4: "explore-scandic|wifi||",
sitesection5: "explore-scandic|wifi|||",
sitesection6: "explore-scandic|wifi||||",
}
}
*/
const sitesections = {} as SiteSectionObject
for (let i = 0; i < 6; i++) {

View File

@@ -7,10 +7,8 @@ import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
export default function TabletCodeInput({
updateValue,
defaultValue,
}: {
updateValue: (val: string) => void
defaultValue?: string
}) {
const intl = useIntl()
const { register } = useFormContext<BookingWidgetSchema>()

View File

@@ -108,7 +108,7 @@ export default function BookingCode() {
<Checkbox
checked={!!bookingCode?.value}
{...register("bookingCode.flag", {
onChange: function (e) {
onChange: function () {
if (bookingCode?.value || isOpen) {
setValue("bookingCode.flag", true)
}
@@ -128,10 +128,7 @@ export default function BookingCode() {
<Dialog>
{({ close }) => (
<div className={styles.popover}>
<TabletCodeInput
updateValue={updateBookingCodeFormValue}
defaultValue={bookingCode?.value}
/>
<TabletCodeInput updateValue={updateBookingCodeFormValue} />
<div className={styles.bookingCodeRememberVisible}>
<CodeRemember
bookingCodeValue={bookingCode?.value}

View File

@@ -70,8 +70,6 @@ export function VoucherSkeleton() {
const intl = useIntl()
const vouchers = intl.formatMessage({ id: "Code / Voucher" })
const useVouchers = intl.formatMessage({ id: "Use code/voucher" })
const addVouchers = intl.formatMessage({ id: "Add code" })
const bonus = intl.formatMessage({ id: "Use Bonus Cheque" })
const reward = intl.formatMessage({ id: "Book Reward Night" })

View File

@@ -1,6 +1,6 @@
"use client"
import { useRouter } from "next/navigation"
import { useEffect, useState, useTransition } from "react"
import { useTransition } from "react"
import { Form as FormRAC } from "react-aria-components"
import { useFormContext } from "react-hook-form"

View File

@@ -82,7 +82,7 @@ export const bookingWidgetSchema = z
default:
return false
}
} catch (error) {
} catch {
return false
}
},

View File

@@ -32,7 +32,7 @@ import styles from "./form.module.css"
import type { SignUpFormProps } from "@/types/components/form/signupForm"
export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
export default function SignupForm({ title }: SignUpFormProps) {
const intl = useIntl()
const router = useRouter()
const lang = useLang()

View File

@@ -3,8 +3,6 @@
import { useRef } from "react"
import { useIntl } from "react-intl"
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { trpc } from "@/lib/trpc/client"
import useDropdownStore from "@/stores/main-menu"
import { ChevronDownSmallIcon } from "@/components/Icons"

View File

@@ -25,7 +25,6 @@ export default function MyPagesMenuContent({
user,
membershipLevel,
}: Props) {
const lang = useLang()
const intl = useIntl()
const myPagesMenuContentRef = useTrapFocus()
const { data: myPagesNavigation } = useMyPagesNavigation()

View File

@@ -24,7 +24,6 @@ import { BreakfastPackageEnum } from "@/types/enums/breakfast"
export default function Receipt({
booking,
hotel,
room,
}: BookingConfirmationReceiptProps) {
const intl = useIntl()

View File

@@ -22,14 +22,8 @@ export function LinkedReservation({
}: LinkedReservationProps) {
const intl = useIntl()
const lang = useLang()
const {
checkinDate,
checkoutDate,
confirmationNumber,
roomTypeCode,
adults,
children,
} = linkedReservation
const { checkinDate, checkoutDate, confirmationNumber, adults, children } =
linkedReservation
const fromDate = dt(checkinDate).locale(lang)
const toDate = dt(checkoutDate).locale(lang)

View File

@@ -7,7 +7,6 @@ import { useIntl } from "react-intl"
import DateSelect from "@/components/TempDesignSystem/Form/Date"
import Input from "@/components/TempDesignSystem/Form/Input"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import useLang from "@/hooks/useLang"
import styles from "./signup.module.css"

View File

@@ -3,25 +3,15 @@ import { useIntl } from "react-intl"
import { ChevronDownIcon } from "@/components/Icons"
import Divider from "@/components/TempDesignSystem/Divider"
import Select from "@/components/TempDesignSystem/Form/Select"
import TextArea from "@/components/TempDesignSystem/Form/TextArea"
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
import { ElevatorPreference, FloorPreference } from "./../schema"
import styles from "./specialRequests.module.css"
export default function SpecialRequests() {
const [isOpen, setIsOpen] = useState(false)
const intl = useIntl()
const noPreferenceItem = {
value: "",
label: intl.formatMessage({
id: "No preference",
}),
}
function toggleRequests() {
setIsOpen((prevVal) => !prevVal)
}
@@ -43,7 +33,7 @@ export default function SpecialRequests() {
</button>
<div className={styles.content}>
<div className={styles.contentWrapper}>
{/*
{/*
TODO: Hiding because API is not ready for this yet (https://scandichotels.atlassian.net/browse/SW-1497). Add back in when API is ready.

View File

@@ -10,10 +10,9 @@ import {
selectRoomStatus,
} from "@/stores/enter-details/helpers"
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@/components/Icons"
import { CheckIcon, ChevronDownIcon } from "@/components/Icons"
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import useScrollToActiveSection from "@/hooks/booking/useScrollToActiveSection"
import styles from "./sectionAccordion.module.css"

View File

@@ -16,13 +16,7 @@ import { isValidClientSession } from "@/utils/clientSession"
import styles from "./selectedRoomPanel.module.css"
import type { Room as SelectedRateRoom } from "@/types/components/hotelReservation/selectRate/selectRate"
interface SelectedRoomPanelProps {
room: SelectedRateRoom
}
export default function SelectedRoomPanel({ room }: SelectedRoomPanelProps) {
export default function SelectedRoomPanel() {
const intl = useIntl()
const { data: session } = useSession()
const isUserLoggedIn = isValidClientSession(session)

View File

@@ -71,7 +71,7 @@ export default function MultiRoomWrapper({
)}
<div className={classNames}>
<div className={styles.roomPanel}>
<SelectedRoomPanel room={bookingRoom} />
<SelectedRoomPanel />
</div>
<div className={styles.roomSelectionPanel}>{children}</div>
</div>

View File

@@ -86,7 +86,7 @@ export default function FullView({
transition={{ duration: 0.3 }}
className={styles.fullViewImage}
drag="x"
onDragEnd={(e, info) => handleSwipe(info.offset.x)}
onDragEnd={(_e, info) => handleSwipe(info.offset.x)}
>
<Image
alt={image.alt}

View File

@@ -25,7 +25,7 @@ export default function ManagePreferencesButton() {
)
}
},
onError: (e) => {
onError: () => {
toast.error(
intl.formatMessage({
id: "An error occurred trying to manage your preferences, please try again later.",

View File

@@ -22,7 +22,6 @@ export default function HotelSidePeek({
additionalHotelData,
activeSidePeek,
close,
showCTA,
}: HotelSidePeekProps) {
const intl = useIntl()
const amenitiesList = hotel.detailedFacilities.filter(
@@ -87,7 +86,7 @@ export default function HotelSidePeek({
</div>
{/* TODO: handle linking to Hotel Page */}
{/* {showCTA && (
{/* {showCTA && (
<Button theme="base" intent="secondary" size="large">
Read more about the hotel
</Button>

View File

@@ -1,5 +1,3 @@
import { getName } from "@/lib/trpc/memoizedRequests"
import { auth } from "@/auth"
import ArrowRight from "@/components/Icons/ArrowRight"
import { ScandicFriends } from "@/components/Levels"

View File

@@ -29,7 +29,6 @@ export default function NewPassword({
disabled = false,
placeholder = "",
registerOptions = {},
label,
visibilityToggleable = true,
}: NewPasswordProps) {
const { control } = useFormContext()