diff --git a/examples/nextjs-app-router/.eslintrc.json b/examples/nextjs-app-router/.eslintrc.json index 37224185..28c34da3 100644 --- a/examples/nextjs-app-router/.eslintrc.json +++ b/examples/nextjs-app-router/.eslintrc.json @@ -1,3 +1,11 @@ { - "extends": ["next/core-web-vitals", "next/typescript"] + "extends": ["next/core-web-vitals", "next/typescript"], + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "parserOptions": { + "project": ["./examples/nextjs-app-router/tsconfig.json"] + } + } + ] } diff --git a/examples/nextjs-app-router/app/auth/login/page.tsx b/examples/nextjs-app-router/app/auth/login/page.tsx index eceeaacc..ed43ef37 100644 --- a/examples/nextjs-app-router/app/auth/login/page.tsx +++ b/examples/nextjs-app-router/app/auth/login/page.tsx @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import { Login } from "@ory/elements-react/theme" -import { getLoginFlow, OryPageParams } from "@ory/nextjs/app" import { enhanceConfig } from "@ory/nextjs" +import { getLoginFlow, OryPageParams } from "@ory/nextjs/app" import config from "@/ory.config" -import CustomCardHeader from "@/components/custom-card-header" export default async function LoginPage(props: OryPageParams) { const flow = await getLoginFlow(props.searchParams) diff --git a/examples/nextjs-app-router/app/auth/recovery/page.tsx b/examples/nextjs-app-router/app/auth/recovery/page.tsx index 67718d65..1a18e046 100644 --- a/examples/nextjs-app-router/app/auth/recovery/page.tsx +++ b/examples/nextjs-app-router/app/auth/recovery/page.tsx @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 import { Recovery } from "@ory/elements-react/theme" -import { getRecoveryFlow, OryPageParams } from "@ory/nextjs/app" import { enhanceConfig } from "@ory/nextjs" +import { getRecoveryFlow, OryPageParams } from "@ory/nextjs/app" -import config from "@/ory.config" import CustomCardHeader from "@/components/custom-card-header" +import config from "@/ory.config" export default async function RecoveryPage(props: OryPageParams) { const flow = await getRecoveryFlow(props.searchParams) diff --git a/examples/nextjs-app-router/app/auth/registration/page.tsx b/examples/nextjs-app-router/app/auth/registration/page.tsx index bfbf218a..f2ba1ca9 100644 --- a/examples/nextjs-app-router/app/auth/registration/page.tsx +++ b/examples/nextjs-app-router/app/auth/registration/page.tsx @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import { Registration } from "@ory/elements-react/theme" -import { getRegistrationFlow, OryPageParams } from "@ory/nextjs/app" import { enhanceConfig } from "@ory/nextjs" +import { getRegistrationFlow, OryPageParams } from "@ory/nextjs/app" import config from "@/ory.config" -import CustomCardHeader from "@/components/custom-card-header" export default async function RegistrationPage(props: OryPageParams) { const flow = await getRegistrationFlow(props.searchParams) diff --git a/examples/nextjs-app-router/app/auth/verification/page.tsx b/examples/nextjs-app-router/app/auth/verification/page.tsx index 05730345..02c4ad24 100644 --- a/examples/nextjs-app-router/app/auth/verification/page.tsx +++ b/examples/nextjs-app-router/app/auth/verification/page.tsx @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 import { Verification } from "@ory/elements-react/theme" -import { getVerificationFlow, OryPageParams } from "@ory/nextjs/app" import { enhanceConfig } from "@ory/nextjs" +import { getVerificationFlow, OryPageParams } from "@ory/nextjs/app" -import config from "@/ory.config" import CustomCardHeader from "@/components/custom-card-header" +import config from "@/ory.config" export default async function VerificationPage(props: OryPageParams) { const flow = await getVerificationFlow(props.searchParams) diff --git a/examples/nextjs-app-router/app/page.tsx b/examples/nextjs-app-router/app/page.tsx index 0c2d5fdf..f5dfd24a 100644 --- a/examples/nextjs-app-router/app/page.tsx +++ b/examples/nextjs-app-router/app/page.tsx @@ -2,12 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 "use client" -import Link from "next/link" import { useSession } from "@ory/elements-react/client" +import Link from "next/link" export default function RootLayout() { const { session } = useSession() if (session) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return "Hello: " + session.identity?.traits.email } return ( diff --git a/examples/nextjs-pages-router/.eslintrc.json b/examples/nextjs-pages-router/.eslintrc.json index 37224185..16ccd3a5 100644 --- a/examples/nextjs-pages-router/.eslintrc.json +++ b/examples/nextjs-pages-router/.eslintrc.json @@ -1,3 +1,11 @@ { - "extends": ["next/core-web-vitals", "next/typescript"] + "extends": ["next/core-web-vitals", "next/typescript"], + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "parserOptions": { + "project": ["./examples/nextjs-pages-router/tsconfig.json"] + } + } + ] } diff --git a/examples/nextjs-pages-router/pages/api/hello.ts b/examples/nextjs-pages-router/pages/api/hello.ts index f945f205..56afe46e 100644 --- a/examples/nextjs-pages-router/pages/api/hello.ts +++ b/examples/nextjs-pages-router/pages/api/hello.ts @@ -4,7 +4,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction import type { NextApiRequest, NextApiResponse } from "next" -type Data = { +interface Data { name: string } diff --git a/examples/nextjs-pages-router/pages/index.tsx b/examples/nextjs-pages-router/pages/index.tsx index 9e9ab9e2..a6a3e28b 100644 --- a/examples/nextjs-pages-router/pages/index.tsx +++ b/examples/nextjs-pages-router/pages/index.tsx @@ -8,6 +8,7 @@ import { useSession } from "@ory/elements-react/client" export default function Home() { const { session } = useSession() if (session) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return "Hello: " + session.identity?.traits.email } return ( diff --git a/packages/nextjs/project.json b/packages/nextjs/project.json index c28dd483..45ec550d 100644 --- a/packages/nextjs/project.json +++ b/packages/nextjs/project.json @@ -16,6 +16,15 @@ "options": { "cwd": "packages/nextjs" } + }, + "test": { + "executor": "@nx/jest:jest", + "dependsOn": ["build"], + "options": { + "jestConfig": "packages/nextjs/jest.config.ts", + "coverage": true, + "coverageReporters": ["text", "cobertura"] + } } } }