🎨 Add linting and prettier to more places

This commit is contained in:
Luke Vella 2024-11-09 14:37:13 +00:00
parent de6963db4f
commit 77c6c36e3d
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
36 changed files with 65 additions and 78 deletions

View file

@ -1,6 +1,6 @@
import { supportedLngs } from "@rallly/languages";
import languageParser from "accept-language-parser";
import type { NextRequest} from "next/server";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
export async function getLocaleFromHeader(req: NextRequest) {

View file

@ -3,7 +3,7 @@ import type { TimeFormat } from "@rallly/database";
import { extend } from "lodash";
import type { DefaultSession, DefaultUser } from "next-auth";
import NextAuth from "next-auth";
import type { DefaultJWT} from "next-auth/jwt";
import type { DefaultJWT } from "next-auth/jwt";
import { JWT } from "next-auth/jwt";
declare module "next-auth" {

View file

@ -16,5 +16,4 @@ Sentry.init({
// Uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
});

View file

@ -1,8 +1,7 @@
"use client";
import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import type {
DialogProps} from "@rallly/ui/dialog";
import type { DialogProps } from "@rallly/ui/dialog";
import {
Dialog,
DialogClose,

View file

@ -1,8 +1,7 @@
"use client";
import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import type {
DialogProps} from "@rallly/ui/dialog";
import type { DialogProps } from "@rallly/ui/dialog";
import {
Dialog,
DialogClose,

View file

@ -13,11 +13,8 @@ import Link from "next/link";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import type {
PollDetailsData} from "@/components/forms/poll-details-form";
import {
PollDetailsForm,
} from "@/components/forms/poll-details-form";
import type { PollDetailsData } from "@/components/forms/poll-details-form";
import { PollDetailsForm } from "@/components/forms/poll-details-form";
import { useUpdatePollMutation } from "@/components/poll/mutations";
import { usePoll } from "@/components/poll-context";
import { Trans } from "@/components/trans";

View file

@ -6,11 +6,8 @@ import Link from "next/link";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import type {
PollSettingsFormData} from "@/components/forms/poll-settings";
import {
PollSettingsForm
} from "@/components/forms/poll-settings";
import type { PollSettingsFormData } from "@/components/forms/poll-settings";
import { PollSettingsForm } from "@/components/forms/poll-settings";
import { useUpdatePollMutation } from "@/components/poll/mutations";
import { Trans } from "@/components/trans";
import { usePoll } from "@/contexts/poll";

View file

@ -1,4 +1,4 @@
import type { NextRequest} from "next/server";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { resetUser } from "@/app/guest";

View file

@ -1,5 +1,5 @@
import { GetObjectCommand } from "@aws-sdk/client-s3";
import type { NextRequest} from "next/server";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { env } from "@/env";

View file

@ -4,7 +4,11 @@ import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
import { useEffect } from "react";
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
}) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
@ -20,4 +24,4 @@ export default function GlobalError({ error }: { error: Error & { digest?: strin
</body>
</html>
);
}
}

View file

@ -9,15 +9,8 @@ import {
DropdownMenuTrigger,
} from "@rallly/ui/dropdown-menu";
import { Icon } from "@rallly/ui/icon";
import type {
CalendarEvent} from "calendar-link";
import {
google,
ics,
office365,
outlook,
yahoo,
} from "calendar-link";
import type { CalendarEvent } from "calendar-link";
import { google, ics, office365, outlook, yahoo } from "calendar-link";
import { DownloadIcon, PlusIcon } from "lucide-react";
import Image from "next/image";

View file

@ -21,7 +21,7 @@ import { useUser } from "@/components/user-provider";
import { trpc } from "@/trpc/client";
import { setCookie } from "@/utils/cookies";
import type { NewEventData} from "./forms";
import type { NewEventData } from "./forms";
import { PollDetailsForm, PollOptionsForm } from "./forms";
const required = <T,>(v: T | undefined): T => {

View file

@ -31,7 +31,7 @@ import { Input } from "@rallly/ui/input";
import { PencilIcon, TagIcon, TrashIcon } from "lucide-react";
import { useTranslation } from "next-i18next";
import React from "react";
import type { SubmitHandler} from "react-hook-form";
import type { SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { useMount } from "react-use";
import { z } from "zod";

View file

@ -2,13 +2,8 @@
import { pricingData } from "@rallly/billing/pricing";
import { Badge } from "@rallly/ui/badge";
import type {
DialogProps} from "@rallly/ui/dialog";
import {
Dialog,
DialogContent,
useDialog,
} from "@rallly/ui/dialog";
import type { DialogProps } from "@rallly/ui/dialog";
import { Dialog, DialogContent, useDialog } from "@rallly/ui/dialog";
import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group";
import { m } from "framer-motion";
import { CheckIcon } from "lucide-react";

View file

@ -8,10 +8,9 @@ import React from "react";
import type { GetPollApiResponse, Vote } from "@/trpc/client/types";
import type {
ParsedDateOption,
ParsedTimeSlotOption} from "@/utils/date-time-utils";
import {
getDuration
ParsedTimeSlotOption,
} from "@/utils/date-time-utils";
import { getDuration } from "@/utils/date-time-utils";
import { useDayjs } from "@/utils/dayjs";
import ErrorPage from "./error-page";

View file

@ -1,7 +1,6 @@
import { cn } from "@rallly/ui";
import { Button } from "@rallly/ui/button";
import type {
DialogProps} from "@rallly/ui/dialog";
import type { DialogProps } from "@rallly/ui/dialog";
import {
Dialog,
DialogClose,

View file

@ -1,4 +1,4 @@
import type { Page} from "@playwright/test";
import type { Page } from "@playwright/test";
import { expect, test } from "@playwright/test";
import type { MailServer } from "smtp-tester";
import smtpTester from "smtp-tester";

View file

@ -1,4 +1,4 @@
import type { Page} from "@playwright/test";
import type { Page } from "@playwright/test";
import { expect, test } from "@playwright/test";
import type { MailServer } from "smtp-tester";
import smtpTester from "smtp-tester";

View file

@ -1,4 +1,2 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};
module.exports = require("@rallly/eslint-config/preset")(__dirname);

View file

@ -10,7 +10,9 @@
},
"scripts": {
"normalize-subscription-metadata": "dotenv -e ../../.env -- tsx ./src/scripts/normalize-metadata.ts",
"type-check": "tsc --pretty --noEmit"
"type-check": "tsc --pretty --noEmit",
"prettier": "prettier --write .",
"lint": "eslint ./src"
},
"dependencies": {
"@radix-ui/react-radio-group": "^1.2.0",

View file

@ -8,7 +8,8 @@
"db:deploy": "prisma migrate deploy",
"db:migrate": "prisma migrate dev",
"db:seed": "tsx prisma/seed.ts",
"type-check": "tsc --pretty --noEmit"
"type-check": "tsc --pretty --noEmit",
"prettier": "prettier --write ."
},
"exports": "./index.ts",
"devDependencies": {

View file

@ -1,4 +1,2 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config/preset")(__dirname),
};
module.exports = require("@rallly/eslint-config/preset")(__dirname);

View file

@ -6,6 +6,7 @@
"dev": "email dev --port 3333 --dir ./src/previews",
"lint": "eslint ./src",
"type-check": "tsc --pretty --noEmit",
"prettier": "prettier --write .",
"i18n:scan": "i18next-scanner --config i18next-scanner.config.js"
},
"exports": {

View file

@ -1,13 +1,14 @@
import type {
LinkProps,
SectionProps,
TextProps} from "@react-email/components";
TextProps,
} from "@react-email/components";
import {
Button as UnstyledButton,
Heading as UnstyledHeading,
Link as UnstyledLink,
Section as UnstyledSection,
Text as UnstyledText
Text as UnstyledText,
} from "@react-email/components";
import type { EmailContext } from "../types";

View file

@ -1,8 +1,6 @@
import { Trans } from "react-i18next/TransWithoutContext";
import type {
NotificationBaseProps,
} from "../components/notification-email";
import type { NotificationBaseProps } from "../components/notification-email";
import NotificationEmail from "../components/notification-email";
import { Heading, Text } from "../components/styled-components";
import type { EmailContext } from "../types";

View file

@ -7,6 +7,11 @@
"./client": "./src/client/index.ts",
"./next/middleware": "./src/next/middleware.ts"
},
"scripts": {
"lint": "eslint ./src",
"type-check": "tsc --noEmit",
"prettier": "prettier --write ."
},
"dependencies": {
"posthog-js": "^1.178.0",
"posthog-node": "^4.2.1"

View file

@ -1,4 +1,5 @@
import { NextResponse } from "next/server";
import type { NextResponse } from "next/server";
import { POSTHOG_BOOTSTAP_DATA_COOKIE_NAME } from "../constants";
const posthogApiKey = process.env.NEXT_PUBLIC_POSTHOG_API_KEY;

View file

@ -7,7 +7,8 @@
"scripts": {
"ui:add": "npx shadcn-ui@latest add",
"lint": "eslint .",
"type-check": "tsc --noEmit"
"type-check": "tsc --noEmit",
"prettier": "prettier --write ."
},
"exports": {
".": "./src/lib/utils.ts",

View file

@ -81,4 +81,4 @@ const AvatarFallback = React.forwardRef<
});
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
export { Avatar, AvatarFallback,AvatarImage };
export { Avatar, AvatarFallback, AvatarImage };

View file

@ -1,9 +1,12 @@
import { Slot } from "@radix-ui/react-slot";
import type {VariantProps } from "class-variance-authority";
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";
import type { ComponentPropsWithout, RemovedProps } from "./helpers/component-props";
import type {
ComponentPropsWithout,
RemovedProps,
} from "./helpers/component-props";
import { cn } from "./lib/utils";
type FlexElement = React.ElementRef<"div">;

View file

@ -1,15 +1,8 @@
import type * as LabelPrimitive from "@radix-ui/react-label";
import { Slot } from "@radix-ui/react-slot";
import * as React from "react";
import type {
ControllerProps,
FieldPath,
FieldValues} from "react-hook-form";
import {
Controller,
FormProvider,
useFormContext,
} from "react-hook-form";
import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
import { Controller, FormProvider, useFormContext } from "react-hook-form";
import { Label } from "./label";
import { cn } from "./lib/utils";

View file

@ -186,4 +186,4 @@ function useToast() {
};
}
export { toast,useToast };
export { toast, useToast };

View file

@ -1,6 +1,6 @@
"use client";
import { Slot } from "@radix-ui/react-slot";
import type {VariantProps } from "class-variance-authority";
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import { cn } from "./lib/utils";

View file

@ -1,5 +1,5 @@
import * as ToastPrimitives from "@radix-ui/react-toast";
import { type VariantProps,cva } from "class-variance-authority";
import { type VariantProps, cva } from "class-variance-authority";
import { X } from "lucide-react";
import * as React from "react";

View file

@ -0,0 +1,2 @@
/** @type {import("eslint").Linter.Config} */
module.exports = require("@rallly/eslint-config/preset")(__dirname);

View file

@ -1,10 +1,12 @@
{
"name": "@rallly/utils",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
"test:unit": "vitest run"
"test:unit": "vitest run",
"prettier": "prettier --write .",
"lint": "eslint ./src",
"type-check": "tsc --noEmit"
},
"exports": {
"./*": "./src/*.ts"