@@ -244,7 +344,12 @@ export const renderOptions: RenderOptions = {
)
},
- [RTETypeEnum.th]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
+ [RTETypeEnum.th]: (
+ node: RTEDefaultNode,
+ embeds: EmbedByUid,
+ next: RTENext,
+ fullRenderOptions: RenderOptions
+ ) => {
const props = extractPossibleAttributes(node.attrs)
return (
|
@@ -253,7 +358,12 @@ export const renderOptions: RenderOptions = {
)
},
- [RTETypeEnum.td]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
+ [RTETypeEnum.td]: (
+ node: RTEDefaultNode,
+ embeds: EmbedByUid,
+ next: RTENext,
+ fullRenderOptions: RenderOptions
+ ) => {
const props = extractPossibleAttributes(node.attrs)
return (
|
@@ -262,7 +372,12 @@ export const renderOptions: RenderOptions = {
)
},
- [RTETypeEnum.ul]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
+ [RTETypeEnum.ul]: (
+ node: RTEDefaultNode,
+ embeds: EmbedByUid,
+ next: RTENext,
+ fullRenderOptions: RenderOptions
+ ) => {
const props = extractPossibleAttributes(node.attrs)
return (
@@ -309,7 +424,11 @@ export const renderOptions: RenderOptions = {
)
},
- [RTEMarkType.classnameOrId]: (children: React.ReactNode, className?: string, id?: string) => {
+ [RTEMarkType.classnameOrId]: (
+ children: React.ReactNode,
+ className?: string,
+ id?: string
+ ) => {
let props = {
className,
id,
@@ -331,7 +450,12 @@ export const renderOptions: RenderOptions = {
* Contentstack can return something called `default` as seen here in their
* own SDK (https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/options/default-node-options.ts#L89)
*/
- default: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
+ default: (
+ node: RTEDefaultNode,
+ embeds: EmbedByUid,
+ next: RTENext,
+ fullRenderOptions: RenderOptions
+ ) => {
return next(node.children, embeds, fullRenderOptions)
},
}
diff --git a/components/JsonToHtml/utils.tsx b/components/JsonToHtml/utils.tsx
index be686b508..82facb895 100644
--- a/components/JsonToHtml/utils.tsx
+++ b/components/JsonToHtml/utils.tsx
@@ -6,22 +6,24 @@ import { RTETypeEnum } from "@/types/rte/enums"
import type { EmbedByUid } from "@/types/components/jsontohtml"
import type { Node } from "@/types/requests/utils/edges"
import type { RenderOptions } from "@/types/rte/option"
-import type { RTENode, RTETextNode, RTERenderOptionComponent } from "@/types/rte/node"
+import type {
+ RTENode,
+ RTETextNode,
+ RTERenderOptionComponent,
+} from "@/types/rte/node"
import type { Embeds } from "@/types/requests/embeds"
export function groupEmbedsByUid(embedsArray: Node[]) {
- const embedsByUid = embedsArray
- .reduce((acc, embed) => {
- if (embed.node.system.uid) {
- acc[embed.node.system.uid] = embed
- }
- return acc
- }, {})
+ const embedsByUid = embedsArray.reduce((acc, embed) => {
+ if (embed.node.system.uid) {
+ acc[embed.node.system.uid] = embed
+ }
+ return acc
+ }, {})
return embedsByUid
}
-
export function nodeChildrenToHtml(
nodes: RTENode[],
embeds: EmbedByUid,
diff --git a/components/SkipToMainContent/index.tsx b/components/SkipToMainContent/index.tsx
index eed2289ee..39ec6f5f0 100644
--- a/components/SkipToMainContent/index.tsx
+++ b/components/SkipToMainContent/index.tsx
@@ -1,24 +1,24 @@
-import { Lang, langEnum } from "@/types/lang";
+import { Lang, langEnum } from "@/types/lang"
export default function SkipToMainContent({ lang }: { lang: Lang }) {
- let message = "Skip to main content";
+ let message = "Skip to main content"
switch (lang) {
case langEnum.de:
- message = "Direkt zum Inhalt";
- break;
+ message = "Direkt zum Inhalt"
+ break
case langEnum.sv:
- message = "Fortsätt till huvudinnehåll";
- break;
+ message = "Fortsätt till huvudinnehåll"
+ break
case langEnum.da:
- message = "Spring over og gå til hovedindhold";
- break;
+ message = "Spring over og gå til hovedindhold"
+ break
case langEnum.no:
- message = "Gå videre til hovedsiden";
- break;
+ message = "Gå videre til hovedsiden"
+ break
case langEnum.fi:
- message = "Siirry pääsisältöön";
- break;
+ message = "Siirry pääsisältöön"
+ break
}
return (
@@ -27,5 +27,5 @@ export default function SkipToMainContent({ lang }: { lang: Lang }) {
{message}
- );
+ )
}
diff --git a/constants/locales.ts b/constants/locales.ts
index 0937413a3..3ba2d1a2a 100644
--- a/constants/locales.ts
+++ b/constants/locales.ts
@@ -1,4 +1,4 @@
-import { langEnum } from "@/types/lang";
+import { langEnum } from "@/types/lang"
export const localeToLang = {
en: langEnum.en,
@@ -38,4 +38,4 @@ export const localeToLang = {
"nb-NO": langEnum.no,
"nn-NO": langEnum.no,
"se-NO": langEnum.no,
-};
+}
diff --git a/env/client.ts b/env/client.ts
index ed878b643..c9690d29e 100644
--- a/env/client.ts
+++ b/env/client.ts
@@ -5,4 +5,4 @@ export const env = createEnv({
client: {},
emptyStringAsUndefined: true,
runtimeEnv: {},
-});
\ No newline at end of file
+})
diff --git a/env/server.ts b/env/server.ts
index 8922405f4..9e17194a9 100644
--- a/env/server.ts
+++ b/env/server.ts
@@ -1,5 +1,5 @@
import { createEnv } from "@t3-oss/env-nextjs"
-import { z } from "zod";
+import { z } from "zod"
export const env = createEnv({
server: {
@@ -23,4 +23,4 @@ export const env = createEnv({
NODE_ENV: process.env.NODE_ENV,
PRINT_QUERY: process.env.PRINT_QUERY,
},
-});
\ No newline at end of file
+})
diff --git a/lib/graphql/Fragments/Aside/Contact.graphql b/lib/graphql/Fragments/Aside/Contact.graphql
index ec318ff1d..32c51dbd5 100644
--- a/lib/graphql/Fragments/Aside/Contact.graphql
+++ b/lib/graphql/Fragments/Aside/Contact.graphql
@@ -11,4 +11,4 @@ fragment ContactAside on CurrentBlocksPageAsideContact {
totalCount
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/graphql/Fragments/Aside/Puff.graphql b/lib/graphql/Fragments/Aside/Puff.graphql
index 18c93f009..1cdc63204 100644
--- a/lib/graphql/Fragments/Aside/Puff.graphql
+++ b/lib/graphql/Fragments/Aside/Puff.graphql
@@ -11,4 +11,4 @@ fragment PuffAside on CurrentBlocksPageAsidePuff {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/graphql/Fragments/Blocks/Puff.graphql b/lib/graphql/Fragments/Blocks/Puff.graphql
index 2dbdb2a09..4c125bceb 100644
--- a/lib/graphql/Fragments/Blocks/Puff.graphql
+++ b/lib/graphql/Fragments/Blocks/Puff.graphql
@@ -12,4 +12,4 @@ fragment PuffBlock on CurrentBlocksPageBlocksPuffs {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/graphql/Fragments/Contact.graphql b/lib/graphql/Fragments/Contact.graphql
index fb2c4574e..a38910e6e 100644
--- a/lib/graphql/Fragments/Contact.graphql
+++ b/lib/graphql/Fragments/Contact.graphql
@@ -21,4 +21,4 @@ fragment Contact on ContactBlock {
street
zip
}
-}
\ No newline at end of file
+}
diff --git a/lib/graphql/Fragments/Puff.graphql b/lib/graphql/Fragments/Puff.graphql
index e8e22d952..d99f25346 100644
--- a/lib/graphql/Fragments/Puff.graphql
+++ b/lib/graphql/Fragments/Puff.graphql
@@ -38,4 +38,4 @@ fragment Puff on Puff {
}
}
title
-}
\ No newline at end of file
+}
diff --git a/lib/previewRequest.ts b/lib/previewRequest.ts
index add923e7e..eb655147e 100644
--- a/lib/previewRequest.ts
+++ b/lib/previewRequest.ts
@@ -1,11 +1,11 @@
-import "server-only";
-import { request as graphqlRequest } from "graphql-request";
+import "server-only"
+import { request as graphqlRequest } from "graphql-request"
-import { env } from "@/env/server";
+import { env } from "@/env/server"
-import type { Data } from "@/types/request";
-import type { DocumentNode } from "graphql";
-import ContentstackLivePreview from "@contentstack/live-preview-utils";
+import type { Data } from "@/types/request"
+import type { DocumentNode } from "graphql"
+import ContentstackLivePreview from "@contentstack/live-preview-utils"
export async function previewRequest(
query: string | DocumentNode,
@@ -33,7 +33,7 @@ export async function previewRequest(
return { data: response }
} catch (error) {
- console.error(error);
- throw new Error("Something went wrong");
+ console.error(error)
+ throw new Error("Something went wrong")
}
}
diff --git a/lib/request.ts b/lib/request.ts
index 92e5889e4..cc333dfcb 100644
--- a/lib/request.ts
+++ b/lib/request.ts
@@ -5,7 +5,10 @@ import { env } from "@/env/server"
import type { Data } from "@/types/request"
import type { DocumentNode } from "graphql"
-export async function request(query: string | DocumentNode, variables?: {}): Promise> {
+export async function request(
+ query: string | DocumentNode,
+ variables?: {}
+): Promise> {
try {
if (env.PRINT_QUERY) {
const graphqlRawRequest = (await import("graphql-request")).rawRequest
diff --git a/middleware.ts b/middleware.ts
index 760d15083..5f566bbd3 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -1,6 +1,6 @@
-import ContentstackLivePreview from "@contentstack/live-preview-utils";
-import { NextResponse } from "next/server";
-import type { NextRequest } from "next/server";
+import ContentstackLivePreview from "@contentstack/live-preview-utils"
+import { NextResponse } from "next/server"
+import type { NextRequest } from "next/server"
// This function can be marked `async` if using `await` inside
export async function middleware(request: NextRequest) {
@@ -69,4 +69,4 @@ export const config = {
*/
"/((?!api|_next/static|_next/image|Static|imageVault|contentassets|favicon.ico).*)",
],
-};
+}
diff --git a/mockCms/de/scandic-entdecken/wlan/data.json b/mockCms/de/scandic-entdecken/wlan/data.json
index 5abaf37a5..36f1bfa07 100644
--- a/mockCms/de/scandic-entdecken/wlan/data.json
+++ b/mockCms/de/scandic-entdecken/wlan/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/de/sponsoring/data.json b/mockCms/de/sponsoring/data.json
index 9be3215f7..739e3f302 100644
--- a/mockCms/de/sponsoring/data.json
+++ b/mockCms/de/sponsoring/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/en/sponsoring/data.json b/mockCms/en/sponsoring/data.json
index 5f9826dc5..fcf65cc51 100644
--- a/mockCms/en/sponsoring/data.json
+++ b/mockCms/en/sponsoring/data.json
@@ -1,4 +1,4 @@
{
"hero": "",
"content": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/fi/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista/data.json b/mockCms/fi/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista/data.json
index 22094d499..74fba7840 100644
--- a/mockCms/fi/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista/data.json
+++ b/mockCms/fi/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/no/kundeservice/sporsmal-og-svar/bruk-av-nettsiden/data.json b/mockCms/no/kundeservice/sporsmal-og-svar/bruk-av-nettsiden/data.json
index c17fb84a7..2b9335ed7 100644
--- a/mockCms/no/kundeservice/sporsmal-og-svar/bruk-av-nettsiden/data.json
+++ b/mockCms/no/kundeservice/sporsmal-og-svar/bruk-av-nettsiden/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/no/vi-sponser/data.json b/mockCms/no/vi-sponser/data.json
index 60c7554dd..097c6e2ca 100644
--- a/mockCms/no/vi-sponser/data.json
+++ b/mockCms/no/vi-sponser/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/mockCms/sv/kundservice/fragor-och-svar/om-scandics-webbplats/data.json b/mockCms/sv/kundservice/fragor-och-svar/om-scandics-webbplats/data.json
index a22af48f1..13c01969e 100644
--- a/mockCms/sv/kundservice/fragor-och-svar/om-scandics-webbplats/data.json
+++ b/mockCms/sv/kundservice/fragor-och-svar/om-scandics-webbplats/data.json
@@ -1,4 +1,4 @@
{
"content": "",
"hero": ""
-}
\ No newline at end of file
+}
diff --git a/next.config.js b/next.config.js
index 9853b1e4a..526ce8d5e 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,9 +1,9 @@
import createJiti from "jiti"
-const jiti = createJiti(new URL(import.meta.url).pathname);
+const jiti = createJiti(new URL(import.meta.url).pathname)
-jiti("./env/server");
-jiti("./env/client");
+jiti("./env/server")
+jiti("./env/client")
/** @type {import('next').NextConfig} */
const nextConfig = {
@@ -22,11 +22,11 @@ const nextConfig = {
config.module.rules.push({
test: /\.(graphql|gql)/,
exclude: /node_modules/,
- loader: "graphql-tag/loader"
- });
+ loader: "graphql-tag/loader",
+ })
- return config;
- }
-};
+ return config
+ },
+}
-export default nextConfig
\ No newline at end of file
+export default nextConfig
diff --git a/package.json b/package.json
index e23942259..2e5b2efc7 100644
--- a/package.json
+++ b/package.json
@@ -34,4 +34,4 @@
"engines": {
"node": "18"
}
-}
\ No newline at end of file
+}
diff --git a/tsconfig.json b/tsconfig.json
index 1f09de8db..83ababe71 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es2022",
- "lib": [
- "dom",
- "dom.iterable",
- "ES2022"
- ],
+ "lib": ["dom", "dom.iterable", "ES2022"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
@@ -25,18 +21,9 @@
}
],
"paths": {
- "@/*": [
- "./*"
- ]
+ "@/*": ["./*"]
}
},
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- ".next/types/**/*.ts"
- ],
- "exclude": [
- "node_modules"
- ]
-}
\ No newline at end of file
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "exclude": ["node_modules"]
+}
diff --git a/types/components/current/header.ts b/types/components/current/header.ts
index 8ff62705b..2b626d5c1 100644
--- a/types/components/current/header.ts
+++ b/types/components/current/header.ts
@@ -1,3 +1,3 @@
export type HeaderProps = {
- pathname: string;
-};
+ pathname: string
+}
diff --git a/types/components/current/hero.ts b/types/components/current/hero.ts
index e59f3a0bd..04ef27c4a 100644
--- a/types/components/current/hero.ts
+++ b/types/components/current/hero.ts
@@ -4,4 +4,4 @@ export type HeroProps = {
images: {
node: Image
}[]
-}
\ No newline at end of file
+}
diff --git a/types/components/jsontohtml.ts b/types/components/jsontohtml.ts
index 720f60ee6..4f319e6ed 100644
--- a/types/components/jsontohtml.ts
+++ b/types/components/jsontohtml.ts
@@ -1,8 +1,8 @@
import type { RTENode } from "../rte/node"
-import type { Node } from "@/types/requests/utils/edges";
-import type { RenderOptions } from "../rte/option";
-import type { Embeds } from "@/types/requests/embeds";
+import type { Node } from "@/types/requests/utils/edges"
+import type { RenderOptions } from "../rte/option"
+import type { Embeds } from "@/types/requests/embeds"
export type JsonToHtmlProps = {
embeds: Node[]
diff --git a/types/graphql.d.ts b/types/graphql.d.ts
index 58aebd5ac..bd437a815 100644
--- a/types/graphql.d.ts
+++ b/types/graphql.d.ts
@@ -1 +1 @@
-declare module '*.graphql'
\ No newline at end of file
+declare module "*.graphql"
diff --git a/types/lang.ts b/types/lang.ts
index 0564e2c6d..5268fb79f 100644
--- a/types/lang.ts
+++ b/types/lang.ts
@@ -5,6 +5,6 @@ export const langEnum = {
fi: "fi",
da: "da",
de: "de",
-};
+}
-export type Lang = keyof typeof langEnum;
+export type Lang = keyof typeof langEnum
diff --git a/types/params.ts b/types/params.ts
index 1022d3f12..34c94fa5d 100644
--- a/types/params.ts
+++ b/types/params.ts
@@ -1,27 +1,27 @@
-import { Lang } from './lang';
+import { Lang } from "./lang"
export type SearchParams = {
- searchParams: S & { [key: string]: string };
-};
+ searchParams: S & { [key: string]: string }
+}
export type Params = {
- params: P;
-};
+ params: P
+}
export type LangParams = {
- lang: Lang;
-};
+ lang: Lang
+}
export type UriParams = {
- uri?: string;
-};
+ uri?: string
+}
export type PreviewParams = {
uri?: string
live_preview?: string
}
-export type LayoutArgs = P extends undefined ? {} : Params ;
+export type LayoutArgs = P extends undefined ? {} : Params
export type PageArgs = LayoutArgs &
- (S extends undefined ? {} : SearchParams);
+ (S extends undefined ? {} : SearchParams)
diff --git a/types/request.ts b/types/request.ts
index 0b7d8b305..b98182f94 100644
--- a/types/request.ts
+++ b/types/request.ts
@@ -1,3 +1,3 @@
export type Data = {
data: T
-}
\ No newline at end of file
+}
diff --git a/types/requests/blocks/list.ts b/types/requests/blocks/list.ts
index 8332f6faf..d48812b10 100644
--- a/types/requests/blocks/list.ts
+++ b/types/requests/blocks/list.ts
@@ -64,5 +64,4 @@ export type List = {
}
}
-
export type ListProps = List
diff --git a/types/requests/puff.ts b/types/requests/puff.ts
index 4a591a333..38ab627d0 100644
--- a/types/requests/puff.ts
+++ b/types/requests/puff.ts
@@ -20,4 +20,4 @@ export type Puff = {
json: RTEDocument
}
title: string
-}
\ No newline at end of file
+}
diff --git a/types/requests/utils/all.ts b/types/requests/utils/all.ts
index c8b13cf5a..6fdd81098 100644
--- a/types/requests/utils/all.ts
+++ b/types/requests/utils/all.ts
@@ -1,4 +1,4 @@
export type AllRequestResponse = {
items: T[]
total: number
-}
\ No newline at end of file
+}
diff --git a/types/rte/attrs.ts b/types/rte/attrs.ts
index ba1db3109..c0b15bfe0 100644
--- a/types/rte/attrs.ts
+++ b/types/rte/attrs.ts
@@ -9,7 +9,7 @@ export interface Attributes {
}
export interface RTEAssetAttrs extends Attributes {
- "alt": string
+ alt: string
"asset-alt": string
"asset-link": string
"asset-name": string
@@ -17,8 +17,8 @@ export interface RTEAssetAttrs extends Attributes {
"asset-uid": string
"display-type": EmbedTypesEnum.display
"content-type-uid": "sys_assets"
- "inline": false
- "type": RTEItemTypeEnum.asset
+ inline: false
+ type: RTEItemTypeEnum.asset
}
export interface RTEAnchorAttrs extends Attributes {
@@ -27,10 +27,10 @@ export interface RTEAnchorAttrs extends Attributes {
}
export interface RTELinkAttrs extends Attributes {
- 'display-type': EmbedTypesEnum.link
- 'class-name': string
- 'content-type-uid': string
- 'entry-uid': string
+ "display-type": EmbedTypesEnum.link
+ "class-name": string
+ "content-type-uid": string
+ "entry-uid": string
locale: Lang
href: string
target: HTMLAnchorElement["target"]
diff --git a/types/rte/enums.ts b/types/rte/enums.ts
index dbebc30bd..b5eb2a6a1 100644
--- a/types/rte/enums.ts
+++ b/types/rte/enums.ts
@@ -1,9 +1,9 @@
export enum EmbedTypesEnum {
- block = 'block',
- display = 'display',
- download = 'download',
- inline = 'inline',
- link = 'link',
+ block = "block",
+ display = "display",
+ download = "download",
+ inline = "inline",
+ link = "link",
}
export type EmbedTypes = keyof typeof EmbedTypesEnum
diff --git a/types/rte/node.ts b/types/rte/node.ts
index c39666497..25e9080bd 100644
--- a/types/rte/node.ts
+++ b/types/rte/node.ts
@@ -1,5 +1,10 @@
import { RTETypeEnum } from "./enums"
-import type { Attributes, RTEAnchorAttrs, RTEAssetAttrs, RTELinkAttrs } from "./attrs"
+import type {
+ Attributes,
+ RTEAnchorAttrs,
+ RTEAssetAttrs,
+ RTELinkAttrs,
+} from "./attrs"
import type { EmbedByUid } from "../components/jsontohtml"
import type { RenderOptions } from "./option"
@@ -58,14 +63,26 @@ export type RTEReferenceNode = RTEDefaultNode | RTEAnchorNode
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
-export type RTERenderMark = (children: React.ReactNode, classname?: string, id?: string) => JSX.Element
+export type RTERenderMark = (
+ children: React.ReactNode,
+ classname?: string,
+ id?: string
+) => JSX.Element
export interface RTEDocument extends RTEDefaultNode {
type: RTETypeEnum.doc
_version: number
}
-export type RTERenderOptionComponent = (node: RTERegularNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => React.ReactNode
-
-export type RTENext = (nodes: RTENode[], embeds: EmbedByUid, fullRenderOptions: RenderOptions) => string
+export type RTERenderOptionComponent = (
+ node: RTERegularNode,
+ embeds: EmbedByUid,
+ next: RTENext,
+ fullRenderOptions: RenderOptions
+) => React.ReactNode
+export type RTENext = (
+ nodes: RTENode[],
+ embeds: EmbedByUid,
+ fullRenderOptions: RenderOptions
+) => string
|