Skip to content

Commit 6c5613f

Browse files
chore(web): remove unused code and dead exports
Remove unused functions, components, hooks, and schemas identified via ts-unused-exports analysis across the web package. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c875d7b commit 6c5613f

File tree

11 files changed

+1
-357
lines changed

11 files changed

+1
-357
lines changed

packages/web/src/actions.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import InviteUserEmail from "./emails/inviteUserEmail";
2626
import JoinRequestApprovedEmail from "./emails/joinRequestApprovedEmail";
2727
import JoinRequestSubmittedEmail from "./emails/joinRequestSubmittedEmail";
2828
import { AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME, MOBILE_UNSUPPORTED_SPLASH_SCREEN_DISMISSED_COOKIE_NAME, SINGLE_TENANT_ORG_DOMAIN, SOURCEBOT_GUEST_USER_ID, SOURCEBOT_SUPPORT_EMAIL } from "./lib/constants";
29-
import { ApiKeyPayload, RepositoryQuery, TenancyMode } from "./lib/types";
29+
import { ApiKeyPayload, RepositoryQuery } from "./lib/types";
3030
import { withAuthV2, withOptionalAuthV2 } from "./withAuthV2";
3131
import { getBrowsePath } from "./app/[domain]/browse/hooks/utils";
3232

@@ -171,17 +171,6 @@ export const withOrgMembership = async <T>(userId: string, domain: string, fn: (
171171
});
172172
}
173173

174-
export const withTenancyModeEnforcement = async<T>(mode: TenancyMode, fn: () => Promise<T>) => {
175-
if (env.SOURCEBOT_TENANCY_MODE !== mode) {
176-
return {
177-
statusCode: StatusCodes.FORBIDDEN,
178-
errorCode: ErrorCode.ACTION_DISALLOWED_IN_TENANCY_MODE,
179-
message: "This action is not allowed in the current tenancy mode.",
180-
} satisfies ServiceError;
181-
}
182-
return fn();
183-
}
184-
185174
////// Actions ///////
186175
export const completeOnboarding = async (domain: string): Promise<{ success: boolean } | ServiceError> => sew(() =>
187176
withAuth((userId) =>

packages/web/src/app/[domain]/browse/hooks/useBrowsePath.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/web/src/app/[domain]/components/codeHostIconButton.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/web/src/app/[domain]/repos/components/addRepositoryDialog.tsx

Lines changed: 0 additions & 126 deletions
This file was deleted.

packages/web/src/data/connection.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/web/src/hooks/useFindLanguageDescription.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/web/src/lib/extensions/lineOffsetExtension.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/web/src/lib/schemas.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { z } from "zod";
22
import { CodeHostType } from "@sourcebot/db";
33

4-
export const secretCreateRequestSchema = z.object({
5-
key: z.string(),
6-
value: z.string(),
7-
});
8-
9-
export const secreteDeleteRequestSchema = z.object({
10-
key: z.string(),
11-
});
12-
134
export const repositoryQuerySchema = z.object({
145
codeHostType: z.nativeEnum(CodeHostType),
156
repoId: z.number(),

packages/web/src/lib/serviceError.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,6 @@ export const queryParamsSchemaValidationError = (error: ZodError): ServiceError
5353
};
5454
}
5555

56-
export const invalidZoektResponse = async (zoektResponse: Response): Promise<ServiceError> => {
57-
const zoektMessage = await (async () => {
58-
try {
59-
const zoektResponseBody = await zoektResponse.json();
60-
if (zoektResponseBody.Error) {
61-
return zoektResponseBody.Error;
62-
}
63-
} catch (_e) {
64-
return "Unknown error";
65-
}
66-
})();
67-
68-
return {
69-
statusCode: StatusCodes.INTERNAL_SERVER_ERROR,
70-
errorCode: ErrorCode.INVALID_REQUEST_BODY,
71-
message: `Zoekt request failed with status code ${zoektResponse.status} and message: "${zoektMessage}"`,
72-
};
73-
}
74-
7556
export const fileNotFound = (fileName: string, repository: string): ServiceError => {
7657
return {
7758
statusCode: StatusCodes.NOT_FOUND,
@@ -120,22 +101,6 @@ export const orgNotFound = (): ServiceError => {
120101
}
121102
}
122103

123-
export const orgDomainExists = (): ServiceError => {
124-
return {
125-
statusCode: StatusCodes.CONFLICT,
126-
errorCode: ErrorCode.ORG_DOMAIN_ALREADY_EXISTS,
127-
message: "Organization domain already exists, please try a different one.",
128-
}
129-
}
130-
131-
export const secretAlreadyExists = (): ServiceError => {
132-
return {
133-
statusCode: StatusCodes.CONFLICT,
134-
errorCode: ErrorCode.SECRET_ALREADY_EXISTS,
135-
message: "Secret already exists",
136-
}
137-
}
138-
139104
export const invalidGitRef = (ref: string): ServiceError => {
140105
return {
141106
statusCode: StatusCodes.BAD_REQUEST,

0 commit comments

Comments
 (0)