From 1d73a9ad2710d16a3f9eb641dbbbd40cba63bfd4 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Fri, 24 Jul 2026 10:26:07 -0400 Subject: [PATCH] chore(ui): fix eslint errors in composed and profile modules PR #9144 landed on main with ESLint errors (unsorted imports, missing curly braces, unused imports, an empty catch) that turbo's lint cache masked on the main push. Any PR that misses the cache re-runs lint and fails static analysis on these. Autofix + one manual empty-catch comment. --- .changeset/fix-ui-lint.md | 2 ++ .../organizationEnterpriseConnection.test.ts | 2 +- .../components/UserProfile/SecurityPage.tsx | 2 +- .../UserProfile/SecuritySections.tsx | 18 +++++++++++++----- .../ConnectedAccountsSection.test.tsx | 4 ++-- .../__tests__/SecuritySections.test.tsx | 2 +- packages/ui/src/composed/APIKeysSection.tsx | 2 +- packages/ui/src/composed/BillingSection.tsx | 2 +- .../__tests__/OrganizationProfile.test.tsx | 5 ++--- .../__tests__/stub-limitations.test.ts | 2 +- packages/ui/src/composed/createSection.tsx | 4 +++- packages/ui/src/composed/useBillingRouter.ts | 4 +++- .../useWarnAboutCustomizationWithoutPinning.ts | 4 ++-- packages/ui/src/mosaic/conditions.ts | 2 +- 14 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 .changeset/fix-ui-lint.md diff --git a/.changeset/fix-ui-lint.md b/.changeset/fix-ui-lint.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/fix-ui-lint.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/ui/src/components/ConfigureSSO/domain/__tests__/organizationEnterpriseConnection.test.ts b/packages/ui/src/components/ConfigureSSO/domain/__tests__/organizationEnterpriseConnection.test.ts index 23dbbb2841a..a0189c74311 100644 --- a/packages/ui/src/components/ConfigureSSO/domain/__tests__/organizationEnterpriseConnection.test.ts +++ b/packages/ui/src/components/ConfigureSSO/domain/__tests__/organizationEnterpriseConnection.test.ts @@ -288,7 +288,7 @@ describe('connectionBackingEmail', () => { const email = (id: string, status: 'verified' | 'unverified'): EmailAddressResource => ({ id, emailAddress: `${id}@acme.com`, verification: { status } }) as EmailAddressResource; - const makeUser = (overrides: Partial): UserResource => overrides as UserResource; + const makeUser = (overrides: Partial): UserResource => overrides; it('returns the primary email when one is present', () => { const primary = email('primary', 'verified'); diff --git a/packages/ui/src/components/UserProfile/SecurityPage.tsx b/packages/ui/src/components/UserProfile/SecurityPage.tsx index ddfdb822bf7..36274d104ca 100644 --- a/packages/ui/src/components/UserProfile/SecurityPage.tsx +++ b/packages/ui/src/components/UserProfile/SecurityPage.tsx @@ -3,7 +3,7 @@ import { ProfileCard } from '@/ui/elements/ProfileCard'; import { localizationKeys } from '../../customizables'; import { ActiveDevicesSection } from './ActiveDevicesSection'; -import { SecurityPassword, SecurityPasskeys, SecurityMfa, SecurityDelete } from './SecuritySections'; +import { SecurityDelete, SecurityMfa, SecurityPasskeys, SecurityPassword } from './SecuritySections'; export const SecurityPage = withCardStateProvider(() => { const card = useCardState(); diff --git a/packages/ui/src/components/UserProfile/SecuritySections.tsx b/packages/ui/src/components/UserProfile/SecuritySections.tsx index a1638f8dd7a..c097593a7a8 100644 --- a/packages/ui/src/components/UserProfile/SecuritySections.tsx +++ b/packages/ui/src/components/UserProfile/SecuritySections.tsx @@ -4,15 +4,17 @@ import type { ReactNode } from 'react'; import { getSecondFactors } from '@/ui/utils/mfa'; import { useEnvironment, useUserProfileContext } from '../../contexts'; +import { DeleteSection } from './DeleteSection'; import { MfaSection } from './MfaSection'; import { PasskeySection } from './PasskeySection'; import { PasswordSection } from './PasswordSection'; -import { DeleteSection } from './DeleteSection'; export function SecurityPassword(): ReactNode { const { instanceIsPasswordBased } = useEnvironment().userSettings; - if (!instanceIsPasswordBased) return null; + if (!instanceIsPasswordBased) { + return null; + } return ; } @@ -21,7 +23,9 @@ export function SecurityPasskeys(): ReactNode { const { attributes } = useEnvironment().userSettings; const { shouldAllowIdentificationCreation } = useUserProfileContext(); - if (!attributes.passkey?.enabled || !shouldAllowIdentificationCreation) return null; + if (!attributes.passkey?.enabled || !shouldAllowIdentificationCreation) { + return null; + } return ; } @@ -29,7 +33,9 @@ export function SecurityPasskeys(): ReactNode { export function SecurityMfa(): ReactNode { const { attributes } = useEnvironment().userSettings; - if (getSecondFactors(attributes).length === 0) return null; + if (getSecondFactors(attributes).length === 0) { + return null; + } return ; } @@ -37,7 +43,9 @@ export function SecurityMfa(): ReactNode { export function SecurityDelete(): ReactNode { const { user } = useUser(); - if (!user?.deleteSelfEnabled) return null; + if (!user?.deleteSelfEnabled) { + return null; + } return ; } diff --git a/packages/ui/src/components/UserProfile/__tests__/ConnectedAccountsSection.test.tsx b/packages/ui/src/components/UserProfile/__tests__/ConnectedAccountsSection.test.tsx index 94ef470f962..b8b242cecbc 100644 --- a/packages/ui/src/components/UserProfile/__tests__/ConnectedAccountsSection.test.tsx +++ b/packages/ui/src/components/UserProfile/__tests__/ConnectedAccountsSection.test.tsx @@ -168,7 +168,7 @@ describe('ConnectedAccountsSection ', () => { open, }, }); - const reload = vi.spyOn(fixtures.clerk.user!, 'reload').mockResolvedValue(fixtures.clerk.user!); + const reload = vi.spyOn(fixtures.clerk.user, 'reload').mockResolvedValue(fixtures.clerk.user); fixtures.clerk.user?.createExternalAccount.mockResolvedValue({ verification: { externalVerificationRedirectURL: new URL('https://provider.example/auth') }, } as ExternalAccountResource); @@ -291,7 +291,7 @@ describe('ConnectedAccountsSection ', () => { open, }, }); - const reload = vi.spyOn(fixtures.clerk.user!, 'reload').mockResolvedValue(fixtures.clerk.user!); + const reload = vi.spyOn(fixtures.clerk.user, 'reload').mockResolvedValue(fixtures.clerk.user); fixtures.clerk.user?.createExternalAccount.mockResolvedValue({ verification: { externalVerificationRedirectURL: new URL('https://provider.example/auth') }, } as ExternalAccountResource); diff --git a/packages/ui/src/components/UserProfile/__tests__/SecuritySections.test.tsx b/packages/ui/src/components/UserProfile/__tests__/SecuritySections.test.tsx index 707cf50b8f2..334e7a5da3c 100644 --- a/packages/ui/src/components/UserProfile/__tests__/SecuritySections.test.tsx +++ b/packages/ui/src/components/UserProfile/__tests__/SecuritySections.test.tsx @@ -5,7 +5,7 @@ import { render, screen } from '@/test/utils'; import { CardStateProvider } from '@/ui/elements/contexts'; import { clearFetchCache } from '../../../hooks'; -import { SecurityPassword, SecurityPasskeys, SecurityMfa, SecurityDelete } from '../SecuritySections'; +import { SecurityDelete, SecurityMfa, SecurityPasskeys, SecurityPassword } from '../SecuritySections'; const { createFixtures } = bindCreateFixtures('UserProfile'); diff --git a/packages/ui/src/composed/APIKeysSection.tsx b/packages/ui/src/composed/APIKeysSection.tsx index 3e1369dcef8..2484bdfa1a8 100644 --- a/packages/ui/src/composed/APIKeysSection.tsx +++ b/packages/ui/src/composed/APIKeysSection.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Suspense, type ComponentType, type ReactNode } from 'react'; +import { type ComponentType, type ReactNode, Suspense } from 'react'; import { CardStateProvider } from '../elements/contexts'; diff --git a/packages/ui/src/composed/BillingSection.tsx b/packages/ui/src/composed/BillingSection.tsx index f6c30a1139e..d1f117c184d 100644 --- a/packages/ui/src/composed/BillingSection.tsx +++ b/packages/ui/src/composed/BillingSection.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Suspense, type ComponentType, type ReactNode } from 'react'; +import { type ComponentType, type ReactNode, Suspense } from 'react'; import { RouteContext } from '../router/RouteContext'; import { useBillingRouter } from './useBillingRouter'; diff --git a/packages/ui/src/composed/__tests__/OrganizationProfile.test.tsx b/packages/ui/src/composed/__tests__/OrganizationProfile.test.tsx index 38133f9e5a6..52de8f6a41f 100644 --- a/packages/ui/src/composed/__tests__/OrganizationProfile.test.tsx +++ b/packages/ui/src/composed/__tests__/OrganizationProfile.test.tsx @@ -1,8 +1,7 @@ -import type { ClerkPaginatedResponse, OrganizationMembershipResource } from '@clerk/shared/types'; -import { describe, expect, it } from 'vitest'; +import { describe, it } from 'vitest'; import { bindCreateFixtures } from '@/test/create-fixtures'; -import { render, screen, waitFor } from '@/test/utils'; +import { render, screen } from '@/test/utils'; import { OrganizationGeneralPage } from '../../components/OrganizationProfile/OrganizationGeneralPage'; diff --git a/packages/ui/src/composed/__tests__/stub-limitations.test.ts b/packages/ui/src/composed/__tests__/stub-limitations.test.ts index fffd9d61236..480ebf4a092 100644 --- a/packages/ui/src/composed/__tests__/stub-limitations.test.ts +++ b/packages/ui/src/composed/__tests__/stub-limitations.test.ts @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react'; +import { act, renderHook } from '@testing-library/react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { createComposedRouter, stubRouter } from '../stubRouter'; diff --git a/packages/ui/src/composed/createSection.tsx b/packages/ui/src/composed/createSection.tsx index fb2e6b89042..e3f3915c0e4 100644 --- a/packages/ui/src/composed/createSection.tsx +++ b/packages/ui/src/composed/createSection.tsx @@ -6,7 +6,9 @@ import { useRequirePage } from './useRequirePage'; export function createSection(name: string, Component: ComponentType): () => ReactNode { function Section(): ReactNode { - if (!useRequirePage(name)) return null; + if (!useRequirePage(name)) { + return null; + } return ; } Section.displayName = name; diff --git a/packages/ui/src/composed/useBillingRouter.ts b/packages/ui/src/composed/useBillingRouter.ts index e5336060c63..8b6a0f919e2 100644 --- a/packages/ui/src/composed/useBillingRouter.ts +++ b/packages/ui/src/composed/useBillingRouter.ts @@ -83,7 +83,9 @@ export function useBillingRouter(): { router: RouteContextValue; route: BillingR window.location.href = to; return; } - } catch {} + } catch { + // `to` is not an absolute URL; fall through to relative-route handling. + } const newRoute = resolveNavigation(to); setRoute(newRoute); if (options?.searchParams) { diff --git a/packages/ui/src/hooks/useWarnAboutCustomizationWithoutPinning.ts b/packages/ui/src/hooks/useWarnAboutCustomizationWithoutPinning.ts index 74cf415ba9b..cf6c3bbf8fa 100644 --- a/packages/ui/src/hooks/useWarnAboutCustomizationWithoutPinning.ts +++ b/packages/ui/src/hooks/useWarnAboutCustomizationWithoutPinning.ts @@ -52,9 +52,9 @@ export function useWarnAboutCustomizationWithoutPinning(appearance: Appearance | return () => { if (useIdleCallback) { - cancelIdleCallback(handle as number); + cancelIdleCallback(handle); } else { - clearTimeout(handle as ReturnType); + clearTimeout(handle); } }; }, [clerkCtx?.value, stableAppearance, uiPinned]); diff --git a/packages/ui/src/mosaic/conditions.ts b/packages/ui/src/mosaic/conditions.ts index b2d759841b1..b88e8ddec50 100644 --- a/packages/ui/src/mosaic/conditions.ts +++ b/packages/ui/src/mosaic/conditions.ts @@ -54,7 +54,7 @@ export function expandConditions(input: StyleRule): StyleRule { fastDeepMergeAndReplace(nest(chain, expanded), out); } else if (expanded && typeof expanded === 'object' && out[key] && typeof out[key] === 'object') { // A prior condition already expanded into this raw selector — merge rather than overwrite. - fastDeepMergeAndReplace(expanded, out[key] as StyleRule); + fastDeepMergeAndReplace(expanded, out[key]); } else { out[key] = expanded; }