Skip to content

Commit 0bfb3cf

Browse files
chore(cli): remove all explicit return types (#573)
1 parent 2b97093 commit 0bfb3cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+113
-157
lines changed

.cursor/rules/better-t-stack-repo.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ alwaysApply: true
77
- Do not include emojis.
88
- Use TypeScript type aliases instead of interface declarations.
99
- In Handlebars templates, avoid generic if/else blocks. Write explicit conditions, such as: use if (eq orm "prisma") for Prisma, and else if (eq orm "drizzle") for Drizzle.
10+
- Do not use explicit return types

apps/cli/src/constants.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from "node:path";
22
import { fileURLToPath } from "node:url";
3-
import type { Addons, Frontend, ProjectConfig } from "./types";
43
import { getUserPkgManager } from "./utils/get-package-manager";
54

65
const __filename = fileURLToPath(import.meta.url);
@@ -26,7 +25,7 @@ export const DEFAULT_CONFIG_BASE = {
2625
serverDeploy: "none",
2726
} as const;
2827

29-
export function getDefaultConfig(): ProjectConfig {
28+
export function getDefaultConfig() {
3029
return {
3130
...DEFAULT_CONFIG_BASE,
3231
projectDir: path.resolve(process.cwd(), DEFAULT_CONFIG_BASE.projectName),
@@ -160,7 +159,7 @@ export const dependencyVersionMap = {
160159

161160
export type AvailableDependencies = keyof typeof dependencyVersionMap;
162161

163-
export const ADDON_COMPATIBILITY: Record<Addons, readonly Frontend[]> = {
162+
export const ADDON_COMPATIBILITY = {
164163
pwa: ["tanstack-router", "react-router", "solid", "next"],
165164
tauri: ["tanstack-router", "react-router", "nuxt", "svelte", "solid", "next"],
166165
biome: [],

apps/cli/src/helpers/addons/addons-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ${pc.cyan("Docs:")} ${pc.underline("https://turborepo.com/docs")}
9595
}
9696
}
9797

98-
function getWebAppDir(projectDir: string, frontends: Frontend[]): string {
98+
function getWebAppDir(projectDir: string, frontends: Frontend[]) {
9999
if (
100100
frontends.some((f) =>
101101
["react-router", "tanstack-router", "nuxt", "svelte", "solid"].includes(

apps/cli/src/helpers/core/auth-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export async function setupAuth(config: ProjectConfig) {
115115
}
116116
}
117117

118-
export function generateAuthSecret(length = 32): string {
118+
export function generateAuthSecret(length = 32) {
119119
const characters =
120120
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
121121
let result = "";

apps/cli/src/helpers/core/command-handlers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
AddInput,
1414
CreateInput,
1515
DirectoryConflict,
16-
InitResult,
1716
ProjectConfig,
1817
} from "../../types";
1918
import { trackProjectCreation } from "../../utils/analytics";
@@ -40,7 +39,7 @@ import { installDependencies } from "./install-dependencies";
4039

4140
export async function createProjectHandler(
4241
input: CreateInput & { projectName?: string },
43-
): Promise<InitResult> {
42+
) {
4443
const startTime = Date.now();
4544
const timeScaffolded = new Date().toISOString();
4645

@@ -58,7 +57,7 @@ export async function createProjectHandler(
5857
currentPathInput = input.projectName;
5958
} else if (input.yes) {
6059
const defaultConfig = getDefaultConfig();
61-
let defaultName = defaultConfig.relativePath;
60+
let defaultName: string = defaultConfig.relativePath;
6261
let counter = 1;
6362
while (
6463
(await fs.pathExists(path.resolve(process.cwd(), defaultName))) &&
@@ -210,7 +209,7 @@ export async function createProjectHandler(
210209
async function handleDirectoryConflictProgrammatically(
211210
currentPathInput: string,
212211
strategy: DirectoryConflict,
213-
): Promise<{ finalPathInput: string; shouldClearDirectory: boolean }> {
212+
) {
214213
const currentPath = path.resolve(process.cwd(), currentPathInput);
215214

216215
if (!(await fs.pathExists(currentPath))) {

apps/cli/src/helpers/core/create-readme.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function createReadme(projectDir: string, options: ProjectConfig) {
2424
}
2525
}
2626

27-
function generateReadmeContent(options: ProjectConfig): string {
27+
function generateReadmeContent(options: ProjectConfig) {
2828
const {
2929
projectName,
3030
packageManager,
@@ -163,7 +163,7 @@ function generateStackDescription(
163163
backend: string,
164164
api: API,
165165
isConvex: boolean,
166-
): string {
166+
) {
167167
const parts: string[] = [];
168168

169169
const hasTanstackRouter = frontend.includes("tanstack-router");
@@ -210,7 +210,7 @@ function generateRunningInstructions(
210210
webPort: string,
211211
hasNative: boolean,
212212
isConvex: boolean,
213-
): string {
213+
) {
214214
const instructions: string[] = [];
215215

216216
const hasFrontendNone = frontend.length === 0 || frontend.includes("none");
@@ -265,7 +265,7 @@ function generateProjectStructure(
265265
isConvex: boolean,
266266
api: API,
267267
auth: Auth,
268-
): string {
268+
) {
269269
const structure: string[] = [`${projectName}/`, "├── apps/"];
270270

271271
const hasFrontendNone = frontend.length === 0 || frontend.includes("none");
@@ -349,7 +349,7 @@ function generateFeaturesList(
349349
frontend: Frontend[],
350350
backend: string,
351351
api: API,
352-
): string {
352+
) {
353353
const isConvex = backend === "convex";
354354
const isBackendNone = backend === "none";
355355
const hasTanstackRouter = frontend.includes("tanstack-router");
@@ -493,7 +493,7 @@ function generateDatabaseSetup(
493493
orm: ORM,
494494
dbSetup: DatabaseSetup,
495495
serverDeploy?: string,
496-
): string {
496+
) {
497497
if (database === "none") {
498498
return "";
499499
}
@@ -591,7 +591,7 @@ function generateScriptsList(
591591
hasNative: boolean,
592592
addons: Addons[],
593593
backend: string,
594-
): string {
594+
) {
595595
const isConvex = backend === "convex";
596596
const isBackendNone = backend === "none";
597597

@@ -657,7 +657,7 @@ function generateDeploymentCommands(
657657
packageManagerRunCmd: string,
658658
webDeploy?: string,
659659
serverDeploy?: string,
660-
): string {
660+
) {
661661
const lines: string[] = [];
662662

663663
if (webDeploy === "alchemy" || serverDeploy === "alchemy") {

apps/cli/src/helpers/core/detect-project-config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import path from "node:path";
22
import fs from "fs-extra";
3-
import type { ProjectConfig } from "../../types";
43
import { readBtsConfig } from "../../utils/bts-config";
54

6-
export async function detectProjectConfig(
7-
projectDir: string,
8-
): Promise<Partial<ProjectConfig> | null> {
5+
export async function detectProjectConfig(projectDir: string) {
96
try {
107
const btsConfig = await readBtsConfig(projectDir);
118
if (btsConfig) {

apps/cli/src/helpers/core/post-installation.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export async function displayPostInstallInstructions(
203203
consola.box(output);
204204
}
205205

206-
function getNativeInstructions(isConvex: boolean): string {
206+
function getNativeInstructions(isConvex: boolean) {
207207
const envVar = isConvex ? "EXPO_PUBLIC_CONVEX_URL" : "EXPO_PUBLIC_SERVER_URL";
208208
const exampleUrl = isConvex
209209
? "https://<YOUR_CONVEX_URL>"
@@ -226,7 +226,7 @@ function getNativeInstructions(isConvex: boolean): string {
226226
return instructions;
227227
}
228228

229-
function getLintingInstructions(runCmd?: string): string {
229+
function getLintingInstructions(runCmd?: string) {
230230
return `${pc.bold("Linting and formatting:")}\n${pc.cyan(
231231
"•",
232232
)} Format and lint fix: ${`${runCmd} check`}\n`;
@@ -239,7 +239,7 @@ async function getDatabaseInstructions(
239239
runtime?: Runtime,
240240
dbSetup?: DatabaseSetup,
241241
serverDeploy?: string,
242-
): Promise<string> {
242+
) {
243243
const instructions: string[] = [];
244244

245245
if (dbSetup === "docker") {
@@ -384,7 +384,7 @@ async function getDatabaseInstructions(
384384
: "";
385385
}
386386

387-
function getTauriInstructions(runCmd?: string): string {
387+
function getTauriInstructions(runCmd?: string) {
388388
return `\n${pc.bold("Desktop app with Tauri:")}\n${pc.cyan(
389389
"•",
390390
)} Start desktop app: ${`cd apps/web && ${runCmd} desktop:dev`}\n${pc.cyan(
@@ -394,27 +394,27 @@ function getTauriInstructions(runCmd?: string): string {
394394
)} Tauri requires Rust and platform-specific dependencies.\n See: ${"https://v2.tauri.app/start/prerequisites/"}`;
395395
}
396396

397-
function getPwaInstructions(): string {
397+
function getPwaInstructions() {
398398
return `\n${pc.bold("PWA with React Router v7:")}\n${pc.yellow(
399399
"NOTE:",
400400
)} There is a known compatibility issue between VitePWA\n and React Router v7. See:\n https://github.com/vite-pwa/vite-plugin-pwa/issues/809`;
401401
}
402402

403-
function getStarlightInstructions(runCmd?: string): string {
403+
function getStarlightInstructions(runCmd?: string) {
404404
return `\n${pc.bold("Documentation with Starlight:")}\n${pc.cyan(
405405
"•",
406406
)} Start docs site: ${`cd apps/docs && ${runCmd} dev`}\n${pc.cyan(
407407
"•",
408408
)} Build docs site: ${`cd apps/docs && ${runCmd} build`}`;
409409
}
410410

411-
function getNoOrmWarning(): string {
411+
function getNoOrmWarning() {
412412
return `\n${pc.yellow(
413413
"WARNING:",
414414
)} Database selected without an ORM. Features requiring\n database access (e.g., examples, auth) need manual setup.`;
415415
}
416416

417-
function getBunWebNativeWarning(): string {
417+
function getBunWebNativeWarning() {
418418
return `\n${pc.yellow(
419419
"WARNING:",
420420
)} 'bun' might cause issues with web + native apps in a monorepo.\n Use 'pnpm' if problems arise.`;
@@ -424,7 +424,7 @@ function getWranglerDeployInstructions(
424424
runCmd?: string,
425425
webDeploy?: string,
426426
serverDeploy?: string,
427-
): string {
427+
) {
428428
const instructions: string[] = [];
429429

430430
if (webDeploy === "wrangler") {
@@ -441,15 +441,15 @@ function getWranglerDeployInstructions(
441441
return instructions.length ? `\n${instructions.join("\n")}` : "";
442442
}
443443

444-
function getClerkInstructions(): string {
444+
function getClerkInstructions() {
445445
return `${pc.bold("Clerk Authentication Setup:")}\n${pc.cyan("•")} Follow the guide: ${pc.underline("https://docs.convex.dev/auth/clerk")}\n${pc.cyan("•")} Set CLERK_JWT_ISSUER_DOMAIN in Convex Dashboard\n${pc.cyan("•")} Set CLERK_PUBLISHABLE_KEY in apps/*/.env`;
446446
}
447447

448448
function getAlchemyDeployInstructions(
449449
runCmd?: string,
450450
webDeploy?: string,
451451
serverDeploy?: string,
452-
): string {
452+
) {
453453
const instructions: string[] = [];
454454

455455
if (webDeploy === "alchemy" && serverDeploy !== "alchemy") {

apps/cli/src/helpers/database-providers/docker-compose-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function writeEnvFile(
3434
await addEnvVariablesToFile(envPath, variables);
3535
}
3636

37-
function getDatabaseUrl(database: Database, projectName: string): string {
37+
function getDatabaseUrl(database: Database, projectName: string) {
3838
switch (database) {
3939
case "postgres":
4040
return `postgresql://postgres:password@localhost:5432/${projectName}`;

apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ async function checkAtlasCLI() {
3131
}
3232
}
3333

34-
async function initMongoDBAtlas(
35-
serverDir: string,
36-
): Promise<MongoDBConfig | null> {
34+
async function initMongoDBAtlas(serverDir: string) {
3735
try {
3836
const hasAtlas = await checkAtlasCLI();
3937

0 commit comments

Comments
 (0)