From b8ce67fb332fcfe8a6ec14c0f29bbd671247f805 Mon Sep 17 00:00:00 2001 From: oxdev03 <140103378+oxdev03@users.noreply.github.com> Date: Sat, 21 Dec 2024 18:41:46 +0100 Subject: [PATCH] include non default dirs for linting --- apps/dashboard/cypress/utils/{mongodb.mjs => mongodb.js} | 3 ++- apps/dashboard/package.json | 4 ++-- apps/dashboard/trpc/query-client.ts | 3 ++- apps/dashboard/trpc/react.tsx | 9 +++++---- 4 files changed, 11 insertions(+), 8 deletions(-) rename apps/dashboard/cypress/utils/{mongodb.mjs => mongodb.js} (84%) diff --git a/apps/dashboard/cypress/utils/mongodb.mjs b/apps/dashboard/cypress/utils/mongodb.js similarity index 84% rename from apps/dashboard/cypress/utils/mongodb.mjs rename to apps/dashboard/cypress/utils/mongodb.js index 93c02cc..00a3e7b 100644 --- a/apps/dashboard/cypress/utils/mongodb.mjs +++ b/apps/dashboard/cypress/utils/mongodb.js @@ -2,13 +2,14 @@ import { MongoMemoryServer } from "mongodb-memory-server"; const mongod = await MongoMemoryServer.create({ instance: { - port: 20583, + port: 20_583, }, }); const uri = mongod.getUri(); console.log(`Database started: ${uri}`); +// eslint-disable-next-line no-undef process.on("exit", async () => { await mongod.stop(); console.log("[Database] Closed Connection!"); diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index f92ef41..06161ad 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -19,12 +19,12 @@ "dev:turbo": "next dev --turbopack", "build": "next build", "test:server": "dotenv -v NODE_ENV=test -- next start", - "test:db": "node cypress/utils/mongodb.mjs", + "test:db": "node cypress/utils/mongodb.js", "test:e2e": "cypress run", "test": "start-test test:db http://example.com test:server http://localhost:3000/login test:e2e", "test:watch": "cypress open", "start": "next start", - "lint": "next lint", + "lint": "next lint --dir cypress server trpc types utils", "lint:fix": "next lint --fix", "format": "prettier --write .", "format:check": "prettier --check ." diff --git a/apps/dashboard/trpc/query-client.ts b/apps/dashboard/trpc/query-client.ts index 6fc8211..cb24b4d 100644 --- a/apps/dashboard/trpc/query-client.ts +++ b/apps/dashboard/trpc/query-client.ts @@ -1,6 +1,7 @@ +import "@/utils/superjson-serializer"; + import { defaultShouldDehydrateQuery, QueryClient } from "@tanstack/react-query"; import SuperJSON from "superjson"; -import "@/utils/superjson-serializer"; export const createQueryClient = () => new QueryClient({ diff --git a/apps/dashboard/trpc/react.tsx b/apps/dashboard/trpc/react.tsx index 225a346..3333cf8 100644 --- a/apps/dashboard/trpc/react.tsx +++ b/apps/dashboard/trpc/react.tsx @@ -1,12 +1,14 @@ +/* eslint-disable unicorn/prefer-global-this */ "use client"; +import "@/utils/superjson-serializer"; + import { type QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { loggerLink, httpBatchLink } from "@trpc/client"; +import { httpBatchLink, loggerLink } from "@trpc/client"; import { createTRPCReact } from "@trpc/react-query"; import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server"; import { useState } from "react"; import SuperJSON from "superjson"; -import "@/utils/superjson-serializer"; import { type AppRouter } from "@/server/api/root"; @@ -45,9 +47,8 @@ export function TRPCReactProvider(props: { children: React.ReactNode }) { api.createClient({ links: [ loggerLink({ - enabled: (op) => false && + enabled: (op) => process.env.NODE_ENV === "development" || (op.direction === "down" && op.result instanceof Error), - }), httpBatchLink({ transformer: SuperJSON,