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:
@@ -9,7 +9,7 @@ import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import { ClientComponent } from "../../../components/ClientComponent"
|
||||
|
||||
type SearchParams<S = {}> = {
|
||||
type SearchParams<S = object> = {
|
||||
searchParams: Promise<S & { [key: string]: string }>
|
||||
}
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<object, { view?: "map"; filterFromUrl?: string }>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
return (
|
||||
|
||||
@@ -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<object, { view?: "map"; filterFromUrl?: string }>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
return (
|
||||
|
||||
@@ -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<object, { subpage?: string; view?: "map" }>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const hotelPageData = await getHotelPage()
|
||||
|
||||
@@ -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<object, NextSearchParams>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const booking = parseBookingWidgetSearchParams(searchParams)
|
||||
|
||||
@@ -119,6 +119,7 @@ export async function GET(
|
||||
logger.debug(`[login] final redirectUrl: ${redirectTo}`)
|
||||
|
||||
/** Record<string, any> is next-auth typings */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const params: Record<string, any> = {
|
||||
ui_locales: contextParams.lang,
|
||||
scope: [
|
||||
|
||||
@@ -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<object, NextSearchParams>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
|
||||
|
||||
@@ -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<object, NextSearchParams & { subpage?: string }>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export function LinkAccountForm({
|
||||
}) {
|
||||
const router = useRouter()
|
||||
const params = useParams<LangParams>()
|
||||
let [isPending, startTransition] = useTransition()
|
||||
const [isPending, startTransition] = useTransition()
|
||||
const intl = useIntl()
|
||||
const form = useForm<LinkAccountForm>({
|
||||
defaultValues: {
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
} from "@/types/params"
|
||||
|
||||
export default async function ContentTypePage(
|
||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>
|
||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams>
|
||||
) {
|
||||
const params = await props.params
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) => (
|
||||
<div dangerouslySetInnerHTML={{ __html: info.getValue() }} />
|
||||
),
|
||||
|
||||
@@ -17,6 +17,7 @@ export default function DialogshiftWidgetClient({
|
||||
widgetId,
|
||||
language,
|
||||
}: DialogshiftWidgetClientProps) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const dialogshiftRef = useRef<any>(null)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -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<string, any> = {}
|
||||
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]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -176,10 +176,7 @@ export default function Form({ user }: EditFormProps) {
|
||||
</Button>
|
||||
</div>
|
||||
<form
|
||||
/**
|
||||
* Ignoring since ts doesn't recognize that tRPC
|
||||
* parses FormData before reaching the route
|
||||
* @ts-ignore */
|
||||
/* @ts-expect-error Ignoring since ts doesn't recognize that tRPC parses FormData before reaching the route */
|
||||
action={editProfile}
|
||||
className={styles.form}
|
||||
id={formId}
|
||||
|
||||
@@ -204,6 +204,7 @@ export default function AddAncillaryFlowModal({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function handleGuaranteePayment(data: AncillaryFormData, packages: any) {
|
||||
const savedCreditCard = savedCreditCards?.find(
|
||||
(card) => card.id === data.paymentMethod
|
||||
|
||||
@@ -7,4 +7,4 @@ export const paymentSchema = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
export interface GuaranteeFormData extends z.output<typeof paymentSchema> {}
|
||||
export type GuaranteeFormData = z.output<typeof paymentSchema>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -36,7 +36,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
|
||||
) {
|
||||
const intl = useIntl()
|
||||
const { control } = useFormContext()
|
||||
let numberAttributes: HTMLAttributes<HTMLInputElement> = {}
|
||||
const numberAttributes: HTMLAttributes<HTMLInputElement> = {}
|
||||
if (type === "number") {
|
||||
numberAttributes.onWheel = function (evt: WheelEvent<HTMLInputElement>) {
|
||||
evt.currentTarget.blur()
|
||||
|
||||
@@ -15,6 +15,7 @@ interface ReactAriaSelectProps
|
||||
showRadioButton?: boolean
|
||||
discreet?: boolean
|
||||
isNestedInModal?: boolean
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
optionsIcon?: ReactElement<any>
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -3,11 +3,11 @@ import type { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType
|
||||
|
||||
export type NextSearchParams = { [key: string]: string | string[] | undefined }
|
||||
|
||||
export type SearchParams<S = {}> = {
|
||||
export type SearchParams<S = object> = {
|
||||
searchParams: Promise<S & { [key: string]: string }>
|
||||
}
|
||||
|
||||
export type Params<P = {}> = {
|
||||
export type Params<P = object> = {
|
||||
params: Promise<P>
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ export type PreviewParams = {
|
||||
live_preview?: string
|
||||
}
|
||||
|
||||
export type LayoutArgs<P = undefined> = P extends undefined ? {} : Params<P>
|
||||
export type LayoutArgs<P = undefined> = P extends undefined
|
||||
? unknown
|
||||
: Params<P>
|
||||
|
||||
export type PageArgs<P = undefined, S = undefined> = LayoutArgs<P> &
|
||||
(S extends undefined ? {} : SearchParams<S>)
|
||||
(S extends undefined ? unknown : SearchParams<S>)
|
||||
|
||||
Reference in New Issue
Block a user