The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: fix eslint warnings
Mythie8a271ff8bc31
diff --git a/apps/marketing/src/app/(marketing)/claimed/page.tsx b/apps/marketing/src/app/(marketing)/claimed/page.tsxindex ce748006e..f56ae2b26 100644--- a/apps/marketing/src/app/(marketing)/claimed/page.tsx+++ b/apps/marketing/src/app/(marketing)/claimed/page.tsx@@ -27,7 +27,11 @@ export type ClaimedPlanPageProps = {export default async function ClaimedPlanPage({ searchParams = {} }: ClaimedPlanPageProps) {const { sessionId } = searchParams;- const session = await stripe.checkout.sessions.retrieve(sessionId as string);+ if (typeof sessionId !== 'string') {+ redirect('/');+ }++ const session = await stripe.checkout.sessions.retrieve(sessionId);const user = await prisma.user.findFirst({where: {@@ -157,7 +161,6 @@ export default async function ClaimedPlanPage({ searchParams = {} }: ClaimedPlan</p><Link- // eslint-disable-next-line turbo/no-undeclared-env-varshref={`${process.env.NEXT_PUBLIC_APP_URL}/login`}target="_blank"className="mt-4 block"diff --git a/apps/marketing/src/components/(marketing)/pricing-table.tsx b/apps/marketing/src/components/(marketing)/pricing-table.tsxindex 4d229ae98..d3e76bd84 100644--- a/apps/marketing/src/components/(marketing)/pricing-table.tsx+++ b/apps/marketing/src/components/(marketing)/pricing-table.tsx@@ -22,7 +22,6 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {const event = usePlausible();const [period, setPeriod] = useState<'MONTHLY' | 'YEARLY'>(() =>- // eslint-disable-next-line turbo/no-undeclared-env-varsparams?.get('planId') === process.env.NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_YEARLY_PRICE_ID? 'YEARLY': 'MONTHLY',@@ -30,11 +29,9 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {const planId = useMemo(() => {if (period === 'MONTHLY') {- // eslint-disable-next-line turbo/no-undeclared-env-varsreturn process.env.NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_MONTHLY_PRICE_ID;}- // eslint-disable-next-line turbo/no-undeclared-env-varsreturn process.env.NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_YEARLY_PRICE_ID;}, [period]);diff --git a/apps/marketing/src/components/(marketing)/widget.tsx b/apps/marketing/src/components/(marketing)/widget.tsxindex 15e15d04c..def90e0cd 100644--- a/apps/marketing/src/components/(marketing)/widget.tsx+++ b/apps/marketing/src/components/(marketing)/widget.tsx@@ -139,7 +139,6 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {setTimeout(resolve, 1000);});- // eslint-disable-next-line turbo/no-undeclared-env-varsconst planId = process.env.NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_MONTHLY_PRICE_ID;const claimPlanInput = signatureDataUrl@@ -147,7 +146,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {name,email,planId,- signatureDataUrl: signatureDataUrl!,+ signatureDataUrl: signatureDataUrl,signatureText: null,}: {@@ -155,7 +154,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {email,planId,signatureDataUrl: null,- signatureText: signatureText!,+ signatureText: signatureText ?? '',};const [result] = await Promise.all([claimPlan(claimPlanInput), delay]);diff --git a/apps/marketing/src/pages/api/claim-plan/index.ts b/apps/marketing/src/pages/api/claim-plan/index.tsindex a2e4108d2..abad354a8 100644--- a/apps/marketing/src/pages/api/claim-plan/index.ts+++ b/apps/marketing/src/pages/api/claim-plan/index.ts@@ -43,7 +43,6 @@ export default async function handler(if (user && user.Subscription.length > 0) {return res.status(200).json({- // eslint-disable-next-line turbo/no-undeclared-env-varsredirectUrl: `${process.env.NEXT_PUBLIC_APP_URL}/login`,});}@@ -104,7 +103,6 @@ export default async function handler(mode: 'subscription',metadata,allow_promotion_codes: true,- // eslint-disable-next-line turbo/no-undeclared-env-varssuccess_url: `${process.env.NEXT_PUBLIC_SITE_URL}/claimed?sessionId={CHECKOUT_SESSION_ID}`,cancel_url: `${process.env.NEXT_PUBLIC_SITE_URL}/pricing?email=${encodeURIComponent(email,diff --git a/apps/marketing/src/pages/api/stripe/webhook/index.ts b/apps/marketing/src/pages/api/stripe/webhook/index.tsindex a0a4ccebb..3f3810fd4 100644--- a/apps/marketing/src/pages/api/stripe/webhook/index.ts+++ b/apps/marketing/src/pages/api/stripe/webhook/index.ts@@ -17,14 +17,13 @@ import {SigningStatus,} from '@documenso/prisma/client';-const log = (...args: any[]) => console.log('[stripe]', ...args);+const log = (...args: unknown[]) => console.log('[stripe]', ...args);export const config = {api: { bodyParser: false },};export default async function handler(req: NextApiRequest, res: NextApiResponse) {- // eslint-disable-next-line turbo/no-undeclared-env-vars// if (!process.env.NEXT_PUBLIC_ALLOW_SUBSCRIPTIONS) {// return res.status(500).json({// success: false,@@ -55,6 +54,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)log('event-type:', event.type);if (event.type === 'checkout.session.completed') {+ // This typecast is required since we don't want to create a guard for every event type+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertionsconst session = event.data.object as Stripe.Checkout.Session;if (session.metadata?.source === 'landing') {diff --git a/apps/web/src/components/(dashboard)/period-selector/types.ts b/apps/web/src/components/(dashboard)/period-selector/types.tsindex 4ebfe47f1..2b50f5d6c 100644--- a/apps/web/src/components/(dashboard)/period-selector/types.ts+++ b/apps/web/src/components/(dashboard)/period-selector/types.ts@@ -1,5 +1,6 @@export type PeriodSelectorValue = '' | '7d' | '14d' | '30d';export const isPeriodSelectorValue = (value: unknown): value is PeriodSelectorValue => {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertionsreturn ['', '7d', '14d', '30d'].includes(value as string);};diff --git a/apps/web/src/pages/api/claim-plan/index.ts b/apps/web/src/pages/api/claim-plan/index.tsindex a2e4108d2..abad354a8 100644--- a/apps/web/src/pages/api/claim-plan/index.ts+++ b/apps/web/src/pages/api/claim-plan/index.ts@@ -43,7 +43,6 @@ export default async function handler(if (user && user.Subscription.length > 0) {return res.status(200).json({- // eslint-disable-next-line turbo/no-undeclared-env-varsredirectUrl: `${process.env.NEXT_PUBLIC_APP_URL}/login`,});}@@ -104,7 +103,6 @@ export default async function handler(mode: 'subscription',metadata,allow_promotion_codes: true,- // eslint-disable-next-line turbo/no-undeclared-env-varssuccess_url: `${process.env.NEXT_PUBLIC_SITE_URL}/claimed?sessionId={CHECKOUT_SESSION_ID}`,cancel_url: `${process.env.NEXT_PUBLIC_SITE_URL}/pricing?email=${encodeURIComponent(email,diff --git a/apps/web/src/pages/api/stripe/webhook/index.ts b/apps/web/src/pages/api/stripe/webhook/index.tsindex dd15d4d81..6c678a33c 100644--- a/apps/web/src/pages/api/stripe/webhook/index.ts+++ b/apps/web/src/pages/api/stripe/webhook/index.ts@@ -17,14 +17,13 @@ import {SigningStatus,} from '@documenso/prisma/client';-const log = (...args: any[]) => console.log('[stripe]', ...args);+const log = (...args: unknown[]) => console.log('[stripe]', ...args);export const config = {api: { bodyParser: false },};export default async function handler(req: NextApiRequest, res: NextApiResponse) {- // eslint-disable-next-line turbo/no-undeclared-env-vars// if (!process.env.NEXT_PUBLIC_ALLOW_SUBSCRIPTIONS) {// return res.status(500).json({// success: false,@@ -55,6 +54,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)log('event-type:', event.type);if (event.type === 'checkout.session.completed') {+ // This is required since we don't want to create a guard for every event type+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertionsconst session = event.data.object as Stripe.Checkout.Session;if (session.metadata?.source === 'landing') {diff --git a/packages/lib/server-only/field/set-fields-for-document.ts b/packages/lib/server-only/field/set-fields-for-document.tsindex c54d35bc1..dc477bcea 100644--- a/packages/lib/server-only/field/set-fields-for-document.ts+++ b/packages/lib/server-only/field/set-fields-for-document.ts@@ -84,6 +84,8 @@ export const setFieldsForDocument = async ({}): prisma.field.create({data: {+ // TODO: Rewrite this entire transaction because this is a mess+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertiontype: field.type!,page: field.pageNumber,positionX: field.pageX,diff --git a/packages/lib/server-only/stripe/index.ts b/packages/lib/server-only/stripe/index.tsindex b2ab59fb9..505beaec8 100644--- a/packages/lib/server-only/stripe/index.ts+++ b/packages/lib/server-only/stripe/index.ts@@ -1,7 +1,6 @@import Stripe from 'stripe';-// eslint-disable-next-line turbo/no-undeclared-env-vars-export const stripe = new Stripe(process.env.NEXT_PRIVATE_STRIPE_API_KEY!, {+export const stripe = new Stripe(process.env.NEXT_PRIVATE_STRIPE_API_KEY ?? '', {apiVersion: '2022-11-15',typescript: true,});diff --git a/packages/lib/server-only/user/update-password.ts b/packages/lib/server-only/user/update-password.tsindex 4133bc342..d987085ff 100644--- a/packages/lib/server-only/user/update-password.ts+++ b/packages/lib/server-only/user/update-password.ts@@ -19,11 +19,13 @@ export const updatePassword = async ({ userId, password }: UpdatePasswordOptionsconst hashedPassword = await hash(password, SALT_ROUNDS);- // Compare the new password with the old password- const isSamePassword = await compare(password, user.password as string);+ if (user.password) {+ // Compare the new password with the old password+ const isSamePassword = await compare(password, user.password);- if (isSamePassword) {- throw new Error('Your new password cannot be the same as your old password.');+ if (isSamePassword) {+ throw new Error('Your new password cannot be the same as your old password.');+ }}const updatedUser = await prisma.user.update({diff --git a/packages/lib/types/find-result-set.ts b/packages/lib/types/find-result-set.tsindex 81b16f1ca..219b9b89c 100644--- a/packages/lib/types/find-result-set.ts+++ b/packages/lib/types/find-result-set.ts@@ -1,5 +1,5 @@export type FindResultSet<T> = {- data: T extends Array<any> ? T : T[];+ data: T extends Array<unknown> ? T : T[];count: number;currentPage: number;perPage: number;diff --git a/packages/lib/types/is-document-status.ts b/packages/lib/types/is-document-status.tsindex 0666308a5..dbb5af489 100644--- a/packages/lib/types/is-document-status.ts+++ b/packages/lib/types/is-document-status.ts@@ -1,5 +1,6 @@import { DocumentStatus } from '@documenso/prisma/client';export const isDocumentStatus = (value: unknown): value is DocumentStatus => {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertionsreturn Object.values(DocumentStatus).includes(value as DocumentStatus);};diff --git a/turbo.json b/turbo.jsonindex ab4460781..f7d3d342c 100644--- a/turbo.json+++ b/turbo.json@@ -22,10 +22,13 @@"globalEnv": ["NEXTAUTH_URL","NEXTAUTH_SECRET",+ "NEXT_PUBLIC_APP_URL","NEXT_PUBLIC_SITE_URL","NEXT_PUBLIC_POSTHOG_KEY","NEXT_PUBLIC_POSTHOG_HOST","NEXT_PUBLIC_FEATURE_BILLING_ENABLED",+ "NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_YEARLY_PRICE_ID",+ "NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_MONTHLY_PRICE_ID","NEXT_PRIVATE_DATABASE_URL","NEXT_PRIVATE_NEXT_AUTH_SECRET","NEXT_PRIVATE_GOOGLE_CLIENT_ID",@@ -44,6 +47,7 @@"NEXT_PRIVATE_SMTP_APIKEY","NEXT_PRIVATE_SMTP_SECURE","NEXT_PRIVATE_SMTP_FROM_NAME",- "NEXT_PRIVATE_SMTP_FROM_ADDRESS"+ "NEXT_PRIVATE_SMTP_FROM_ADDRESS",+ "NEXT_PRIVATE_STRIPE_API_KEY"]-}\ No newline at end of file+}