Skip to content

Commit

Permalink
style: add formatting using Prettier with .editorconfig (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime authored Sep 7, 2024
1 parent 54782b3 commit 4bba07a
Show file tree
Hide file tree
Showing 102 changed files with 416 additions and 407 deletions.
14 changes: 2 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
indent_style = space
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[json]
indent_size = 4

[ruby]
print_width = 120

[python]
indent_size = 4
4 changes: 2 additions & 2 deletions api/apps/admin/tokens/createToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const createAppAdminToken = async (
orgId: number,
appId: number,
tokenLabel: string,
timeToLive: number
timeToLive: number,
) => {
const response = await fetch(
ApiRoutes.getAppAdminTokensByOrgIdAndAppId(orgId, appId),
Expand All @@ -18,7 +18,7 @@ const createAppAdminToken = async (
headers: {
"Content-Type": "application/json",
},
}
},
);

return await returnDataOrThrowError(response);
Expand Down
4 changes: 2 additions & 2 deletions api/apps/admin/tokens/deleteAppAdminToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { returnDataOrThrowError } from "../../../../util/api";
const deleteAppAdminToken = async (
orgId: number,
appId: number,
tokenId: number
tokenId: number,
) => {
const response = await fetch(
ApiRoutes.getAppAdminTokensByOrgIdAndAppIdAndTokenId(orgId, appId, tokenId),
{
method: "DELETE",
}
},
);

return await returnDataOrThrowError(response);
Expand Down
4 changes: 2 additions & 2 deletions api/apps/admin/tokens/useAppAdminTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import getFetcher from "../../../../util/fetcher";

export function useAppAdminTokens(
orgId: number,
appId: number
appId: number,
): {
appAdminTokens?: AppAdminTokenDto[];
isError?: Error;
Expand All @@ -14,7 +14,7 @@ export function useAppAdminTokens(
} {
const { data, isLoading, error, mutate } = useSWR<AppAdminTokenDto[]>(
ApiRoutes.getAppAdminTokensByOrgIdAndAppId(orgId, appId),
getFetcher
getFetcher,
);

return {
Expand Down
4 changes: 2 additions & 2 deletions api/apps/useApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import getFetcher from "../../util/fetcher";

export function useApp(
orgId: number,
appId: number
appId: number,
): {
app?: App;
isError?: Error;
Expand All @@ -14,7 +14,7 @@ export function useApp(
} {
const { data, isLoading, error, mutate } = useSWR<App>(
ApiRoutes.getAppByOrgIdAndAppId(orgId, appId),
getFetcher
getFetcher,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion api/apps/useApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useApps(orgId: number): {
} {
const { data, isLoading, error, mutate } = useSWR<App[]>(
ApiRoutes.getAppsByOrgId(orgId),
getFetcher
getFetcher,
);

return {
Expand Down
4 changes: 2 additions & 2 deletions api/messages/createMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { returnDataOrThrowError } from "../../util/api";
const createMessage = async (
orgId: number,
appId: number,
message: Message
message: Message,
) => {
const response = await fetch(
ApiRoutes.getMessagesByOrgIdAndAppId(orgId, appId),
Expand All @@ -15,7 +15,7 @@ const createMessage = async (
headers: {
"Content-Type": "application/json",
},
}
},
);

return await returnDataOrThrowError(response);
Expand Down
4 changes: 2 additions & 2 deletions api/messages/deleteMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { returnDataOrThrowError } from "../../util/api";
const deleteMessage = async (
orgId: number,
appId: number,
messageId: number
messageId: number,
) => {
const response = await fetch(
ApiRoutes.getMessageByOrgIdAndAppIdAndMessageId(orgId, appId, messageId),
{
method: "DELETE",
}
},
);

return await returnDataOrThrowError(response);
Expand Down
2 changes: 1 addition & 1 deletion api/messages/getMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { returnDataOrThrowError } from "../../util/api";

const getMessage = async (orgId: number, appId: number, messageId: number) => {
const response = await fetch(
ApiRoutes.getMessageByOrgIdAndAppIdAndMessageId(orgId, appId, messageId)
ApiRoutes.getMessageByOrgIdAndAppIdAndMessageId(orgId, appId, messageId),
);

return await returnDataOrThrowError(response);
Expand Down
4 changes: 2 additions & 2 deletions api/messages/updateMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const updateMessage = async (
orgId: number,
appId: number,
messageId: number,
message: Message
message: Message,
) => {
const response = await fetch(
ApiRoutes.getMessageByOrgIdAndAppIdAndMessageId(orgId, appId, messageId),
Expand All @@ -16,7 +16,7 @@ const updateMessage = async (
headers: {
"Content-Type": "application/json",
},
}
},
);

return await returnDataOrThrowError(response);
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/admin/tokens/deleteOrgAdminToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const deleteOrgAdminToken = async (orgId: number, tokenId: number) => {
ApiRoutes.getOrgAdminTokensByOrgIdAndTokenId(orgId, tokenId),
{
method: "DELETE",
}
},
);

return await returnDataOrThrowError(response);
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/admin/tokens/useOrgAdminTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useOrgAdminTokens(orgId: number): {
} {
const { data, isLoading, error, mutate } = useSWR<OrgAdminTokenDto[]>(
ApiRoutes.getOrgAdminTokensByOrgId(orgId),
getFetcher
getFetcher,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/deleteUserFromOrg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const deleteUserFromOrg = async (orgId: number, userEmail: string) => {
ApiRoutes.getOrgUserByOrgIdAndUserEmail(orgId, userEmail),
{
method: "DELETE",
}
},
);

return await returnDataOrThrowError(response);
Expand Down
17 changes: 10 additions & 7 deletions api/orgs/updateUserInviteRoleInOrg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import { returnDataOrThrowError } from "../../util/api";
const updateUserRoleInOrg = async (
orgId: number,
userEmail: string,
role: string
role: string,
) => {
const response = await fetch(ApiRoutes.getOrgUserByOrgIdAndUserEmail(orgId, userEmail), {
method: "PUT",
body: JSON.stringify({ role: role, userEmail: userEmail, orgId: orgId }),
headers: {
"Content-Type": "application/json",
const response = await fetch(
ApiRoutes.getOrgUserByOrgIdAndUserEmail(orgId, userEmail),
{
method: "PUT",
body: JSON.stringify({ role: role, userEmail: userEmail, orgId: orgId }),
headers: {
"Content-Type": "application/json",
},
},
});
);

return await returnDataOrThrowError(response);
};
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/updateUserRoleInOrg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { returnDataOrThrowError } from "../../util/api";
const updateUserRoleInOrg = async (
orgId: number,
userId: number,
role: string
role: string,
) => {
const response = await fetch(ApiRoutes.getOrgUsersByOrgId(orgId), {
method: "PUT",
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/useOrg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useOrg(orgId: number): {
} {
const { data, isLoading, error, mutate } = useSWR<Org>(
ApiRoutes.getOrgById(orgId),
getFetcher
getFetcher,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/useOrgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useOrgs(): {
} {
const { data, isLoading, error, mutate } = useSWR<Org[]>(
ApiRoutes.ORGS,
getFetcher
getFetcher,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion api/orgs/useUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useUsers(orgId: number): {
} {
const { data, isLoading, error, mutate } = useSWR<User[]>(
ApiRoutes.getOrgUsersByOrgId(orgId),
getFetcher
getFetcher,
);

return {
Expand Down
5 changes: 4 additions & 1 deletion api/stripe/createCheckoutSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { ProductType } from "../../models/productType";
import ApiRoutes from "../../routes/apiRoutes";
import { returnDataOrThrowError } from "../../util/api";

const createCheckoutSession = async (products: ProductType[], orgId: number) => {
const createCheckoutSession = async (
products: ProductType[],
orgId: number,
) => {
const response = await fetch(ApiRoutes.CHECKOUT_SESSION, {
method: "POST",
body: JSON.stringify({ products: products, orgId: orgId }),
Expand Down
2 changes: 1 addition & 1 deletion api/stripe/useProducts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useProducts(): {
} {
const { data, isLoading, error, mutate } = useSWR<Product[]>(
ApiRoutes.PRODUCTS,
getFetcher
getFetcher,
);

return {
Expand Down
8 changes: 4 additions & 4 deletions app/actions/request-account-verification-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const requestAccountVerificationEmail = createServerAction(
expiryDate.setDate(expiryDate.getDate() + 7);

logger.log(
`Updating previos verification tokens for user with id '${user.id}' as obsolete`
`Updating previos verification tokens for user with id '${user.id}' as obsolete`,
);
await prisma.verificationToken.updateMany({
where: {
Expand All @@ -62,10 +62,10 @@ export const requestAccountVerificationEmail = createServerAction(
user.email ?? email,
user.firstName,
verificationToken.token,
MailType.Verification
MailType.Verification,
);
logger.log(
`Verification email sent for user with id '${user.id}' to email '${user.email}'`
`Verification email sent for user with id '${user.id}' to email '${user.email}'`,
);
}
},
);
6 changes: 3 additions & 3 deletions app/actions/request-password-reset-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const requestPasswordResetEmail = createServerAction(
const expiryDate = new Date(Date.now() + 60 * 60 * 1000);

logger.log(
`Updating previous password reset tokens for user with id '${user.id}' as obsolete`
`Updating previous password reset tokens for user with id '${user.id}' as obsolete`,
);
await prisma.passwordResetToken.updateMany({
where: {
Expand All @@ -58,8 +58,8 @@ export const requestPasswordResetEmail = createServerAction(
user.email ?? email,
user.firstName,
generatedToken,
MailType.ResetPassword
MailType.ResetPassword,
);
logger.log(`Password reset token sent to user with email '${email}'`);
}
},
);
2 changes: 1 addition & 1 deletion app/actions/reset-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ export const resetPassword = createServerAction(
});

return updatedUser;
}
},
);
6 changes: 3 additions & 3 deletions app/actions/sign-up.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const signUp = createServerAction(
expiryDate.setDate(expiryDate.getDate() + 7);

logger.log(
`Creating verification token for user with id '${createdUser.id}'`
`Creating verification token for user with id '${createdUser.id}'`,
);
const verificationToken = await prisma.verificationToken.create({
data: {
Expand All @@ -98,7 +98,7 @@ export const signUp = createServerAction(
createdUser.email ?? email,
createdUser.firstName,
verificationToken.token,
MailType.Verification
MailType.Verification,
);
}
},
);
2 changes: 1 addition & 1 deletion app/actions/verify-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ export const verifyEmail = createServerAction(
isArchived: true,
},
});
}
},
);
12 changes: 6 additions & 6 deletions config/loadClientConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ export function loadClientConfig(): ClientConfig {
const adaptedConfig: ClientConfig = {
sentryConfig: {
debug: parseBooleanEnvValue(
env.SENTRY_DEBUG ?? env.NEXT_PUBLIC_SENTRY_DEBUG
env.SENTRY_DEBUG ?? env.NEXT_PUBLIC_SENTRY_DEBUG,
),
dsn: env.SENTRY_DSN ?? env.NEXT_PUBLIC_SENTRY_DSN,
env: env.SENTRY_ENV ?? env.NEXT_PUBLIC_SENTRY_ENV,
release: env.SENTRY_RELEASE ?? env.NEXT_PUBLIC_SENTRY_RELEASE,
replaysOnErrorSampleRate: parseNumberEnvValue(
env.SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE ??
env.NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE
env.NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE,
),
replaysSessionSampleRate: parseNumberEnvValue(
env.SENTRY_REPLAYS_SESSION_SAMPLE_RATE ??
env.NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE
env.NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE,
),
sampleRate: parseNumberEnvValue(
env.SENTRY_SAMPLE_RATE ?? env.NEXT_PUBLIC_SENTRY_SAMPLE_RATE
env.SENTRY_SAMPLE_RATE ?? env.NEXT_PUBLIC_SENTRY_SAMPLE_RATE,
),
tracesSampleRate:
parseNumberEnvValue(
env.SENTRY_TRACES_SAMPLE_RATE ??
env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE
env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE,
) ?? 0.2,
},
stripeConfig: {
Expand All @@ -43,6 +43,6 @@ export function loadClientConfig(): ClientConfig {
// we need to make sure keys are always in the same order to prevent "Text content did not match" issue
// when displaying config on a page
return sortKeys(
adaptedConfig as unknown as { [keyof: string]: unknown }
adaptedConfig as unknown as { [keyof: string]: unknown },
) as unknown as ClientConfig;
}
Loading

0 comments on commit 4bba07a

Please sign in to comment.