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.
* 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 {
source: url,
destination: `https://undefined.behavio.rs/posts${url.slice(
nthIndex(url, "/", 4)
nthIndex(url, "/", 4),
)}`,
permanent: false,
};

View File

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

View File

@@ -1,13 +1,13 @@
import React, { useRef } from "react";
import { useOnClickOutside, useToggle } from "usehooks-ts";
import { classNames, isHoverable } from "../utils/helpers";
import DependentImage from "./DependentImage";
import { classNames, isHoverable } from "@/utils/helpers";
import ReactMarkdown from "react-markdown";
import Balancer from "react-wrap-balancer";
import Link from "next/link";
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 = {
banner: string;
@@ -31,7 +31,7 @@ const ItemCard = ({
const [active, toggleActive, setActive] = useToggle();
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) => {
if (
mobileButtonRef.current != null &&

View File

@@ -1,8 +1,8 @@
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 { Provider } from "react-wrap-balancer";
import Head from "next/head";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import create from "@kodingdotninja/use-tailwind-breakpoint";
import resolveConfig from "tailwindcss/resolveConfig";
import tailwindConfig from "./../../tailwind.config.cjs";
import tailwindConfig from "@/../tailwind.config.cjs";
export function classNames(...classes: (string | null | undefined)[]) {
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 superjson from "superjson";
import { type AppRouter } from "../server/trpc/router/_app";
import { type AppRouter } from "@/server/trpc/router/_app";
const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url