diff --git a/.github/workflows/tests-and-checks.yml b/.github/workflows/tests-and-checks.yml index 20aaf8e2..890e8977 100644 --- a/.github/workflows/tests-and-checks.yml +++ b/.github/workflows/tests-and-checks.yml @@ -19,7 +19,7 @@ jobs: run: cd apps/server && pnpm prisma generate - name: Typecheck run: pnpm ts:check - - name: Linting - run: pnpm lint + - name: Linting & Formatting + run: pnpm check - name: Test run: pnpm test diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..699ed733 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["biomejs.biome"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3aecb915 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,46 @@ +{ + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.removeUnused.ts": "explicit", + "source.organizeImports.biome": "explicit" + }, + "[javascript]": { + "editor.maxTokenizationLineLength": 2500, + "editor.defaultFormatter": "biomejs.biome" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[markdown]": { + "editor.unicodeHighlight.ambiguousCharacters": false, + "editor.unicodeHighlight.invisibleCharacters": false, + "diffEditor.ignoreTrimWhitespace": false, + "editor.wordWrap": "on", + "editor.quickSuggestions": { + "comments": "off", + "strings": "off", + "other": "off" + }, + "editor.defaultFormatter": "biomejs.biome" + }, + "[json]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace", + "editor.defaultFormatter": "biomejs.biome" + }, + "[jsonc]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace", + "editor.defaultFormatter": "biomejs.biome" + } +} diff --git a/apps/events/biome.jsonc b/apps/events/biome.jsonc new file mode 100644 index 00000000..a203ecf0 --- /dev/null +++ b/apps/events/biome.jsonc @@ -0,0 +1,251 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "extends": ["../../biome.jsonc"], + "linter": { "rules": { "recommended": false }, "ignore": ["dist"] }, + "overrides": [ + { + "include": ["**/*.{ts,tsx}"], + "linter": { + "rules": { + "complexity": { + "noExtraBooleanCast": "error", + "noMultipleSpacesInRegularExpressionLiterals": "error", + "noUselessCatch": "error", + "noWith": "error" + }, + "correctness": { + "noConstAssign": "error", + "noConstantCondition": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInvalidBuiltinInstantiation": "error", + "noInvalidConstructorSuper": "error", + "noNonoctalDecimalEscape": "error", + "noPrecisionLoss": "error", + "noSelfAssign": "error", + "noSetterReturn": "error", + "noSwitchDeclarations": "error", + "noUndeclaredVariables": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedLabels": "error", + "noUnusedPrivateClassMembers": "error", + "noUnusedVariables": "error", + "useIsNan": "error", + "useValidForDirection": "error", + "useYield": "error" + }, + "suspicious": { + "noAssignInExpressions": "error", + "noAsyncPromiseExecutor": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCompareNegZero": "error", + "noControlCharactersInRegex": "error", + "noDebugger": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noEmptyBlockStatements": "error", + "noFallthroughSwitchClause": "error", + "noFunctionAssign": "error", + "noGlobalAssign": "error", + "noImportAssign": "error", + "noMisleadingCharacterClass": "error", + "noPrototypeBuiltins": "error", + "noRedeclare": "error", + "noShadowRestrictedNames": "error", + "noSparseArray": "error", + "noUnsafeNegation": "error", + "useGetterReturn": "error", + "useValidTypeof": "error" + } + } + } + }, + { "include": ["**/*.{ts,tsx}"], "javascript": { "globals": [] } }, + { + "include": ["**/*.{ts,tsx}"], + "linter": { + "rules": { + "correctness": { + "noConstAssign": "off", + "noGlobalObjectCalls": "off", + "noInvalidBuiltinInstantiation": "off", + "noInvalidConstructorSuper": "off", + "noNewSymbol": "off", + "noSetterReturn": "off", + "noUndeclaredVariables": "off", + "noUnreachable": "off", + "noUnreachableSuper": "off" + }, + "style": { "noArguments": "error", "noVar": "error", "useConst": "error" }, + "suspicious": { + "noClassAssign": "off", + "noDuplicateClassMembers": "off", + "noDuplicateObjectKeys": "off", + "noDuplicateParameters": "off", + "noFunctionAssign": "off", + "noImportAssign": "off", + "noRedeclare": "off", + "noUnsafeNegation": "off", + "useGetterReturn": "off" + } + } + } + }, + { + "include": ["**/*.{ts,tsx}"], + "linter": { + "rules": { + "complexity": { "noUselessThisAlias": "error", "noUselessTypeConstraint": "error" }, + "correctness": { "noUnusedVariables": "error", "useArrayLiterals": "off" }, + "style": { "noNamespace": "error", "useAsConstAssertion": "error" }, + "suspicious": { + "noExplicitAny": "error", + "noExtraNonNullAssertion": "error", + "noMisleadingInstantiator": "error", + "noUnsafeDeclarationMerging": "error", + "useNamespaceKeyword": "error" + } + } + } + }, + { + "include": ["**/*.{ts,tsx}"], + "javascript": { + "globals": [ + "onscrollend", + "onpointerleave", + "oncontextrestored", + "onemptied", + "ongamepaddisconnected", + "onkeypress", + "onloadeddata", + "onmouseup", + "onvolumechange", + "onpaste", + "onstorage", + "onkeyup", + "onabort", + "oncut", + "ontransitionrun", + "onafterprint", + "onblur", + "ondurationchange", + "ontransitionstart", + "oncanplaythrough", + "onanimationend", + "onmouseleave", + "ondragleave", + "onplay", + "onunhandledrejection", + "onbeforeprint", + "onpointercancel", + "onsubmit", + "ondragstart", + "onmessage", + "location", + "onoffline", + "onappinstalled", + "onwheel", + "onended", + "onkeydown", + "onclick", + "onfocus", + "onscroll", + "ongamepadconnected", + "oncanplay", + "onpointerdown", + "ondeviceorientationabsolute", + "onauxclick", + "ondevicemotion", + "onratechange", + "ontransitionend", + "onscrollsnapchanging", + "onchange", + "onselect", + "onbeforeinstallprompt", + "onbeforetoggle", + "onmouseout", + "ontimeupdate", + "ondragover", + "oncuechange", + "ontransitioncancel", + "onprogress", + "onbeforeinput", + "onpointerenter", + "onmouseenter", + "oninvalid", + "onpointerout", + "onpagereveal", + "onpause", + "onanimationstart", + "onwaiting", + "onscrollsnapchange", + "ondeviceorientation", + "onclose", + "onbeforeunload", + "oncancel", + "onseeked", + "onpointerover", + "ongotpointercapture", + "onloadedmetadata", + "onpageshow", + "onstalled", + "oncontextmenu", + "onreset", + "ondrag", + "onbeforematch", + "onload", + "onlostpointercapture", + "onsuspend", + "onselectionchange", + "onpagehide", + "onrejectionhandled", + "onunload", + "onanimationcancel", + "onmousedown", + "onpointerup", + "onmouseover", + "onformdata", + "oncontentvisibilityautostatechange", + "onresize", + "onsearch", + "ontoggle", + "onpageswap", + "onbeforexrselect", + "onlanguagechange", + "ondragenter", + "onerror", + "onpointermove", + "onmousemove", + "ondrop", + "onhashchange", + "onsecuritypolicyviolation", + "onslotchange", + "oncopy", + "onanimationiteration", + "ondblclick", + "ondragend", + "onpointerrawupdate", + "onpopstate", + "onplaying", + "oncontextlost", + "onloadstart", + "onseeking", + "oninput", + "onmessageerror", + "onselectstart", + "onmousewheel", + "ononline" + ] + }, + "linter": { "rules": { "correctness": { "useExhaustiveDependencies": "warn", "useHookAtTopLevel": "error" } } } + } + ] +} diff --git a/apps/events/components.json b/apps/events/components.json index 76d1f608..aa38200a 100644 --- a/apps/events/components.json +++ b/apps/events/components.json @@ -17,4 +17,4 @@ "lib": "@/lib", "hooks": "@/hooks" } -} \ No newline at end of file +} diff --git a/apps/events/eslint.config.js b/apps/events/eslint.config.js deleted file mode 100644 index 092408a9..00000000 --- a/apps/events/eslint.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' - -export default tseslint.config( - { ignores: ['dist'] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, - }, -) diff --git a/apps/events/package.json b/apps/events/package.json index 0737cad9..0334aa5c 100644 --- a/apps/events/package.json +++ b/apps/events/package.json @@ -6,7 +6,12 @@ "scripts": { "dev": "vite --force", "build": "tsc -b && vite build", - "lint": "eslint .", + "lint": "pnpm biome lint src/*", + "lint:fix": "pnpm biome lint --write src/*", + "format": "pnpm biome format src/*", + "format:fix": "pnpm biome format --write src/*", + "check": "pnpm biome check src/*", + "check:fix": "pnpm biome check --write src/*", "preview": "vite preview", "test": "vitest run", "ts:check": "tsc --noEmit" @@ -36,7 +41,7 @@ "vite-plugin-node-polyfills": "^0.22.0" }, "devDependencies": { - "@eslint/js": "^9.12.0", + "@biomejs/biome": "1.9.4", "@tanstack/router-devtools": "^1.62.1", "@tanstack/router-plugin": "^1.62.0", "@types/node": "^22.7.4", @@ -45,14 +50,9 @@ "@types/uuid": "^10.0.0", "@vitejs/plugin-react": "^4.3.2", "autoprefixer": "^10.4.20", - "eslint": "^9.12.0", - "eslint-plugin-react-hooks": "^5.1.0-rc.0", - "eslint-plugin-react-refresh": "^0.4.9", "globals": "^15.10.0", "postcss": "^8.4.47", "tailwindcss": "^3.4.13", - "typescript": "^5.5.3", - "typescript-eslint": "^8.8.0", "vite-plugin-top-level-await": "^1.4.4", "vite-plugin-wasm": "^3.3.0" } diff --git a/apps/events/postcss.config.js b/apps/events/postcss.config.js index 2e7af2b7..2aa7205d 100644 --- a/apps/events/postcss.config.js +++ b/apps/events/postcss.config.js @@ -3,4 +3,4 @@ export default { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/apps/events/src/Boot.tsx b/apps/events/src/Boot.tsx index 8ea78b06..a0c728ce 100644 --- a/apps/events/src/Boot.tsx +++ b/apps/events/src/Boot.tsx @@ -1,13 +1,13 @@ -import { PrivyProvider } from "@privy-io/react-auth"; -import { RouterProvider, createRouter } from "@tanstack/react-router"; +import { PrivyProvider } from '@privy-io/react-auth'; +import { RouterProvider, createRouter } from '@tanstack/react-router'; -import { routeTree } from "./routeTree.gen"; +import { routeTree } from './routeTree.gen'; // Create a new router instance const router = createRouter({ routeTree }); // Register the router instance for type safety -declare module "@tanstack/react-router" { +declare module '@tanstack/react-router' { interface Register { router: typeof router; } @@ -19,11 +19,11 @@ export function Boot() { appId="cm1gt9i1b002g12ih6b6l4vvi" config={{ // Display email and wallet as login methods - loginMethods: ["wallet"], + loginMethods: ['wallet'], // Customize Privy's appearance in your app appearance: { - theme: "light", - accentColor: "#676FFF", + theme: 'light', + accentColor: '#676FFF', }, // Create embedded wallets for users who don't have a wallet // embeddedWallets: { diff --git a/apps/events/src/components/add-event.tsx b/apps/events/src/components/add-event.tsx index 035e7c8c..0aea1963 100644 --- a/apps/events/src/components/add-event.tsx +++ b/apps/events/src/components/add-event.tsx @@ -1,38 +1,38 @@ -import React from "react"; -import { useCreateEntity } from "../schema"; -import { Button } from "./ui/button"; -import { Input } from "./ui/input"; +import React from 'react'; +import { useCreateEntity } from '../schema'; +import { Button } from './ui/button'; +import { Input } from './ui/input'; export const AddEvent: React.FC = () => { - const [newEventName, setNewEventName] = React.useState(""); + const [newEventName, setNewEventName] = React.useState(''); const createEntity = useCreateEntity(); return (
{ event.preventDefault(); - createEntity(["Event"], { + createEntity(['Event'], { name: newEventName, author: { - name: "Tim", + name: 'Tim', age: 30, - email: "tim@example.com", - badge: { name: "VIP" }, + email: 'tim@example.com', + badge: { name: 'VIP' }, }, participants: [ { - name: "Alice", + name: 'Alice', age: 30, - badge: { name: "Speaker" }, + badge: { name: 'Speaker' }, }, { - name: "Bob", + name: 'Bob', age: 25, - badge: { name: "Attendee" }, + badge: { name: 'Attendee' }, }, ], }); - setNewEventName(""); + setNewEventName(''); }} className="flex space-x-4" > diff --git a/apps/events/src/components/add-user.tsx b/apps/events/src/components/add-user.tsx index 38883ee6..1d47b8d9 100644 --- a/apps/events/src/components/add-user.tsx +++ b/apps/events/src/components/add-user.tsx @@ -1,22 +1,22 @@ -import React from "react"; -import { useCreateEntity } from "../schema"; -import { Button } from "./ui/button"; -import { Input } from "./ui/input"; +import React from 'react'; +import { useCreateEntity } from '../schema'; +import { Button } from './ui/button'; +import { Input } from './ui/input'; export const AddUser: React.FC = () => { - const [newUserName, setNewUserName] = React.useState(""); + const [newUserName, setNewUserName] = React.useState(''); const createEntity = useCreateEntity(); return ( { event.preventDefault(); - createEntity(["User", "Person"], { + createEntity(['User', 'Person'], { name: newUserName, age: 30, - email: "example@example.com", + email: 'example@example.com', }); - setNewUserName(""); + setNewUserName(''); }} className="flex space-x-4" > diff --git a/apps/events/src/components/events.tsx b/apps/events/src/components/events.tsx index a262b226..69ba1809 100644 --- a/apps/events/src/components/events.tsx +++ b/apps/events/src/components/events.tsx @@ -1,20 +1,14 @@ -import React from "react"; -import { useDeleteEntity, useQuery } from "../schema"; -import { Button } from "./ui/button"; -import { - Card, - CardContent, - CardFooter, - CardHeader, - CardTitle, -} from "./ui/card"; -import { Input } from "./ui/input"; +import type React from 'react'; +import { useDeleteEntity, useQuery } from '../schema'; +import { Button } from './ui/button'; +import { Card, CardContent, CardFooter, CardHeader, CardTitle } from './ui/card'; +import { Input } from './ui/input'; export const Events: React.FC = () => { - const events = useQuery({ types: ["Event"] }); + const events = useQuery({ types: ['Event'] }); const deleteEntity = useDeleteEntity(); - console.log("Rendering Events", events); + console.log('Rendering Events', events); return (
diff --git a/apps/events/src/components/logout.tsx b/apps/events/src/components/logout.tsx index c8454545..dd76cd33 100644 --- a/apps/events/src/components/logout.tsx +++ b/apps/events/src/components/logout.tsx @@ -1,17 +1,17 @@ -import { wipeKeys } from "@/lib/keyStorage"; -import { redirect } from "@tanstack/react-router"; -import { Button } from "./ui/button"; +import { wipeKeys } from '@/lib/keyStorage'; +import { redirect } from '@tanstack/react-router'; +import { Button } from './ui/button'; export function Logout() { const disconnectWallet = () => { - const localStorageSignerAddress = localStorage.getItem("signerAddress"); - localStorage.removeItem("signerAddress"); + const localStorageSignerAddress = localStorage.getItem('signerAddress'); + localStorage.removeItem('signerAddress'); if (!localStorageSignerAddress) { return; } wipeKeys(localStorageSignerAddress); redirect({ - to: "/login", + to: '/login', }); }; diff --git a/apps/events/src/components/space.tsx b/apps/events/src/components/space.tsx index b6aee0d3..44bc5fb8 100644 --- a/apps/events/src/components/space.tsx +++ b/apps/events/src/components/space.tsx @@ -1,9 +1,9 @@ -import React, { useEffect } from "react"; -import { SpaceProvider, createDocumentId } from "../schema"; -import { AddEvent } from "./add-event"; -import { AddUser } from "./add-user"; -import { Events } from "./events"; -import { Users } from "./users"; +import React, { useEffect } from 'react'; +import { SpaceProvider, createDocumentId } from '../schema'; +import { AddEvent } from './add-event'; +import { AddUser } from './add-user'; +import { Events } from './events'; +import { Users } from './users'; export const Space: React.FC = () => { const [id, setId] = React.useState(null); diff --git a/apps/events/src/components/ui/avatar.tsx b/apps/events/src/components/ui/avatar.tsx index 991f56ec..c5f14c9a 100644 --- a/apps/events/src/components/ui/avatar.tsx +++ b/apps/events/src/components/ui/avatar.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" +import * as AvatarPrimitive from '@radix-ui/react-avatar'; +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; const Avatar = React.forwardRef< React.ElementRef, @@ -9,26 +9,19 @@ const Avatar = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -Avatar.displayName = AvatarPrimitive.Root.displayName +)); +Avatar.displayName = AvatarPrimitive.Root.displayName; const AvatarImage = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - -)) -AvatarImage.displayName = AvatarPrimitive.Image.displayName + +)); +AvatarImage.displayName = AvatarPrimitive.Image.displayName; const AvatarFallback = React.forwardRef< React.ElementRef, @@ -36,13 +29,10 @@ const AvatarFallback = React.forwardRef< >(({ className, ...props }, ref) => ( -)) -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName +)); +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; -export { Avatar, AvatarImage, AvatarFallback } +export { Avatar, AvatarImage, AvatarFallback }; diff --git a/apps/events/src/components/ui/button.tsx b/apps/events/src/components/ui/button.tsx index 0a83a724..eee3a843 100644 --- a/apps/events/src/components/ui/button.tsx +++ b/apps/events/src/components/ui/button.tsx @@ -1,37 +1,33 @@ -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; -import * as React from "react"; +import { Slot } from '@radix-ui/react-slot'; +import { type VariantProps, cva } from 'class-variance-authority'; +import * as React from 'react'; -import { cn } from "@/lib/utils"; +import { cn } from '@/lib/utils'; const buttonVariants = cva( - "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', { variants: { variant: { - default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", - destructive: - "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", - outline: - "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground", - secondary: - "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", + default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90', + destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90', + outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground', + secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', }, size: { - default: "h-9 px-4 py-2", - sm: "h-8 rounded-md px-3 text-xs", - lg: "h-10 rounded-md px-8", - icon: "h-9 w-9", + default: 'h-9 px-4 py-2', + sm: 'h-8 rounded-md px-3 text-xs', + lg: 'h-10 rounded-md px-8', + icon: 'h-9 w-9', }, }, defaultVariants: { - variant: "default", - size: "default", + variant: 'default', + size: 'default', }, - } + }, ); export interface ButtonProps @@ -42,17 +38,11 @@ export interface ButtonProps const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; - return ( - - ); - } + const Comp = asChild ? Slot : 'button'; + return ; + }, ); -Button.displayName = "Button"; +Button.displayName = 'Button'; // eslint-disable-next-line react-refresh/only-export-components export { Button, buttonVariants }; diff --git a/apps/events/src/components/ui/card.tsx b/apps/events/src/components/ui/card.tsx index 77e9fb78..fed2899c 100644 --- a/apps/events/src/components/ui/card.tsx +++ b/apps/events/src/components/ui/card.tsx @@ -1,76 +1,43 @@ -import * as React from "react" - -import { cn } from "@/lib/utils" - -const Card = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -Card.displayName = "Card" - -const CardHeader = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -CardHeader.displayName = "CardHeader" - -const CardTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardTitle.displayName = "CardTitle" - -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardDescription.displayName = "CardDescription" - -const CardContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardContent.displayName = "CardContent" - -const CardFooter = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -CardFooter.displayName = "CardFooter" - -export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } +import * as React from 'react'; + +import { cn } from '@/lib/utils'; + +const Card = React.forwardRef>(({ className, ...props }, ref) => ( +
+)); +Card.displayName = 'Card'; + +const CardHeader = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ), +); +CardHeader.displayName = 'CardHeader'; + +const CardTitle = React.forwardRef>( + ({ className, ...props }, ref) => ( +

+ ), +); +CardTitle.displayName = 'CardTitle'; + +const CardDescription = React.forwardRef>( + ({ className, ...props }, ref) => ( +

+ ), +); +CardDescription.displayName = 'CardDescription'; + +const CardContent = React.forwardRef>( + ({ className, ...props }, ref) =>

, +); +CardContent.displayName = 'CardContent'; + +const CardFooter = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ), +); +CardFooter.displayName = 'CardFooter'; + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }; diff --git a/apps/events/src/components/ui/input.tsx b/apps/events/src/components/ui/input.tsx index dc8f928f..7de8ae9e 100644 --- a/apps/events/src/components/ui/input.tsx +++ b/apps/events/src/components/ui/input.tsx @@ -1,26 +1,23 @@ -import * as React from "react"; +import * as React from 'react'; -import { cn } from "@/lib/utils"; +import { cn } from '@/lib/utils'; // eslint-disable-next-line @typescript-eslint/no-empty-object-type -export interface InputProps - extends React.InputHTMLAttributes {} +export interface InputProps extends React.InputHTMLAttributes {} -const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { - return ( - - ); - } -); -Input.displayName = "Input"; +const Input = React.forwardRef(({ className, type, ...props }, ref) => { + return ( + + ); +}); +Input.displayName = 'Input'; export { Input }; diff --git a/apps/events/src/components/user.tsx b/apps/events/src/components/user.tsx index f3e350d6..3fc75f00 100644 --- a/apps/events/src/components/user.tsx +++ b/apps/events/src/components/user.tsx @@ -1,24 +1,22 @@ -import { Avatar, AvatarFallback } from "@/components/ui/avatar"; -import { Card, CardContent } from "@/components/ui/card"; +import { Avatar, AvatarFallback } from '@/components/ui/avatar'; +import { Card, CardContent } from '@/components/ui/card'; interface UserCardProps { name: string; } -export function User({ name = "John Doe" }: UserCardProps) { +export function User({ name = 'John Doe' }: UserCardProps) { const initials = name - .split(" ") + .split(' ') .map((n) => n[0]) - .join("") + .join('') .toUpperCase(); return ( - - {initials} - + {initials}

{name}

diff --git a/apps/events/src/components/users.tsx b/apps/events/src/components/users.tsx index d761461b..c8edd5e7 100644 --- a/apps/events/src/components/users.tsx +++ b/apps/events/src/components/users.tsx @@ -1,11 +1,11 @@ -import React from "react"; -import { useQuery } from "../schema"; -import { User } from "./user"; +import type React from 'react'; +import { useQuery } from '../schema'; +import { User } from './user'; export const Users: React.FC = () => { - const users = useQuery({ types: ["User"] }); + const users = useQuery({ types: ['User'] }); - console.log("Rendering Users", users); + console.log('Rendering Users', users); return (
diff --git a/apps/events/src/index.css b/apps/events/src/index.css index 000e9a86..9adcfd4c 100644 --- a/apps/events/src/index.css +++ b/apps/events/src/index.css @@ -27,7 +27,7 @@ --chart-3: 197 37% 24%; --chart-4: 43 74% 66%; --chart-5: 27 87% 67%; - --radius: 0.5rem + --radius: 0.5rem; } .dark { --background: 0 0% 3.9%; @@ -53,7 +53,7 @@ --chart-2: 160 60% 45%; --chart-3: 30 80% 55%; --chart-4: 280 65% 60%; - --chart-5: 340 75% 55% + --chart-5: 340 75% 55%; } } @layer base { diff --git a/apps/events/src/lib/deserialize.ts b/apps/events/src/lib/deserialize.ts index 5a50270d..9169fbe0 100644 --- a/apps/events/src/lib/deserialize.ts +++ b/apps/events/src/lib/deserialize.ts @@ -1,10 +1,6 @@ export const deserialize = (data: string) => { return JSON.parse(data, (key, value) => { - if ( - typeof value === "object" && - value !== null && - value.type === "Uint8Array" - ) { + if (typeof value === 'object' && value !== null && value.type === 'Uint8Array') { return new Uint8Array(value.data); } return value; diff --git a/apps/events/src/lib/isAuthenticated.ts b/apps/events/src/lib/isAuthenticated.ts index 4511c5e3..c528d2be 100644 --- a/apps/events/src/lib/isAuthenticated.ts +++ b/apps/events/src/lib/isAuthenticated.ts @@ -1,7 +1,7 @@ -import { loadKeys } from "./keyStorage"; +import { loadKeys } from './keyStorage'; export const isAuthenticated = () => { - const localStorageSignerAddress = localStorage.getItem("signerAddress"); + const localStorageSignerAddress = localStorage.getItem('signerAddress'); if (!localStorageSignerAddress) { return false; } diff --git a/apps/events/src/lib/keyStorage.ts b/apps/events/src/lib/keyStorage.ts index 23890ac9..c52ed1db 100644 --- a/apps/events/src/lib/keyStorage.ts +++ b/apps/events/src/lib/keyStorage.ts @@ -1,11 +1,11 @@ -import { bytesToHex, hexToBytes } from "@noble/hashes/utils"; +import { bytesToHex, hexToBytes } from '@noble/hashes/utils'; -export const getEnv = (): "dev" | "production" | "local" => { - return "dev"; +export const getEnv = (): 'dev' | 'production' | 'local' => { + return 'dev'; }; export const buildLocalStorageKey = (walletAddress: string) => - walletAddress ? `xmtp:${getEnv()}:keys:${walletAddress}` : ""; + walletAddress ? `xmtp:${getEnv()}:keys:${walletAddress}` : ''; export const loadKeys = (walletAddress: string): Uint8Array | null => { const accessKey = buildLocalStorageKey(walletAddress); diff --git a/apps/events/src/lib/serialize.ts b/apps/events/src/lib/serialize.ts index dd514aa1..607ec9ad 100644 --- a/apps/events/src/lib/serialize.ts +++ b/apps/events/src/lib/serialize.ts @@ -2,7 +2,7 @@ export const serialize = (data: any) => { return JSON.stringify(data, (key, value) => { if (value instanceof Uint8Array) { - return { type: "Uint8Array", data: Array.from(value) }; + return { type: 'Uint8Array', data: Array.from(value) }; } return value; }); diff --git a/apps/events/src/lib/utils.ts b/apps/events/src/lib/utils.ts index bd0c391d..9ad0df42 100644 --- a/apps/events/src/lib/utils.ts +++ b/apps/events/src/lib/utils.ts @@ -1,6 +1,6 @@ -import { clsx, type ClassValue } from "clsx" -import { twMerge } from "tailwind-merge" +import { type ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)); } diff --git a/apps/events/src/main.test.ts b/apps/events/src/main.test.ts index 87595d44..ee21a943 100644 --- a/apps/events/src/main.test.ts +++ b/apps/events/src/main.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from "vitest"; +import { expect, test } from 'vitest'; -test("hello", () => { - expect("Hello from graph-framework").toBe("Hello from graph-framework"); +test('hello', () => { + expect('Hello from graph-framework').toBe('Hello from graph-framework'); }); diff --git a/apps/events/src/main.tsx b/apps/events/src/main.tsx index d5818f8d..beeb73b2 100644 --- a/apps/events/src/main.tsx +++ b/apps/events/src/main.tsx @@ -1,9 +1,9 @@ -import { createRoot } from "react-dom/client"; -import { Boot } from "./Boot.js"; -import "./index.css"; +import { createRoot } from 'react-dom/client'; +import { Boot } from './Boot.js'; +import './index.css'; -createRoot(document.getElementById("root")!).render( +createRoot(document.getElementById('root')!).render( // - + , // ); diff --git a/apps/events/src/routeTree.gen.ts b/apps/events/src/routeTree.gen.ts index 8eb6ef37..db6d0dab 100644 --- a/apps/events/src/routeTree.gen.ts +++ b/apps/events/src/routeTree.gen.ts @@ -1,5 +1,3 @@ -/* eslint-disable */ - // @ts-nocheck // noinspection JSUnusedGlobalSymbols @@ -8,20 +6,20 @@ // You should NOT make any changes in this file as it will be overwritten. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. -import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute } from '@tanstack/react-router'; // Import Routes -import { Route as rootRoute } from './routes/__root' -import { Route as Schema2Import } from './routes/schema2' -import { Route as PlaygroundImport } from './routes/playground' -import { Route as IndexImport } from './routes/index' -import { Route as SpaceSpaceIdImport } from './routes/space/$spaceId' +import { Route as rootRoute } from './routes/__root'; +import { Route as IndexImport } from './routes/index'; +import { Route as PlaygroundImport } from './routes/playground'; +import { Route as Schema2Import } from './routes/schema2'; +import { Route as SpaceSpaceIdImport } from './routes/space/$spaceId'; // Create Virtual Routes -const Login2LazyImport = createFileRoute('/login2')() -const LoginLazyImport = createFileRoute('/login')() +const Login2LazyImport = createFileRoute('/login2')(); +const LoginLazyImport = createFileRoute('/login')(); // Create/Update Routes @@ -29,152 +27,133 @@ const Login2LazyRoute = Login2LazyImport.update({ id: '/login2', path: '/login2', getParentRoute: () => rootRoute, -} as any).lazy(() => import('./routes/login2.lazy').then((d) => d.Route)) +} as any).lazy(() => import('./routes/login2.lazy').then((d) => d.Route)); const LoginLazyRoute = LoginLazyImport.update({ id: '/login', path: '/login', getParentRoute: () => rootRoute, -} as any).lazy(() => import('./routes/login.lazy').then((d) => d.Route)) +} as any).lazy(() => import('./routes/login.lazy').then((d) => d.Route)); const Schema2Route = Schema2Import.update({ id: '/schema2', path: '/schema2', getParentRoute: () => rootRoute, -} as any) +} as any); const PlaygroundRoute = PlaygroundImport.update({ id: '/playground', path: '/playground', getParentRoute: () => rootRoute, -} as any) +} as any); const IndexRoute = IndexImport.update({ id: '/', path: '/', getParentRoute: () => rootRoute, -} as any) +} as any); const SpaceSpaceIdRoute = SpaceSpaceIdImport.update({ id: '/space/$spaceId', path: '/space/$spaceId', getParentRoute: () => rootRoute, -} as any) +} as any); // Populate the FileRoutesByPath interface declare module '@tanstack/react-router' { interface FileRoutesByPath { '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexImport - parentRoute: typeof rootRoute - } + id: '/'; + path: '/'; + fullPath: '/'; + preLoaderRoute: typeof IndexImport; + parentRoute: typeof rootRoute; + }; '/playground': { - id: '/playground' - path: '/playground' - fullPath: '/playground' - preLoaderRoute: typeof PlaygroundImport - parentRoute: typeof rootRoute - } + id: '/playground'; + path: '/playground'; + fullPath: '/playground'; + preLoaderRoute: typeof PlaygroundImport; + parentRoute: typeof rootRoute; + }; '/schema2': { - id: '/schema2' - path: '/schema2' - fullPath: '/schema2' - preLoaderRoute: typeof Schema2Import - parentRoute: typeof rootRoute - } + id: '/schema2'; + path: '/schema2'; + fullPath: '/schema2'; + preLoaderRoute: typeof Schema2Import; + parentRoute: typeof rootRoute; + }; '/login': { - id: '/login' - path: '/login' - fullPath: '/login' - preLoaderRoute: typeof LoginLazyImport - parentRoute: typeof rootRoute - } + id: '/login'; + path: '/login'; + fullPath: '/login'; + preLoaderRoute: typeof LoginLazyImport; + parentRoute: typeof rootRoute; + }; '/login2': { - id: '/login2' - path: '/login2' - fullPath: '/login2' - preLoaderRoute: typeof Login2LazyImport - parentRoute: typeof rootRoute - } + id: '/login2'; + path: '/login2'; + fullPath: '/login2'; + preLoaderRoute: typeof Login2LazyImport; + parentRoute: typeof rootRoute; + }; '/space/$spaceId': { - id: '/space/$spaceId' - path: '/space/$spaceId' - fullPath: '/space/$spaceId' - preLoaderRoute: typeof SpaceSpaceIdImport - parentRoute: typeof rootRoute - } + id: '/space/$spaceId'; + path: '/space/$spaceId'; + fullPath: '/space/$spaceId'; + preLoaderRoute: typeof SpaceSpaceIdImport; + parentRoute: typeof rootRoute; + }; } } // Create and export the route tree export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/playground': typeof PlaygroundRoute - '/schema2': typeof Schema2Route - '/login': typeof LoginLazyRoute - '/login2': typeof Login2LazyRoute - '/space/$spaceId': typeof SpaceSpaceIdRoute + '/': typeof IndexRoute; + '/playground': typeof PlaygroundRoute; + '/schema2': typeof Schema2Route; + '/login': typeof LoginLazyRoute; + '/login2': typeof Login2LazyRoute; + '/space/$spaceId': typeof SpaceSpaceIdRoute; } export interface FileRoutesByTo { - '/': typeof IndexRoute - '/playground': typeof PlaygroundRoute - '/schema2': typeof Schema2Route - '/login': typeof LoginLazyRoute - '/login2': typeof Login2LazyRoute - '/space/$spaceId': typeof SpaceSpaceIdRoute + '/': typeof IndexRoute; + '/playground': typeof PlaygroundRoute; + '/schema2': typeof Schema2Route; + '/login': typeof LoginLazyRoute; + '/login2': typeof Login2LazyRoute; + '/space/$spaceId': typeof SpaceSpaceIdRoute; } export interface FileRoutesById { - __root__: typeof rootRoute - '/': typeof IndexRoute - '/playground': typeof PlaygroundRoute - '/schema2': typeof Schema2Route - '/login': typeof LoginLazyRoute - '/login2': typeof Login2LazyRoute - '/space/$spaceId': typeof SpaceSpaceIdRoute + __root__: typeof rootRoute; + '/': typeof IndexRoute; + '/playground': typeof PlaygroundRoute; + '/schema2': typeof Schema2Route; + '/login': typeof LoginLazyRoute; + '/login2': typeof Login2LazyRoute; + '/space/$spaceId': typeof SpaceSpaceIdRoute; } export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/playground' - | '/schema2' - | '/login' - | '/login2' - | '/space/$spaceId' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/playground' - | '/schema2' - | '/login' - | '/login2' - | '/space/$spaceId' - id: - | '__root__' - | '/' - | '/playground' - | '/schema2' - | '/login' - | '/login2' - | '/space/$spaceId' - fileRoutesById: FileRoutesById + fileRoutesByFullPath: FileRoutesByFullPath; + fullPaths: '/' | '/playground' | '/schema2' | '/login' | '/login2' | '/space/$spaceId'; + fileRoutesByTo: FileRoutesByTo; + to: '/' | '/playground' | '/schema2' | '/login' | '/login2' | '/space/$spaceId'; + id: '__root__' | '/' | '/playground' | '/schema2' | '/login' | '/login2' | '/space/$spaceId'; + fileRoutesById: FileRoutesById; } export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PlaygroundRoute: typeof PlaygroundRoute - Schema2Route: typeof Schema2Route - LoginLazyRoute: typeof LoginLazyRoute - Login2LazyRoute: typeof Login2LazyRoute - SpaceSpaceIdRoute: typeof SpaceSpaceIdRoute + IndexRoute: typeof IndexRoute; + PlaygroundRoute: typeof PlaygroundRoute; + Schema2Route: typeof Schema2Route; + LoginLazyRoute: typeof LoginLazyRoute; + Login2LazyRoute: typeof Login2LazyRoute; + SpaceSpaceIdRoute: typeof SpaceSpaceIdRoute; } const rootRouteChildren: RootRouteChildren = { @@ -184,11 +163,9 @@ const rootRouteChildren: RootRouteChildren = { LoginLazyRoute: LoginLazyRoute, Login2LazyRoute: Login2LazyRoute, SpaceSpaceIdRoute: SpaceSpaceIdRoute, -} +}; -export const routeTree = rootRoute - ._addFileChildren(rootRouteChildren) - ._addFileTypes() +export const routeTree = rootRoute._addFileChildren(rootRouteChildren)._addFileTypes(); /* ROUTE_MANIFEST_START { diff --git a/apps/events/src/routes/__root.tsx b/apps/events/src/routes/__root.tsx index 1ae1936a..7574744a 100644 --- a/apps/events/src/routes/__root.tsx +++ b/apps/events/src/routes/__root.tsx @@ -1,6 +1,6 @@ -import { createRootRoute, Link, Outlet } from "@tanstack/react-router"; -import { TanStackRouterDevtools } from "@tanstack/router-devtools"; -import { CalendarDays } from "lucide-react"; +import { Link, Outlet, createRootRoute } from '@tanstack/react-router'; +import { TanStackRouterDevtools } from '@tanstack/router-devtools'; +import { CalendarDays } from 'lucide-react'; export const Route = createRootRoute({ component: () => ( @@ -13,22 +13,19 @@ export const Route = createRootRoute({