chore: lint fix

This commit is contained in:
Michael Zetterberg
2024-04-22 06:58:50 +02:00
parent abdc48f57f
commit 14e93eba7c
82 changed files with 282 additions and 160 deletions

View File

@@ -1,3 +1,56 @@
{ {
"extends": "next/core-web-vitals" "extends": ["next/core-web-vitals", "plugin:import/recommended"],
"plugins": ["simple-import-sort"],
"rules": {
"simple-import-sort/imports": [
"error",
{
"groups": [
// Side effect imports.
["^\\u0000"],
// Node.js builtins.
["^node:"],
// NPM packages.
["^@?\\w"],
// Internal packages.
["^@scandic-hotels/(?!.*\u0000$).*$"],
// Local imports (lib, constants, etc.), excl. types.
[
"^@/constants/?(?!.*\u0000$).*$",
"^@/env/?(?!.*\u0000$).*$",
"^@/lib/?(?!.*\u0000$).*$",
"^@/server/?(?!.*\u0000$).*$",
"^@/stores/?(?!.*\u0000$).*$"
],
// Local imports (the rest), excl. types.
["^@/(?!(types|.*\u0000$)).*$"],
// Parent imports. Put `..` last.
// Other relative imports. Put same-folder imports and `.` last.
[
"^\\.\\.(?!/?$)",
"^\\.\\./?$",
"^\\./(?=.*/)(?!/?$)",
"^\\.(?!/?$)",
"^\\./?$"
],
// Style imports.
["^(?!\\u0000).+\\.s?css$"],
// Node.js builtins and NPM packages type imports.
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
// Local type imports.
[
"^@scandichotels/.*\\u0000$",
"^@/types/.*",
"^@/.*\\u0000$",
"^[^.].*\\u0000$",
"^\\..*\\u0000$"
]
]
}
],
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
}
} }

View File

@@ -1,9 +1,10 @@
import { NextRequest, NextResponse } from "next/server" import { NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth" import { AuthError } from "next-auth"
import { signOut } from "@/auth"
import { badRequest } from "@/server/errors/next" import { badRequest } from "@/server/errors/next"
import { signOut } from "@/auth"
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const returnUrl = request.headers.get("x-returnurl") const returnUrl = request.headers.get("x-returnurl")

View File

@@ -1,5 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import { benefits } from "@/constants/routes/myPages" import { benefits } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import Breadcrumbs from "@/components/MyPages/Breadcrumbs" import Breadcrumbs from "@/components/MyPages/Breadcrumbs"

View File

@@ -1,5 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import { overview } from "@/constants/routes/myPages" import { overview } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import Breadcrumbs from "@/components/MyPages/Breadcrumbs" import Breadcrumbs from "@/components/MyPages/Breadcrumbs"

View File

@@ -1,5 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import { profile } from "@/constants/routes/myPages" import { profile } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import Breadcrumbs from "@/components/MyPages/Breadcrumbs" import Breadcrumbs from "@/components/MyPages/Breadcrumbs"

View File

@@ -1,5 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import { profile } from "@/constants/routes/myPages" import { profile } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import Breadcrumbs from "@/components/MyPages/Breadcrumbs" import Breadcrumbs from "@/components/MyPages/Breadcrumbs"

View File

@@ -1,5 +1,5 @@
import { serverClient } from "@/lib/trpc/server"
import { stays } from "@/constants/routes/myPages" import { stays } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import Breadcrumbs from "@/components/MyPages/Breadcrumbs" import Breadcrumbs from "@/components/MyPages/Breadcrumbs"

View File

@@ -1,13 +1,14 @@
import Title from "@/components/MyPages/Title"
import CurrentBenefitsBlock from "@/components/MyPages/Blocks/Benefits/CurrentLevel" import CurrentBenefitsBlock from "@/components/MyPages/Blocks/Benefits/CurrentLevel"
import NextLevelBenefitsBlock from "@/components/MyPages/Blocks/Benefits/NextLevel" import NextLevelBenefitsBlock from "@/components/MyPages/Blocks/Benefits/NextLevel"
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts" import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
import Title from "@/components/MyPages/Title"
import { shortcuts } from "./_constants" import { shortcuts } from "./_constants"
import type { LangParams, PageArgs } from "@/types/params"
import styles from "./page.module.css" import styles from "./page.module.css"
import type { LangParams, PageArgs } from "@/types/params"
export default function BenefitsPage({ params }: PageArgs<LangParams>) { export default function BenefitsPage({ params }: PageArgs<LangParams>) {
return ( return (
<main className={styles.container}> <main className={styles.container}>

View File

@@ -1,5 +1,4 @@
import { firaMono, firaSans } from "@/app/[lang]/(live)/fonts" import { firaMono, firaSans } from "@/app/[lang]/(live)/fonts"
import Header from "@/components/MyPages/Header" import Header from "@/components/MyPages/Header"
import Sidebar from "@/components/MyPages/Sidebar" import Sidebar from "@/components/MyPages/Sidebar"

View File

@@ -3,8 +3,8 @@ import { serverClient } from "@/lib/trpc/server"
import MaxWidth from "@/components/MaxWidth" import MaxWidth from "@/components/MaxWidth"
import Overview from "@/components/MyPages/Blocks/Overview" import Overview from "@/components/MyPages/Blocks/Overview"
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
import UpcomingStays from "@/components/MyPages/Blocks/Overview/UpcomingStays" import UpcomingStays from "@/components/MyPages/Blocks/Overview/UpcomingStays"
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
import styles from "./page.module.css" import styles from "./page.module.css"

View File

@@ -1,6 +1,6 @@
"use client" "use client"
import { _ } from "@/lib/translation"
import { profile } from "@/constants/routes/myPages" import { profile } from "@/constants/routes/myPages"
import { _ } from "@/lib/translation"
import { useProfileStore } from "@/stores/edit-profile" import { useProfileStore } from "@/stores/edit-profile"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"

View File

@@ -1,5 +1,5 @@
import { _ } from "@/lib/translation"
import { profileEdit } from "@/constants/routes/myPages" import { profileEdit } from "@/constants/routes/myPages"
import { _ } from "@/lib/translation"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"

View File

@@ -1,4 +1,5 @@
import "../profileLayout.css" import "../profileLayout.css"
export default function EditProfilePage() { export default function EditProfilePage() {
return null return null
} }

View File

@@ -1,5 +1,5 @@
import UpcomingStays from "@/components/MyPages/Blocks/Stays/Upcoming"
import PreviousStays from "@/components/MyPages/Blocks/Stays/Previous" import PreviousStays from "@/components/MyPages/Blocks/Stays/Previous"
import UpcomingStays from "@/components/MyPages/Blocks/Stays/Upcoming"
import styles from "./page.module.css" import styles from "./page.module.css"

View File

@@ -1,11 +1,12 @@
import { NextRequest, NextResponse } from "next/server" import { NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth" import { AuthError } from "next-auth"
import { signIn } from "@/auth"
import { Lang } from "@/constants/languages" import { Lang } from "@/constants/languages"
import { env } from "@/env/server" import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next" import { badRequest, internalServerError } from "@/server/errors/next"
import { signIn } from "@/auth"
export async function GET( export async function GET(
request: NextRequest, request: NextRequest,
context: { params: { lang: Lang } } context: { params: { lang: Lang } }

View File

@@ -1,17 +1,18 @@
import "@/app/globals.css"
import "@scandic-hotels/design-system/style.css"
import Script from "next/script"
import { SessionProvider } from "next-auth/react" import { SessionProvider } from "next-auth/react"
import { auth } from "@/auth"
import AdobeScript from "@/components/Current/AdobeScript"
import Script from "next/script"
import TrpcProvider from "@/lib/trpc/Provider" import TrpcProvider from "@/lib/trpc/Provider"
import { auth } from "@/auth"
import AdobeScript from "@/components/Current/AdobeScript"
import VwoScript from "@/components/Current/VwoScript" import VwoScript from "@/components/Current/VwoScript"
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params"
import "@/app/globals.css" import type { LangParams, LayoutArgs } from "@/types/params"
import "@scandic-hotels/design-system/style.css"
export const metadata: Metadata = { export const metadata: Metadata = {
description: "New web", description: "New web",

View File

@@ -1,14 +1,14 @@
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import { request } from "@/lib/graphql/request"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql" import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql"
import { GetCurrentBlockPageTrackingData } from "@/lib/graphql/Query/CurrentBlockPageTrackingData.graphql" import { GetCurrentBlockPageTrackingData } from "@/lib/graphql/Query/CurrentBlockPageTrackingData.graphql"
import { request } from "@/lib/graphql/request"
import ContentPage from "@/components/Current/ContentPage" import ContentPage from "@/components/Current/ContentPage"
import Header from "@/components/Current/Header" import Header from "@/components/Current/Header"
import Tracking from "@/components/Current/Tracking" import Tracking from "@/components/Current/Tracking"
import type { PageArgs, LangParams, UriParams } from "@/types/params" import type { LangParams, PageArgs, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage" import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import type { TrackingData } from "@/types/requests/trackingData" import type { TrackingData } from "@/types/requests/trackingData"

View File

@@ -1,12 +1,14 @@
import "@scandic-hotels/design-system/current/style.css" import "@scandic-hotels/design-system/current/style.css"
import Script from "next/script"
import AdobeScript from "@/components/Current/AdobeScript" import AdobeScript from "@/components/Current/AdobeScript"
import Footer from "@/components/Current/Footer" import Footer from "@/components/Current/Footer"
import LangPopup from "@/components/Current/LangPopup" import LangPopup from "@/components/Current/LangPopup"
import Script from "next/script"
import SkipToMainContent from "@/components/SkipToMainContent" import SkipToMainContent from "@/components/SkipToMainContent"
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params" import type { LangParams, LayoutArgs } from "@/types/params"
export const fetchCache = "default-no-store" export const fetchCache = "default-no-store"

View File

@@ -1,6 +1,7 @@
import InitLivePreview from "@/components/Current/LivePreview" import InitLivePreview from "@/components/Current/LivePreview"
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params" import type { LangParams, LayoutArgs } from "@/types/params"
export const metadata: Metadata = { export const metadata: Metadata = {

View File

@@ -1,10 +1,12 @@
import Script from "next/script"
import Footer from "@/components/Current/Footer" import Footer from "@/components/Current/Footer"
import LangPopup from "@/components/Current/LangPopup" import LangPopup from "@/components/Current/LangPopup"
import Script from "next/script"
import SkipToMainContent from "@/components/SkipToMainContent"
import InitLivePreview from "@/components/Current/LivePreview" import InitLivePreview from "@/components/Current/LivePreview"
import SkipToMainContent from "@/components/SkipToMainContent"
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params" import type { LangParams, LayoutArgs } from "@/types/params"
export const fetchCache = "default-no-store" export const fetchCache = "default-no-store"

View File

@@ -1,11 +1,13 @@
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import { previewRequest } from "@/lib/graphql/previewRequest" import { previewRequest } from "@/lib/graphql/previewRequest"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql" import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql"
import type { PageArgs, LangParams, PreviewParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import LoadingSpinner from "@/components/Current/LoadingSpinner"
import ContentPage from "@/components/Current/ContentPage" import ContentPage from "@/components/Current/ContentPage"
import LoadingSpinner from "@/components/Current/LoadingSpinner"
import type { LangParams, PageArgs, PreviewParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
export default async function CurrentPreviewPage({ export default async function CurrentPreviewPage({
params, params,

View File

@@ -1,4 +1,5 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params" import type { LangParams, LayoutArgs } from "@/types/params"
export const metadata: Metadata = { export const metadata: Metadata = {

View File

@@ -1,4 +1,5 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import type { LangParams, LayoutArgs } from "@/types/params" import type { LangParams, LayoutArgs } from "@/types/params"
export const metadata: Metadata = { export const metadata: Metadata = {

View File

@@ -1,8 +1,8 @@
import { env } from "@/env/server"
import { revalidateTag } from "next/cache" import { revalidateTag } from "next/cache"
import { NextRequest } from "next/server" import { NextRequest } from "next/server"
import { env } from "@/env/server"
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
try { try {
const secret = request.nextUrl.searchParams.get("secret") ?? "" const secret = request.nextUrl.searchParams.get("secret") ?? ""

View File

@@ -1,7 +1,7 @@
import { env } from "@/env/server"
import Script from "next/script" import Script from "next/script"
import { env } from "@/env/server"
export default function AdobeScript() { export default function AdobeScript() {
return env.ADOBE_SCRIPT_SRC ? ( return env.ADOBE_SCRIPT_SRC ? (
<Script data-cookieconsent="statistics" src={env.ADOBE_SCRIPT_SRC} /> <Script data-cookieconsent="statistics" src={env.ADOBE_SCRIPT_SRC} />

View File

@@ -1,7 +1,8 @@
import { Lang } from "@/constants/languages"
import styles from "./contact.module.css" import styles from "./contact.module.css"
import { Lang } from "@/constants/languages" import { type ContactNode, Section } from "@/types/requests/asides/contact"
import { Section, type ContactNode } from "@/types/requests/asides/contact"
export default function Contact({ sections, system: { locale } }: ContactNode) { export default function Contact({ sections, system: { locale } }: ContactNode) {
if (!sections.length) { if (!sections.length) {

View File

@@ -1,10 +1,12 @@
"use client" "use client"
import { renderOptions } from "./renderOptions"
import { useRouter } from "next/navigation" import { useRouter } from "next/navigation"
import { Button } from "@scandic-hotels/design-system/current"
import Image from "@/components/Image" import Image from "@/components/Image"
import JsonToHtml from "@/components/JsonToHtml" import JsonToHtml from "@/components/JsonToHtml"
import { Button } from "@scandic-hotels/design-system/current"
import { renderOptions } from "./renderOptions"
import styles from "./puff.module.css" import styles from "./puff.module.css"

View File

@@ -1,9 +1,8 @@
import styles from "./puff.module.css" import styles from "./puff.module.css"
import { RTETypeEnum } from "@/types/rte/enums"
import type { EmbedByUid } from "@/types/components/jsontohtml" import type { EmbedByUid } from "@/types/components/jsontohtml"
import type { RTENext, RTEDefaultNode } from "@/types/rte/node" import { RTETypeEnum } from "@/types/rte/enums"
import type { RTEDefaultNode, RTENext } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option" import type { RenderOptions } from "@/types/rte/option"
export const renderOptions: RenderOptions = { export const renderOptions: RenderOptions = {

View File

@@ -1,11 +1,11 @@
import Puff from "./Puff"
import Contacts from "./Contacts" import Contacts from "./Contacts"
import Puff from "./Puff"
import { AsideTypenameEnum } from "@/types/requests/utils/typename"
import type { AsideProps } from "@/types/components/current/aside"
import styles from "./aside.module.css" import styles from "./aside.module.css"
import type { AsideProps } from "@/types/components/current/aside"
import { AsideTypenameEnum } from "@/types/requests/utils/typename"
export default function Aside({ blocks }: AsideProps) { export default function Aside({ blocks }: AsideProps) {
if (!blocks?.length) { if (!blocks?.length) {
return null return null
@@ -24,12 +24,7 @@ export default function Aside({ blocks }: AsideProps) {
/> />
) )
case AsideTypenameEnum.CurrentBlocksPageAsidePuff: case AsideTypenameEnum.CurrentBlocksPageAsidePuff:
return ( return <Puff key={`block-${idx}`} {...block.puff} />
<Puff
key={`block-${idx}`}
{...block.puff}
/>
)
default: default:
return null return null
} }

View File

@@ -1,10 +1,9 @@
import { cva } from "class-variance-authority" import { cva } from "class-variance-authority"
import { BlockListItemsEnum } from "@/types/requests/blocks/list"
import styles from "./list.module.css" import styles from "./list.module.css"
import type { ListItem } from "@/types/requests/blocks/list" import type { ListItem } from "@/types/requests/blocks/list"
import { BlockListItemsEnum } from "@/types/requests/blocks/list"
const config = { const config = {
variants: { variants: {

View File

@@ -2,10 +2,10 @@ import List from "./List"
import Puffs from "./Puffs" import Puffs from "./Puffs"
import Text from "./Text" import Text from "./Text"
import { BlocksTypenameEnum } from "@/types/requests/utils/typename"
import styles from "./blocks.module.css" import styles from "./blocks.module.css"
import type { BlocksProps } from "@/types/components/current/blocks" import type { BlocksProps } from "@/types/components/current/blocks"
import { BlocksTypenameEnum } from "@/types/requests/utils/typename"
export default function Blocks({ blocks }: BlocksProps) { export default function Blocks({ blocks }: BlocksProps) {
if (!blocks?.length) { if (!blocks?.length) {

View File

@@ -1,12 +1,14 @@
import { request } from "@/lib/graphql/request"
import { GetFooter } from "@/lib/graphql/Query/Footer.graphql"
import Image from "@/components/Image"
import Navigation from "./Navigation"
import Script from "next/script" import Script from "next/script"
import type { GetFooterData } from "@/types/requests/footer" import { GetFooter } from "@/lib/graphql/Query/Footer.graphql"
import { request } from "@/lib/graphql/request"
import Image from "@/components/Image"
import Navigation from "./Navigation"
import type { LangParams } from "@/types/params" import type { LangParams } from "@/types/params"
import type { GetFooterData } from "@/types/requests/footer"
export default async function Footer({ lang }: LangParams) { export default async function Footer({ lang }: LangParams) {
const response = await request<GetFooterData>( const response = await request<GetFooterData>(

View File

@@ -2,6 +2,7 @@
import { useState } from "react" import { useState } from "react"
import Image from "@/components/Image" import Image from "@/components/Image"
import Mobile from "../LanguageSwitcher/Mobile" import Mobile from "../LanguageSwitcher/Mobile"
import styles from "./mainMenu.module.css" import styles from "./mainMenu.module.css"

View File

@@ -1,13 +1,13 @@
import { homeHrefs } from "@/constants/homeHrefs"
import { languages } from "@/constants/languages" import { languages } from "@/constants/languages"
import { env } from "@/env/server"
import { batchRequest } from "@/lib/graphql/batchRequest" import { batchRequest } from "@/lib/graphql/batchRequest"
import { request } from "@/lib/graphql/request"
import { GetHeader } from "@/lib/graphql/Query/Header.graphql" import { GetHeader } from "@/lib/graphql/Query/Header.graphql"
import { import {
GetDaDeEnUrls, GetDaDeEnUrls,
GetFiNoSvUrls, GetFiNoSvUrls,
} from "@/lib/graphql/Query/LanguageSwitcher.graphql" } from "@/lib/graphql/Query/LanguageSwitcher.graphql"
import { homeHrefs } from "@/constants/homeHrefs" import { request } from "@/lib/graphql/request"
import { env } from "@/env/server"
import MainMenu from "./MainMenu" import MainMenu from "./MainMenu"
import OfflineBanner from "./OfflineBanner" import OfflineBanner from "./OfflineBanner"
@@ -15,9 +15,9 @@ import TopMenu from "./TopMenu"
import styles from "./header.module.css" import styles from "./header.module.css"
import type { HeaderProps } from "@/types/components/current/header"
import { LangParams } from "@/types/params" import { LangParams } from "@/types/params"
import type { HeaderQueryData } from "@/types/requests/header" import type { HeaderQueryData } from "@/types/requests/header"
import type { HeaderProps } from "@/types/components/current/header"
import type { LanguageSwitcherQueryData } from "@/types/requests/languageSwitcher" import type { LanguageSwitcherQueryData } from "@/types/requests/languageSwitcher"
export default async function Header({ lang, uid }: LangParams & HeaderProps) { export default async function Header({ lang, uid }: LangParams & HeaderProps) {

View File

@@ -1,6 +1,7 @@
import { Lang, localeToLang } from "@/constants/languages"
import { headers } from "next/headers" import { headers } from "next/headers"
import { Lang, localeToLang } from "@/constants/languages"
export default function LangPopup({ lang }: { lang: Lang }) { export default function LangPopup({ lang }: { lang: Lang }) {
const headersList = headers() const headersList = headers()
const preferedLang = headersList.get("Accept-Language") ?? "" const preferedLang = headersList.get("Accept-Language") ?? ""

View File

@@ -1,7 +1,7 @@
"use client" "use client"
import { useEffect } from "react"
import ContentstackLivePreview from "@contentstack/live-preview-utils" import ContentstackLivePreview from "@contentstack/live-preview-utils"
import { useEffect } from "react"
export default function InitLivePreview() { export default function InitLivePreview() {
useEffect(() => { useEffect(() => {

View File

@@ -1,7 +1,7 @@
import { renderOptions } from "./renderOptions" import JsonToHtml from "@/components/JsonToHtml"
import Breadcrumbs from "./Breadcrumbs" import Breadcrumbs from "./Breadcrumbs"
import JsonToHtml from "@/components/JsonToHtml" import { renderOptions } from "./renderOptions"
import styles from "./preamble.module.css" import styles from "./preamble.module.css"

View File

@@ -1,9 +1,8 @@
import styles from "./preamble.module.css" import styles from "./preamble.module.css"
import { RTETypeEnum } from "@/types/rte/enums"
import type { EmbedByUid } from "@/types/components/jsontohtml" import type { EmbedByUid } from "@/types/components/jsontohtml"
import type { RTENext, RTEDefaultNode } from "@/types/rte/node" import { RTETypeEnum } from "@/types/rte/enums"
import type { RTEDefaultNode, RTENext } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option" import type { RenderOptions } from "@/types/rte/option"
export const renderOptions: RenderOptions = { export const renderOptions: RenderOptions = {

View File

@@ -1,12 +1,13 @@
"use client" "use client"
import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"
import { import {
SiteSectionObject, SiteSectionObject,
TrackingData, TrackingData,
TrackingProps, TrackingProps,
} from "@/types/components/tracking" } from "@/types/components/tracking"
import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"
function createPageObject(trackingData: TrackingData) { function createPageObject(trackingData: TrackingData) {
const englishSegments = trackingData.englishUrl const englishSegments = trackingData.englishUrl

View File

@@ -1,6 +1,8 @@
"use client" "use client"
import NextImage, { type ImageProps, type ImageLoaderProps } from "next/image" import NextImage from "next/image"
import type { ImageLoaderProps, ImageProps } from "next/image"
function imageLoader({ quality, src, width }: ImageLoaderProps) { function imageLoader({ quality, src, width }: ImageLoaderProps) {
return `${src}?w=${width}${quality ? "&q=" + quality : ""}` return `${src}?w=${width}${quality ? "&q=" + quality : ""}`

View File

@@ -1,20 +1,20 @@
import Image from "@/components/Image"
import Link from "next/link" import Link from "next/link"
import { EmbedEnum } from "@/types/requests/utils/embeds" import Image from "@/components/Image"
import { RTEItemTypeEnum, RTETypeEnum } from "@/types/rte/enums"
import { RTEMarkType } from "@/types/rte/node"
import styles from "./jsontohtml.module.css" import styles from "./jsontohtml.module.css"
import type { Attributes } from "@/types/rte/attrs"
import type { EmbedByUid } from "@/types/components/jsontohtml" import type { EmbedByUid } from "@/types/components/jsontohtml"
import { EmbedEnum } from "@/types/requests/utils/embeds"
import type { Attributes } from "@/types/rte/attrs"
import { RTEItemTypeEnum, RTETypeEnum } from "@/types/rte/enums"
import type { import type {
RTENext,
RTEDefaultNode, RTEDefaultNode,
RTENext,
RTENode, RTENode,
RTERegularNode, RTERegularNode,
} from "@/types/rte/node" } from "@/types/rte/node"
import { RTEMarkType } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option" import type { RenderOptions } from "@/types/rte/option"
function extractPossibleAttributes(attrs: Attributes) { function extractPossibleAttributes(attrs: Attributes) {
@@ -263,7 +263,9 @@ export const renderOptions: RenderOptions = {
} }
} else { } else {
const props = extractPossibleAttributes(node.attrs) const props = extractPossibleAttributes(node.attrs)
const href = node.attrs?.locale ? `/${node.attrs.locale}${node.attrs.href}` : node.attrs.href const href = node.attrs?.locale
? `/${node.attrs.locale}${node.attrs.href}`
: node.attrs.href
return ( return (
<Link {...props} href={href} key={node.uid}> <Link {...props} href={href} key={node.uid}>
{next(node.children, embeds, fullRenderOptions)} {next(node.children, embeds, fullRenderOptions)}

View File

@@ -1,17 +1,16 @@
import { renderOptions } from "./renderOptions" import { renderOptions } from "./renderOptions"
import { RTEMarkType, RTERenderMark } from "@/types/rte/node"
import { RTETypeEnum } from "@/types/rte/enums"
import type { EmbedByUid } from "@/types/components/jsontohtml" import type { EmbedByUid } from "@/types/components/jsontohtml"
import type { Embeds } from "@/types/requests/embeds"
import type { Node } from "@/types/requests/utils/edges" import type { Node } from "@/types/requests/utils/edges"
import type { RenderOptions } from "@/types/rte/option" import { RTETypeEnum } from "@/types/rte/enums"
import type { import type {
RTENode, RTENode,
RTETextNode,
RTERenderOptionComponent, RTERenderOptionComponent,
RTETextNode,
} from "@/types/rte/node" } from "@/types/rte/node"
import type { Embeds } from "@/types/requests/embeds" import { RTEMarkType, RTERenderMark } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option"
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) { export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => { const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => {

View File

@@ -1,8 +1,11 @@
import { serverClient } from "@/lib/trpc/server"
import Title from "@/components/MyPages/Title"
import styles from "./current.module.css"
import Link from "next/link" import Link from "next/link"
import { serverClient } from "@/lib/trpc/server"
import Title from "@/components/MyPages/Title"
import styles from "./current.module.css"
export default async function CurrentBenefitsBlock() { export default async function CurrentBenefitsBlock() {
const benefits = await serverClient().user.benefits.current() const benefits = await serverClient().user.benefits.current()

View File

@@ -1,9 +1,10 @@
import Link from "next/link"
import { Lock } from "react-feather"
import { serverClient } from "@/lib/trpc/server" import { serverClient } from "@/lib/trpc/server"
import { Lock } from "react-feather"
import Title from "@/components/MyPages/Title" import Title from "@/components/MyPages/Title"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Link from "next/link"
import styles from "./next.module.css" import styles from "./next.module.css"

View File

@@ -1,7 +1,7 @@
"use client" "use client"
import Button from "@/components/TempDesignSystem/Button"
import Image from "@/components/Image" import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button"
import type { User } from "@/types/user" import type { User } from "@/types/user"

View File

@@ -1,7 +1,7 @@
"use client" "use client"
import Button from "@/components/TempDesignSystem/Button"
import Image from "@/components/Image" import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button"
import styles from "./btn.module.css" import styles from "./btn.module.css"

View File

@@ -1,4 +1,5 @@
import Divider from "@/components/TempDesignSystem/Divider" import Divider from "@/components/TempDesignSystem/Divider"
import Title from "../Title" import Title from "../Title"
import styles from "./progress.module.css" import styles from "./progress.module.css"

View File

@@ -1,4 +1,5 @@
import Divider from "@/components/TempDesignSystem/Divider" import Divider from "@/components/TempDesignSystem/Divider"
import Title from "../Title" import Title from "../Title"
import styles from "./totalPoints.module.css" import styles from "./totalPoints.module.css"

View File

@@ -1,9 +1,10 @@
import { serverClient } from "@/lib/trpc/server" import { serverClient } from "@/lib/trpc/server"
import Link from "@/components/TempDesignSystem/Link"
import Title from "@/components/MyPages/Title" import Title from "@/components/MyPages/Title"
import StayCard from "../../Stays/StayCard" import Link from "@/components/TempDesignSystem/Link"
import EmptyUpcomingStaysBlock from "../../Stays/EmptyUpcomingStays" import EmptyUpcomingStaysBlock from "../../Stays/EmptyUpcomingStays"
import StayCard from "../../Stays/StayCard"
import styles from "./upcoming.module.css" import styles from "./upcoming.module.css"

View File

@@ -1,6 +1,7 @@
import Title from "@/components/MyPages/Title"
import Friend from "./Friend" import Friend from "./Friend"
import Stats from "./Stats" import Stats from "./Stats"
import Title from "@/components/MyPages/Title"
import styles from "./overview.module.css" import styles from "./overview.module.css"

View File

@@ -1,5 +1,6 @@
import Image from "@/components/Image"
import Link from "next/link" import Link from "next/link"
import Image from "@/components/Image"
import Title from "@/components/MyPages/Title" import Title from "@/components/MyPages/Title"
import styles from "./shortcuts.module.css" import styles from "./shortcuts.module.css"

View File

@@ -1,4 +1,5 @@
import Title from "@/components/MyPages/Title" import Title from "@/components/MyPages/Title"
import styles from "./emptyPreviousStays.module.css" import styles from "./emptyPreviousStays.module.css"
export default function EmptyPreviousStaysBlock() { export default function EmptyPreviousStaysBlock() {

View File

@@ -1,7 +1,9 @@
import Link from "next/link"
import Title from "@/components/MyPages/Title" import Title from "@/components/MyPages/Title"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import styles from "./emptyUpcomingStays.module.css" import styles from "./emptyUpcomingStays.module.css"
import Link from "next/link"
export default function EmptyUpcomingStaysBlock() { export default function EmptyUpcomingStaysBlock() {
return ( return (

View File

@@ -1,8 +1,9 @@
import { dt } from "@/lib/dt" import { dt } from "@/lib/dt"
import Image from "@/components/Image" import Image from "@/components/Image"
import Title from "@/components/MyPages/Title"
import styles from "./stay.module.css" import styles from "./stay.module.css"
import Title from "@/components/MyPages/Title"
import type { StayCardProps } from "@/types/components/myPages/stays/stayCard" import type { StayCardProps } from "@/types/components/myPages/stays/stayCard"

View File

@@ -1,4 +1,5 @@
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import StayCard from "../StayCard" import StayCard from "../StayCard"
import styles from "./stayList.module.css" import styles from "./stayList.module.css"

View File

@@ -1,4 +1,5 @@
import Image from "@/components/Image" import Image from "@/components/Image"
import styles from "./language.module.css" import styles from "./language.module.css"
export default function LanguageSwitcher() { export default function LanguageSwitcher() {

View File

@@ -1,8 +1,9 @@
import { request } from "@/lib/graphql/request" import Link from "next/link"
import { GetMyPagesLogo } from "@/lib/graphql/Query/Logo.graphql" import { GetMyPagesLogo } from "@/lib/graphql/Query/Logo.graphql"
import { request } from "@/lib/graphql/request"
import Image from "@/components/Image" import Image from "@/components/Image"
import Link from "next/link"
import styles from "./logo.module.css" import styles from "./logo.module.css"

View File

@@ -1,4 +1,5 @@
import { serverClient } from "@/lib/trpc/server" import { serverClient } from "@/lib/trpc/server"
import styles from "./user.module.css" import styles from "./user.module.css"
export default async function User() { export default async function User() {

View File

@@ -1,6 +1,6 @@
import type { import type {
NavigationItem,
MenuItem, MenuItem,
NavigationItem,
} from "@/types/requests/myPages/navigation" } from "@/types/requests/myPages/navigation"
export function mapMenuItems(navigationItems: NavigationItem[]) { export function mapMenuItems(navigationItems: NavigationItem[]) {

View File

@@ -1,16 +1,20 @@
import { mapMenuItems } from "./helpers"
import { request } from "@/lib/graphql/request"
import { GetNavigationMyPages } from "@/lib/graphql/Query/NavigationMyPages.graphql"
import { Fragment } from "react" import { Fragment } from "react"
import { LogOut } from "react-feather" import { LogOut } from "react-feather"
import { GetNavigationMyPages } from "@/lib/graphql/Query/NavigationMyPages.graphql"
import { request } from "@/lib/graphql/request"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
import Title from "../Title" import Title from "../Title"
import { mapMenuItems } from "./helpers"
import styles from "./sidebar.module.css" import styles from "./sidebar.module.css"
import type { GetNavigationMyPagesData } from "@/types/requests/myPages/navigation" import type {
import type { SidebarProps } from "@/types/requests/myPages/navigation" GetNavigationMyPagesData,
SidebarProps,
} from "@/types/requests/myPages/navigation"
export default async function Sidebar({ lang }: SidebarProps) { export default async function Sidebar({ lang }: SidebarProps) {
const response = await request<GetNavigationMyPagesData>( const response = await request<GetNavigationMyPagesData>(

View File

@@ -1,7 +1,7 @@
import { cva } from "class-variance-authority" import { cva } from "class-variance-authority"
import Card from "@/components/MyProfile/Card"
import Image from "@/components/Image" import Image from "@/components/Image"
import Card from "@/components/MyProfile/Card"
import styles from "./profile.module.css" import styles from "./profile.module.css"

View File

@@ -12,9 +12,9 @@ import {
HouseIcon, HouseIcon,
PhoneIcon, PhoneIcon,
} from "@/components/Icons" } from "@/components/Icons"
import Field from "@/components/MyProfile/Field"
import CountrySelect from "@/components/TempDesignSystem/Form/Country" import CountrySelect from "@/components/TempDesignSystem/Form/Country"
import DateSelect from "@/components/TempDesignSystem/Form/Date" import DateSelect from "@/components/TempDesignSystem/Form/Date"
import Field from "@/components/MyProfile/Field"
import Input from "@/components/TempDesignSystem/Form/Input" import Input from "@/components/TempDesignSystem/Form/Input"
import Phone from "@/components/TempDesignSystem/Form/Phone" import Phone from "@/components/TempDesignSystem/Form/Phone"

View File

@@ -1,14 +1,15 @@
"use client" "use client"
import { FormProvider, useForm } from "react-hook-form"
import { useFormState as useReactFormState } from "react-dom"
import { useEffect } from "react"
import { zodResolver } from "@hookform/resolvers/zod" import { zodResolver } from "@hookform/resolvers/zod"
import { useEffect } from "react"
import { useFormState as useReactFormState } from "react-dom"
import { FormProvider, useForm } from "react-hook-form"
import { editProfile } from "@/actions/editProfile"
import { editProfileSchema, type EditProfileSchema } from "./schema"
import { useProfileStore } from "@/stores/edit-profile" import { useProfileStore } from "@/stores/edit-profile"
import { editProfile } from "@/actions/editProfile"
import FormContent from "./Content" import FormContent from "./Content"
import { type EditProfileSchema, editProfileSchema } from "./schema"
import styles from "./form.module.css" import styles from "./form.module.css"

View File

@@ -1,6 +1,7 @@
import { z } from "zod" import { z } from "zod"
import { _ } from "@/lib/translation" import { _ } from "@/lib/translation"
import { phoneValidator } from "@/utils/phoneValidator" import { phoneValidator } from "@/utils/phoneValidator"
export const editProfileSchema = z.object({ export const editProfileSchema = z.object({

View File

@@ -1,5 +1,6 @@
import { dt } from "@/lib/dt"
import { _ } from "@/lib/translation" import { _ } from "@/lib/translation"
import { countries } from "@/components/TempDesignSystem/Form/Country/countries" import { serverClient } from "@/lib/trpc/server"
import { import {
CalendarIcon, CalendarIcon,
@@ -7,14 +8,13 @@ import {
HouseIcon, HouseIcon,
PhoneIcon, PhoneIcon,
} from "@/components/Icons" } from "@/components/Icons"
import Container from "./Container" import { countries } from "@/components/TempDesignSystem/Form/Country/countries"
import Field from "../Field" import Field from "../Field"
import Container from "./Container"
import styles from "./profile.module.css" import styles from "./profile.module.css"
import { serverClient } from "@/lib/trpc/server"
import { dt } from "@/lib/dt"
export default async function Profile() { export default async function Profile() {
const user = await serverClient().user.get() const user = await serverClient().user.get()
const countryName = countries.find( const countryName = countries.find(

View File

@@ -1,22 +1,22 @@
"use client" "use client"
import { useController, useFormContext } from "react-hook-form" import { ErrorMessage } from "@hookform/error-message"
import { useRef } from "react" import { useRef } from "react"
import { _ } from "@/lib/translation"
import { countries } from "./countries"
import { import {
Button, Button,
ComboBox, ComboBox,
FieldError, FieldError,
Input, Input,
type Key,
ListBox, ListBox,
ListBoxItem, ListBoxItem,
Popover, Popover,
type Key,
} from "react-aria-components" } from "react-aria-components"
import { ErrorMessage } from "@hookform/error-message" import { useController, useFormContext } from "react-hook-form"
import { _ } from "@/lib/translation"
import SelectChevron from "../SelectChevron" import SelectChevron from "../SelectChevron"
import { countries } from "./countries"
import styles from "./country.module.css" import styles from "./country.module.css"

View File

@@ -1,16 +1,16 @@
"use client" "use client"
import { useRef } from "react" import { useRef } from "react"
import { import {
Button, Button,
type Key,
Label, Label,
ListBox, ListBox,
ListBoxItem, ListBoxItem,
Popover, Popover,
Select as ReactAriaSelect, Select as ReactAriaSelect,
SelectValue, SelectValue,
type Key,
} from "react-aria-components" } from "react-aria-components"
import SelectChevron from "../../SelectChevron" import SelectChevron from "../../SelectChevron"
import styles from "./select.module.css" import styles from "./select.module.css"

View File

@@ -1,4 +1,5 @@
import type { Control, RegisterOptions } from "react-hook-form" import type { Control, RegisterOptions } from "react-hook-form"
import type { EditProfileSchema } from "@/components/MyProfile/Profile/Edit/Form/schema" import type { EditProfileSchema } from "@/components/MyProfile/Profile/Edit/Form/schema"
export interface DateProps export interface DateProps

View File

@@ -1,25 +1,27 @@
"use client" "use client"
import { parseDate } from "@internationalized/date" import { parseDate } from "@internationalized/date"
import { useController, useFormContext, useWatch } from "react-hook-form"
import { _ } from "@/lib/translation"
import { dt } from "@/lib/dt"
import { rangeArray } from "@/utils/rangeArray"
import { import {
DateInput, DateInput,
DatePicker, DatePicker,
DateSegment, DateSegment,
Group, Group,
} from "react-aria-components" } from "react-aria-components"
import { useController, useFormContext, useWatch } from "react-hook-form"
import { dt } from "@/lib/dt"
import { _ } from "@/lib/translation"
import { rangeArray } from "@/utils/rangeArray"
import { DateName } from "./Select/select"
import Select from "./Select" import Select from "./Select"
import styles from "./date.module.css" import styles from "./date.module.css"
import { DateName } from "./Select/select"
import type { DateProps } from "./date"
import type { Key } from "react-aria-components" import type { Key } from "react-aria-components"
import type { DateProps } from "./date"
/** TODO: Get selecting with Enter-key to work */ /** TODO: Get selecting with Enter-key to work */
export default function DateSelect({ export default function DateSelect({
control, control,

View File

@@ -1,4 +1,4 @@
import { FieldValuesFromFieldErrors } from "@hookform/error-message" import type { FieldValuesFromFieldErrors } from "@hookform/error-message"
import type { import type {
FieldErrors, FieldErrors,
FieldName, FieldName,

View File

@@ -1,8 +1,8 @@
"use client" "use client"
import { Input as AriaInput, TextField } from "react-aria-components"
import { useController } from "react-hook-form" import { useController } from "react-hook-form"
import ErrorMessage from "@/components/TempDesignSystem/Form/ErrorMessage" import ErrorMessage from "@/components/TempDesignSystem/Form/ErrorMessage"
import { Input as AriaInput, TextField } from "react-aria-components"
import styles from "./input.module.css" import styles from "./input.module.css"

View File

@@ -1,6 +1,7 @@
import { EditProfileSchema } from "@/components/MyProfile/Profile/Edit/Form/schema"
import { Control, RegisterOptions } from "react-hook-form" import { Control, RegisterOptions } from "react-hook-form"
import { EditProfileSchema } from "@/components/MyProfile/Profile/Edit/Form/schema"
export interface InputProps export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> { extends React.InputHTMLAttributes<HTMLInputElement> {
control: Control<EditProfileSchema> control: Control<EditProfileSchema>

View File

@@ -1,11 +1,12 @@
"use client" "use client"
import "react-international-phone/style.css" import "react-international-phone/style.css"
import { useController, useFormContext, useWatch } from "react-hook-form"
import { useCallback, useEffect, useRef } from "react" import { useCallback, useEffect, useRef } from "react"
import { useController, useFormContext, useWatch } from "react-hook-form"
import { defaultCountries, getCountry } from "react-international-phone" import { defaultCountries, getCountry } from "react-international-phone"
import { PhoneInput, type PhoneInputRefType } from "react-international-phone"
import ErrorMessage from "@/components/TempDesignSystem/Form/ErrorMessage" import ErrorMessage from "@/components/TempDesignSystem/Form/ErrorMessage"
import { PhoneInput, type PhoneInputRefType } from "react-international-phone"
import styles from "./phone.module.css" import styles from "./phone.module.css"

View File

@@ -1,10 +1,9 @@
"use client" "use client"
import NextLink from "next/link"
import { usePathname } from "next/navigation" import { usePathname } from "next/navigation"
import { linkVariants } from "./variants" import { linkVariants } from "./variants"
import NextLink from "next/link"
import type { LinkProps } from "./link" import type { LinkProps } from "./link"
export default function Link({ export default function Link({

View File

@@ -1,12 +1,12 @@
import d from "dayjs"
import isToday from "dayjs/plugin/isToday"
import relativeTime from "dayjs/plugin/relativeTime"
import "dayjs/locale/da" import "dayjs/locale/da"
import "dayjs/locale/de" import "dayjs/locale/de"
import "dayjs/locale/fi" import "dayjs/locale/fi"
import "dayjs/locale/sv" import "dayjs/locale/sv"
import d from "dayjs"
import isToday from "dayjs/plugin/isToday"
import relativeTime from "dayjs/plugin/relativeTime"
/** /**
* dayjs export Norwegian as nb [Norwegian Bokmål] so here we create the same * dayjs export Norwegian as nb [Norwegian Bokmål] so here we create the same
* setup as nb has. * setup as nb has.

View File

@@ -1,9 +1,11 @@
import "server-only" import "server-only"
import { request } from "./request" import { request } from "./request"
import type { Data } from "@/types/request"
import type { BatchRequestDocument } from "graphql-request" import type { BatchRequestDocument } from "graphql-request"
import type { Data } from "@/types/request"
export async function batchRequest<T>( export async function batchRequest<T>(
queries: (BatchRequestDocument & NextFetchRequestConfig)[] queries: (BatchRequestDocument & NextFetchRequestConfig)[]
): Promise<Data<T>> { ): Promise<Data<T>> {

View File

@@ -1,11 +1,13 @@
import "server-only" import "server-only"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import { request as graphqlRequest } from "graphql-request" import { request as graphqlRequest } from "graphql-request"
import { env } from "@/env/server" import { env } from "@/env/server"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import type { DocumentNode } from "graphql"
import type { Data } from "@/types/request" import type { Data } from "@/types/request"
import type { DocumentNode } from "graphql"
export async function previewRequest<T>( export async function previewRequest<T>(
query: string | DocumentNode, query: string | DocumentNode,

View File

@@ -1,11 +1,14 @@
import "server-only" import "server-only"
import { GraphQLClient } from "graphql-request" import { GraphQLClient } from "graphql-request"
import { env } from "@/env/server"
import { cache } from "react" import { cache } from "react"
import type { Data } from "@/types/request" import { env } from "@/env/server"
import type { DocumentNode } from "graphql" import type { DocumentNode } from "graphql"
import type { Data } from "@/types/request"
const client = new GraphQLClient(env.CMS_URL, { const client = new GraphQLClient(env.CMS_URL, {
fetch: cache(async function ( fetch: cache(async function (
url: URL | RequestInfo, url: URL | RequestInfo,

View File

@@ -1,12 +1,14 @@
"use client" "use client"
import { useState } from "react"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { httpBatchLink } from "@trpc/client" import { httpBatchLink } from "@trpc/client"
import { useState } from "react"
import { env } from "@/env/client" import { env } from "@/env/client"
import { trpc } from "./client"
import { transformer } from "@/server/transformer" import { transformer } from "@/server/transformer"
import { trpc } from "./client"
function initializeTrpcClient() { function initializeTrpcClient() {
return trpc.createClient({ return trpc.createClient({
links: [ links: [

View File

@@ -2,7 +2,7 @@ import path from "node:path"
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged // https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
const buildEslintCommand = (filenames) => const buildEslintCommand = (filenames) =>
`next lint --max-warnings 0 --file ${filenames `next lint --fix --max-warnings 0 --file ${filenames
.map((f) => path.relative(process.cwd(), f)) .map((f) => path.relative(process.cwd(), f))
.join(" --file ")}` .join(" --file ")}`

11
package-lock.json generated
View File

@@ -47,6 +47,8 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8", "eslint": "^8",
"eslint-config-next": "^14.0.4", "eslint-config-next": "^14.0.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"husky": "^9.0.11", "husky": "^9.0.11",
"jiti": "^1.21.0", "jiti": "^1.21.0",
"lint-staged": "^15.2.2", "lint-staged": "^15.2.2",
@@ -4819,6 +4821,15 @@
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
}, },
"node_modules/eslint-plugin-simple-import-sort": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.0.tgz",
"integrity": "sha512-Y2fqAfC11TcG/WP3TrI1Gi3p3nc8XJyEOJYHyEPEGI/UAgNx6akxxlX74p7SbAQdLcgASKhj8M0GKvH3vq/+ig==",
"dev": true,
"peerDependencies": {
"eslint": ">=5.0.0"
}
},
"node_modules/eslint-scope": { "node_modules/eslint-scope": {
"version": "7.2.2", "version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",

View File

@@ -4,10 +4,14 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"prebuild": "npm run lint",
"build": "next build", "build": "next build",
"predev": "rm -rf .next", "predev": "rm -rf .next",
"dev": "next dev", "dev": "next dev",
"lint": "next lint && tsc", "prelint": "rm -rf .next",
"lint": "next lint --max-warnings 0 && tsc",
"prelint:fix": "rm -rf .next",
"lint:fix": "next lint --fix --max-warnings 0 && tsc",
"prepare": "husky", "prepare": "husky",
"start": "node .next/standalone/server.js", "start": "node .next/standalone/server.js",
"test:component": "cypress open --component", "test:component": "cypress open --component",
@@ -56,6 +60,8 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8", "eslint": "^8",
"eslint-config-next": "^14.0.4", "eslint-config-next": "^14.0.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"husky": "^9.0.11", "husky": "^9.0.11",
"jiti": "^1.21.0", "jiti": "^1.21.0",
"lint-staged": "^15.2.2", "lint-staged": "^15.2.2",