Fix lint issues 4e72eae4
Maximilian Leodolter · 2025-08-04 12:46 15 file(s) · +72 −37
src/installers/rpc.ts +2 −8
4 4
import fs from "fs-extra";
5 5
import pc from "picocolors";
6 6
import yoctoSpinner from "yocto-spinner";
7 -
import {
8 -
	defaultTemplate,
9 -
	honoClientTemplate,
10 -
	honoRpcTemplate,
11 -
	shadcnTemplate,
12 -
	tailwindTemplate,
13 -
} from "@/utils/templates";
14 -
import { ProjectOptions } from "@/types";
7 +
import { honoClientTemplate, honoRpcTemplate } from "@/utils/templates";
8 +
import type { ProjectOptions } from "@/types";
15 9
import { EXTRAS_DIR } from "@/utils";
16 10
17 11
export async function rpcInstaller(
src/installers/tanstack-query.ts +1 −1
1 -
import path from "path";
1 +
import path from "node:path";
2 2
import fs from "fs-extra";
3 3
import type { ProjectOptions } from "@/types";
4 4
import yoctoSpinner from "yocto-spinner";
src/lib/create-project.ts +1 −1
24 24
		return null;
25 25
	}
26 26
27 -
	const packagesInstalled = await installPackages(projectOptions);
27 +
	await installPackages(projectOptions);
28 28
29 29
	const gitInitialized = await initializeGit(
30 30
		projectOptions.projectName ?? projectDirectory,
src/lib/install-packages.ts +1 −2
7 7
export async function installPackages(
8 8
	options: Required<ProjectOptions>,
9 9
): Promise<boolean> {
10 -
	const { projectName, template, repo, branch, rpc, linter, tanstackQuery } =
11 -
		options;
10 +
	const { projectName, rpc, linter, tanstackQuery } = options;
12 11
13 12
	const projectPath = path.resolve(process.cwd(), projectName);
14 13
src/lib/scaffold-template.ts +1 −3
6 6
import type { ProjectOptions } from "@/types";
7 7
import { DEFAULT_REPO } from "@/utils/constants";
8 8
import { TEMPLATES } from "@/utils/templates";
9 -
import { patchFilesForRPC } from "./patch-files-rpc";
10 -
import { setupBiome } from "./setup-biome";
11 9
12 10
export async function scaffoldTemplate(
13 11
	options: Required<ProjectOptions>,
14 12
): Promise<boolean> {
15 -
	const { projectName, template, repo, branch, rpc, linter } = options;
13 +
	const { projectName, template, repo, branch } = options;
16 14
17 15
	const projectPath = path.resolve(process.cwd(), projectName);
18 16
src/templates/extras/client/src/App.tsx/App-with-rpc-tanstackquery.tsx +14 −3
34 34
	return (
35 35
		<>
36 36
			<div>
37 -
				<a href="https://github.com/stevedylandev/bhvr" target="_blank">
37 +
				<a
38 +
					href="https://github.com/stevedylandev/bhvr"
39 +
					target="_blank"
40 +
					rel="noopener"
41 +
				>
38 42
					<img src={beaver} className="logo" alt="beaver logo" />
39 43
				</a>
40 44
			</div>
43 47
			<p>A typesafe fullstack monorepo</p>
44 48
			<div className="card">
45 49
				<div className="button-container">
46 -
					<button onClick={() => sendRequest()}>Call API</button>
47 -
					<a className="docs-link" target="_blank" href="https://bhvr.dev">
50 +
					<button type="button" onClick={() => sendRequest()}>
51 +
						Call API
52 +
					</button>
53 +
					<a
54 +
						className="docs-link"
55 +
						target="_blank"
56 +
						href="https://bhvr.dev"
57 +
						rel="noopener"
58 +
					>
48 59
						Docs
49 60
					</a>
50 61
				</div>
src/templates/extras/client/src/App.tsx/App-with-rpc.tsx +14 −3
31 31
	return (
32 32
		<>
33 33
			<div>
34 -
				<a href="https://github.com/stevedylandev/bhvr" target="_blank">
34 +
				<a
35 +
					href="https://github.com/stevedylandev/bhvr"
36 +
					target="_blank"
37 +
					rel="noopener"
38 +
				>
35 39
					<img src={beaver} className="logo" alt="beaver logo" />
36 40
				</a>
37 41
			</div>
40 44
			<p>A typesafe fullstack monorepo</p>
41 45
			<div className="card">
42 46
				<div className="button-container">
43 -
					<button onClick={sendRequest}>Call API</button>
44 -
					<a className="docs-link" target="_blank" href="https://bhvr.dev">
47 +
					<button type="button" onClick={sendRequest}>
48 +
						Call API
49 +
					</button>
50 +
					<a
51 +
						className="docs-link"
52 +
						target="_blank"
53 +
						href="https://bhvr.dev"
54 +
						rel="noopener"
55 +
					>
45 56
						Docs
46 57
					</a>
47 58
				</div>
src/templates/extras/client/src/App.tsx/App-with-tailwind-rpc-tanstackquery.tsx +7 −1
32 32
33 33
	return (
34 34
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
35 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
35 +
			<a
36 +
				href="https://github.com/stevedylandev/bhvr"
37 +
				target="_blank"
38 +
				rel="noopener"
39 +
			>
36 40
				<img
37 41
					src={beaver}
38 42
					className="w-16 h-16 cursor-pointer"
44 48
			<p>A typesafe fullstack monorepo</p>
45 49
			<div className="flex items-center gap-4">
46 50
				<button
51 +
					type="button"
47 52
					onClick={() => sendRequest()}
48 53
					className="bg-black text-white px-2.5 py-1.5 rounded-md"
49 54
				>
53 58
					target="_blank"
54 59
					href="https://bhvr.dev"
55 60
					className="border-1 border-black text-black px-2.5 py-1.5 rounded-md"
61 +
					rel="noopener"
56 62
				>
57 63
					Docs
58 64
				</a>
src/templates/extras/client/src/App.tsx/App-with-tailwind-rpc.tsx +7 −1
29 29
30 30
	return (
31 31
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
32 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
32 +
			<a
33 +
				href="https://github.com/stevedylandev/bhvr"
34 +
				target="_blank"
35 +
				rel="noopener"
36 +
			>
33 37
				<img
34 38
					src={beaver}
35 39
					className="w-16 h-16 cursor-pointer"
41 45
			<p>A typesafe fullstack monorepo</p>
42 46
			<div className="flex items-center gap-4">
43 47
				<button
48 +
					type="button"
44 49
					onClick={sendRequest}
45 50
					className="bg-black text-white px-2.5 py-1.5 rounded-md"
46 51
				>
50 55
					target="_blank"
51 56
					href="https://bhvr.dev"
52 57
					className="border-1 border-black text-black px-2.5 py-1.5 rounded-md"
58 +
					rel="noopener"
53 59
				>
54 60
					Docs
55 61
				</a>
src/templates/extras/client/src/App.tsx/App-with-tailwind-shadcn-rpc-tanstackquery.tsx +2 −2
33 33
34 34
	return (
35 35
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
36 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
36 +
			<a href="https://github.com/stevedylandev/bhvr" target="_blank" rel="noopener">
37 37
				<img
38 38
					src={beaver}
39 39
					className="w-16 h-16 cursor-pointer"
46 46
			<div className="flex items-center gap-4">
47 47
				<Button onClick={() => sendRequest()}>Call API</Button>
48 48
				<Button variant="secondary" asChild>
49 -
					<a target="_blank" href="https://bhvr.dev">
49 +
					<a target="_blank" href="https://bhvr.dev" rel="noopener">
50 50
						Docs
51 51
					</a>
52 52
				</Button>
src/templates/extras/client/src/App.tsx/App-with-tailwind-shadcn-rpc.tsx +2 −2
30 30
31 31
	return (
32 32
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
33 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
33 +
			<a href="https://github.com/stevedylandev/bhvr" target="_blank" rel="noopener">
34 34
				<img
35 35
					src={beaver}
36 36
					className="w-16 h-16 cursor-pointer"
43 43
			<div className="flex items-center gap-4">
44 44
				<Button onClick={sendRequest}>Call API</Button>
45 45
				<Button variant="secondary" asChild>
46 -
					<a target="_blank" href="https://bhvr.dev">
46 +
					<a target="_blank" href="https://bhvr.dev" rel="noopener">
47 47
						Docs
48 48
					</a>
49 49
				</Button>
src/templates/extras/client/src/App.tsx/App-with-tailwind-shadcn-tanstackquery.tsx +3 −3
1 1
import { useState } from "react";
2 2
import beaver from "./assets/beaver.svg";
3 -
import { ApiResponse } from "shared";
3 +
import type { ApiResponse } from "shared";
4 4
import { Button } from "./components/ui/button";
5 5
import { useMutation } from "@tanstack/react-query";
6 6
23 23
24 24
	return (
25 25
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
26 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
26 +
			<a href="https://github.com/stevedylandev/bhvr" target="_blank" rel="noopener">
27 27
				<img
28 28
					src={beaver}
29 29
					className="w-16 h-16 cursor-pointer"
36 36
			<div className="flex items-center gap-4">
37 37
				<Button onClick={() => sendRequest()}>Call API</Button>
38 38
				<Button variant="secondary" asChild>
39 -
					<a target="_blank" href="https://bhvr.dev">
39 +
					<a target="_blank" href="https://bhvr.dev" rel="noopener">
40 40
						Docs
41 41
					</a>
42 42
				</Button>
src/templates/extras/client/src/App.tsx/App-with-tailwind-tanstackquery.tsx +8 −2
1 1
import { useState } from "react";
2 2
import beaver from "./assets/beaver.svg";
3 -
import { ApiResponse } from "shared";
3 +
import type { ApiResponse } from "shared";
4 4
import { useMutation } from "@tanstack/react-query";
5 5
6 6
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000";
22 22
23 23
	return (
24 24
		<div className="max-w-xl mx-auto flex flex-col gap-6 items-center justify-center min-h-screen">
25 -
			<a href="https://github.com/stevedylandev/bhvr" target="_blank">
25 +
			<a
26 +
				href="https://github.com/stevedylandev/bhvr"
27 +
				target="_blank"
28 +
				rel="noopener"
29 +
			>
26 30
				<img
27 31
					src={beaver}
28 32
					className="w-16 h-16 cursor-pointer"
34 38
			<p>A typesafe fullstack monorepo</p>
35 39
			<div className="flex items-center gap-4">
36 40
				<button
41 +
					type="button"
37 42
					onClick={() => sendRequest()}
38 43
					className="bg-black text-white px-2.5 py-1.5 rounded-md"
39 44
				>
43 48
					target="_blank"
44 49
					href="https://bhvr.dev"
45 50
					className="border-1 border-black text-black px-2.5 py-1.5 rounded-md"
51 +
					rel="noopener"
46 52
				>
47 53
					Docs
48 54
				</a>
src/templates/extras/client/src/main.tsx/main-with-tanstackquery.tsx +8 −1
6 6
7 7
const queryClient = new QueryClient();
8 8
9 -
createRoot(document.getElementById("root")!).render(
9 +
const rootElement = document.getElementById("root");
10 +
11 +
if (!rootElement) {
12 +
	throw new Error(
13 +
		"Root element not found. Check if it's in your index.html or if the id is correct.",
14 +
	);
15 +
}
16 +
createRoot(rootElement).render(
10 17
	<StrictMode>
11 18
		<QueryClientProvider client={queryClient}>
12 19
			<App />
src/utils/add-package-dependency.ts +1 −4
1 -
import path from "path";
2 -
import fs from "fs-extra";
3 -
import sortPackageJson from "sort-package-json";
4 -
import { type PackageJson } from "type-fest";
1 +
import path from "node:path";
5 2
import { execa } from "execa";
6 3
7 4
export const addPackageDependency = async (opts: {