Continued reformat, switch all relative imports to alias as available

Switch to pure non-expression if in next.config.mjs
This commit is contained in:
2024-12-19 17:00:50 -06:00
parent 35128ec208
commit bc04acda7b
18 changed files with 32 additions and 33 deletions

View File

@@ -6,7 +6,7 @@ import withPlaiceholder from "@plaiceholder/next";
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds. * This is especially useful for Docker builds.
*/ */
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs")); if (!process.env.SKIP_ENV_VALIDATION) await import("./src/env/server.mjs");
/** /**
* *
@@ -38,7 +38,7 @@ const v2_redirects = [
return { return {
source: url, source: url,
destination: `https://undefined.behavio.rs/posts${url.slice( destination: `https://undefined.behavio.rs/posts${url.slice(
nthIndex(url, "/", 4) nthIndex(url, "/", 4),
)}`, )}`,
permanent: false, permanent: false,
}; };

View File

@@ -1,7 +1,7 @@
import type { FunctionComponent, ReactNode } from "react"; import type { FunctionComponent, ReactNode } from "react";
import { Disclosure } from "@headlessui/react"; import { Disclosure } from "@headlessui/react";
import { HiBars3, HiXMark } from "react-icons/hi2"; import { HiBars3, HiXMark } from "react-icons/hi2";
import { classNames } from "../utils/helpers"; import { classNames } from "@/utils/helpers";
import Link from "next/link"; import Link from "next/link";
const navigation: { id: string; name: string; href: string }[] = [ const navigation: { id: string; name: string; href: string }[] = [

View File

@@ -1,13 +1,13 @@
import React, { useRef } from "react"; import React, { useRef } from "react";
import { useOnClickOutside, useToggle } from "usehooks-ts"; import { useOnClickOutside, useToggle } from "usehooks-ts";
import { classNames, isHoverable } from "../utils/helpers"; import { classNames, isHoverable } from "@/utils/helpers";
import DependentImage from "./DependentImage";
import ReactMarkdown from "react-markdown"; import ReactMarkdown from "react-markdown";
import Balancer from "react-wrap-balancer"; import Balancer from "react-wrap-balancer";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { type LinkIcon, LinkIcons } from "../utils/types"; import { type LinkIcon, LinkIcons } from "@/utils/types";
import DependentImage from "@/components/DependentImage";
type ItemCardProps = { type ItemCardProps = {
banner: string; banner: string;
@@ -31,7 +31,7 @@ const ItemCard = ({
const [active, toggleActive, setActive] = useToggle(); const [active, toggleActive, setActive] = useToggle();
const router = useRouter(); const router = useRouter();
// @ts-expect-error Some kind of regression in usehooks-ts causes the useOnClickOutside hook to not accept 'null' types // @ts-expect-error Some kind of regression in usehooks-ts causes the useOnClickOutside hook to not accept 'null' types
useOnClickOutside(itemRef, (event) => { useOnClickOutside(itemRef, (event) => {
if ( if (
mobileButtonRef.current != null && mobileButtonRef.current != null &&

View File

@@ -1,8 +1,8 @@
import { type AppType } from "next/app"; import { type AppType } from "next/app";
import { trpc } from "../utils/trpc"; import { trpc } from "@/utils/trpc";
import "../styles/globals.scss"; import "@/styles/globals.scss";
import { Analytics } from "@vercel/analytics/react"; import { Analytics } from "@vercel/analytics/react";
import { Provider } from "react-wrap-balancer"; import { Provider } from "react-wrap-balancer";
import Head from "next/head"; import Head from "next/head";

View File

@@ -1,8 +1,8 @@
import { readItem, readItems } from "@directus/sdk"; import { readItem, readItems } from "@directus/sdk";
import type { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import { z } from "zod"; import { z } from "zod";
import directus from "../../utils/directus"; import directus from "@/utils/directus";
import { env } from "../../env/server.mjs"; import { env } from "@/env/server.mjs";
async function getURLs( async function getURLs(
type: string, type: string,

View File

@@ -1,8 +1,8 @@
import { createNextApiHandler } from "@trpc/server/adapters/next"; import { createNextApiHandler } from "@trpc/server/adapters/next";
import { env } from "../../../env/server.mjs"; import { env } from "@/env/server.mjs";
import { createContext } from "../../../server/trpc/context"; import { createContext } from "@/server/trpc/context";
import { appRouter } from "../../../server/trpc/router/_app"; import { appRouter } from "@/server/trpc/router/_app";
// export API handler // export API handler
export default createNextApiHandler({ export default createNextApiHandler({

View File

@@ -1,5 +1,5 @@
import { type NextPage } from "next"; import { type NextPage } from "next";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import { BsDiscord, BsGithub } from "react-icons/bs"; import { BsDiscord, BsGithub } from "react-icons/bs";
import { AiFillMail } from "react-icons/ai"; import { AiFillMail } from "react-icons/ai";
import Link from "next/link"; import Link from "next/link";

View File

@@ -4,7 +4,7 @@ import Image from "next/image";
import { BsGithub } from "react-icons/bs"; import { BsGithub } from "react-icons/bs";
import { RxOpenInNewWindow } from "react-icons/rx"; import { RxOpenInNewWindow } from "react-icons/rx";
import Link from "next/link"; import Link from "next/link";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
type Screenshot = [string, null | string | ReactNode]; type Screenshot = [string, null | string | ReactNode];

View File

@@ -4,11 +4,11 @@ import Head from "next/head";
import Link from "next/link"; import Link from "next/link";
import { useEffect } from "react"; import { useEffect } from "react";
import Balancer from "react-wrap-balancer"; import Balancer from "react-wrap-balancer";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import ItemCard from "../components/ItemCard"; import ItemCard from "@/components/ItemCard";
import directus from "../utils/directus"; import directus from "@/utils/directus";
import { useBreakpointValue } from "../utils/helpers"; import { useBreakpointValue } from "@/utils/helpers";
import type { Project } from "../utils/types"; import type { Project } from "@/utils/types";
type IndexProps = { type IndexProps = {
tagline: string; tagline: string;

View File

@@ -1,6 +1,6 @@
import { type NextPage } from "next"; import { type NextPage } from "next";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import WorkInProgress from "../components/WorkInProgress"; import WorkInProgress from "@/components/WorkInProgress";
const PathsPage: NextPage = () => { const PathsPage: NextPage = () => {
return ( return (

View File

@@ -3,7 +3,7 @@ import Head from "next/head";
import Image from "next/image"; import Image from "next/image";
import { BsGithub } from "react-icons/bs"; import { BsGithub } from "react-icons/bs";
import Link from "next/link"; import Link from "next/link";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
const PhototagPage: NextPage = () => { const PhototagPage: NextPage = () => {
return ( return (

View File

@@ -3,7 +3,7 @@ import Head from "next/head";
import Image from "next/image"; import Image from "next/image";
import { BsGithub } from "react-icons/bs"; import { BsGithub } from "react-icons/bs";
import Link from "next/link"; import Link from "next/link";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
const images: [string, string | ReactNode][] = [ const images: [string, string | ReactNode][] = [

View File

@@ -1,5 +1,5 @@
import { type NextPage } from "next"; import { type NextPage } from "next";
import AppWrapper from "../components/AppWrapper"; import AppWrapper from "@/components/AppWrapper";
import { RiMagicLine } from "react-icons/ri"; import { RiMagicLine } from "react-icons/ri";
import { BiBus, BiHash, BiNetworkChart } from "react-icons/bi"; import { BiBus, BiHash, BiNetworkChart } from "react-icons/bi";
import Link from "next/link"; import Link from "next/link";

View File

@@ -1,5 +1,5 @@
import { router } from "../trpc"; import { exampleRouter } from "@/server/trpc/router/example";
import { exampleRouter } from "./example"; import { router } from "@/server/trpc/trpc";
export const appRouter = router({ export const appRouter = router({
example: exampleRouter, example: exampleRouter,

View File

@@ -1,6 +1,6 @@
import { z } from "zod"; import { z } from "zod";
import { router, publicProcedure } from "../trpc"; import { router, publicProcedure } from "@/server/trpc/trpc";
export const exampleRouter = router({ export const exampleRouter = router({
hello: publicProcedure hello: publicProcedure

View File

@@ -1,8 +1,7 @@
import { Context } from "@/server/trpc/context";
import { initTRPC } from "@trpc/server"; import { initTRPC } from "@trpc/server";
import superjson from "superjson"; import superjson from "superjson";
import { type Context } from "./context";
const t = initTRPC.context<Context>().create({ const t = initTRPC.context<Context>().create({
transformer: superjson, transformer: superjson,
errorFormatter({ shape }) { errorFormatter({ shape }) {

View File

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */
import create from "@kodingdotninja/use-tailwind-breakpoint"; import create from "@kodingdotninja/use-tailwind-breakpoint";
import resolveConfig from "tailwindcss/resolveConfig"; import resolveConfig from "tailwindcss/resolveConfig";
import tailwindConfig from "./../../tailwind.config.cjs"; import tailwindConfig from "@/../tailwind.config.cjs";
export function classNames(...classes: (string | null | undefined)[]) { export function classNames(...classes: (string | null | undefined)[]) {
return classes.filter(Boolean).join(" "); return classes.filter(Boolean).join(" ");

View File

@@ -3,7 +3,7 @@ import { createTRPCNext } from "@trpc/next";
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server"; import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
import superjson from "superjson"; import superjson from "superjson";
import { type AppRouter } from "../server/trpc/router/_app"; import { type AppRouter } from "@/server/trpc/router/_app";
const getBaseUrl = () => { const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url if (typeof window !== "undefined") return ""; // browser should use relative url