Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

style: require @ imports and sort imports for studio/hooks (#44444)

Charis180ce515f601
diff --git a/apps/studio/hooks/analytics/useDbQuery.tsx b/apps/studio/hooks/analytics/useDbQuery.tsx
index d4a60c4dd1a..e37fe78bb68 100644
--- a/apps/studio/hooks/analytics/useDbQuery.tsx
+++ b/apps/studio/hooks/analytics/useDbQuery.tsx
@@ -1,15 +1,15 @@
import { useQuery } from '@tanstack/react-query'
-import { DEFAULT_QUERY_PARAMS } from 'components/interfaces/Reports/Reports.constants'
+import { DEFAULT_QUERY_PARAMS } from '@/components/interfaces/Reports/Reports.constants'
import {
BaseReportParams,
MetaQueryResponse,
ReportQuery,
-} from 'components/interfaces/Reports/Reports.types'
-import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
-import { executeSql } from 'data/sql/execute-sql-query'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
+} from '@/components/interfaces/Reports/Reports.types'
+import { useReadReplicasQuery } from '@/data/read-replicas/replicas-query'
+import { executeSql } from '@/data/sql/execute-sql-query'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { useDatabaseSelectorStateSnapshot } from '@/state/database-selector'
export interface DbQueryHook<T = any> {
isLoading: boolean
diff --git a/apps/studio/hooks/analytics/useFillTimeseriesSorted.ts b/apps/studio/hooks/analytics/useFillTimeseriesSorted.ts
index 70a6acaa8fa..662d71209f1 100644
--- a/apps/studio/hooks/analytics/useFillTimeseriesSorted.ts
+++ b/apps/studio/hooks/analytics/useFillTimeseriesSorted.ts
@@ -1,7 +1,8 @@
-import { fillTimeseries } from 'components/interfaces/Settings/Logs/Logs.utils'
-import type { Datum } from 'components/ui/Charts/Charts.types'
import { useMemo } from 'react'
+import { fillTimeseries } from '@/components/interfaces/Settings/Logs/Logs.utils'
+import type { Datum } from '@/components/ui/Charts/Charts.types'
+
export type FillTimeseriesOptions<T extends Datum = Datum> = {
/** The timeseries data to fill gaps in */
data: T[]
diff --git a/apps/studio/hooks/analytics/useLogsPreview.tsx b/apps/studio/hooks/analytics/useLogsPreview.tsx
index 84832205fba..1f402469bd9 100644
--- a/apps/studio/hooks/analytics/useLogsPreview.tsx
+++ b/apps/studio/hooks/analytics/useLogsPreview.tsx
@@ -1,9 +1,15 @@
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
+import dayjs from 'dayjs'
+import { useCallback, useMemo, useState } from 'react'
+
+import { useFillTimeseriesSorted } from './useFillTimeseriesSorted'
+import { useLogsUrlState } from './useLogsUrlState'
+import useTimeseriesUnixToIso from './useTimeseriesUnixToIso'
import {
+ getDefaultHelper,
LogsTableName,
PREVIEWER_DATEPICKER_HELPERS,
- getDefaultHelper,
-} from 'components/interfaces/Settings/Logs/Logs.constants'
+} from '@/components/interfaces/Settings/Logs/Logs.constants'
import type {
Count,
EventChart,
@@ -12,19 +18,13 @@ import type {
LogData,
Logs,
LogsEndpointParams,
-} from 'components/interfaces/Settings/Logs/Logs.types'
+} from '@/components/interfaces/Settings/Logs/Logs.types'
import {
genChartQuery,
genCountQuery,
genDefaultQuery,
-} from 'components/interfaces/Settings/Logs/Logs.utils'
-import { get } from 'data/fetchers'
-import dayjs from 'dayjs'
-import { useCallback, useMemo, useState } from 'react'
-
-import { useFillTimeseriesSorted } from './useFillTimeseriesSorted'
-import { useLogsUrlState } from './useLogsUrlState'
-import useTimeseriesUnixToIso from './useTimeseriesUnixToIso'
+} from '@/components/interfaces/Settings/Logs/Logs.utils'
+import { get } from '@/data/fetchers'
interface LogsPreviewHook {
logData: LogData[]
diff --git a/apps/studio/hooks/analytics/useLogsQuery.tsx b/apps/studio/hooks/analytics/useLogsQuery.tsx
index 363cbe9c81c..a5a6756b1c9 100644
--- a/apps/studio/hooks/analytics/useLogsQuery.tsx
+++ b/apps/studio/hooks/analytics/useLogsQuery.tsx
@@ -1,23 +1,23 @@
import { useQuery } from '@tanstack/react-query'
+import { IS_PLATFORM } from 'common'
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
-import { IS_PLATFORM } from 'common'
import {
EXPLORER_DATEPICKER_HELPERS,
getDefaultHelper,
-} from 'components/interfaces/Settings/Logs/Logs.constants'
+} from '@/components/interfaces/Settings/Logs/Logs.constants'
import type {
LogData,
Logs,
LogsEndpointParams,
-} from 'components/interfaces/Settings/Logs/Logs.types'
+} from '@/components/interfaces/Settings/Logs/Logs.types'
import {
checkForILIKEClause,
checkForWithClause,
-} from 'components/interfaces/Settings/Logs/Logs.utils'
-import { get } from 'data/fetchers'
-import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
-import { DOCS_URL } from 'lib/constants'
+} from '@/components/interfaces/Settings/Logs/Logs.utils'
+import { get } from '@/data/fetchers'
+import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
+import { DOCS_URL } from '@/lib/constants'
export interface LogsQueryHook {
params: LogsEndpointParams
diff --git a/apps/studio/hooks/analytics/useLogsUrlState.ts b/apps/studio/hooks/analytics/useLogsUrlState.ts
index 9817dfacc6f..ea3b670faad 100644
--- a/apps/studio/hooks/analytics/useLogsUrlState.ts
+++ b/apps/studio/hooks/analytics/useLogsUrlState.ts
@@ -1,6 +1,6 @@
import { createParser, useQueryState } from 'nuqs'
-import { Filters } from 'components/interfaces/Settings/Logs/Logs.types'
+import { Filters } from '@/components/interfaces/Settings/Logs/Logs.types'
interface LogsUrlState {
search: string
diff --git a/apps/studio/hooks/analytics/useProjectUsageStats.tsx b/apps/studio/hooks/analytics/useProjectUsageStats.tsx
index ddbbe4cab14..c4638726ef7 100644
--- a/apps/studio/hooks/analytics/useProjectUsageStats.tsx
+++ b/apps/studio/hooks/analytics/useProjectUsageStats.tsx
@@ -1,17 +1,17 @@
import { useQuery } from '@tanstack/react-query'
-import { LogsTableName } from 'components/interfaces/Settings/Logs/Logs.constants'
+import { useMemo } from 'react'
+
+import { useFillTimeseriesSorted } from './useFillTimeseriesSorted'
+import useTimeseriesUnixToIso from './useTimeseriesUnixToIso'
+import { LogsTableName } from '@/components/interfaces/Settings/Logs/Logs.constants'
import type {
EventChart,
EventChartData,
Filters,
LogsEndpointParams,
-} from 'components/interfaces/Settings/Logs/Logs.types'
-import { genChartQuery } from 'components/interfaces/Settings/Logs/Logs.utils'
-import { get } from 'data/fetchers'
-import { useMemo } from 'react'
-
-import { useFillTimeseriesSorted } from './useFillTimeseriesSorted'
-import useTimeseriesUnixToIso from './useTimeseriesUnixToIso'
+} from '@/components/interfaces/Settings/Logs/Logs.types'
+import { genChartQuery } from '@/components/interfaces/Settings/Logs/Logs.utils'
+import { get } from '@/data/fetchers'
interface ProjectUsageStatsHookResult {
error: string | Object | null
diff --git a/apps/studio/hooks/analytics/useSingleLog.tsx b/apps/studio/hooks/analytics/useSingleLog.tsx
index 03582882266..005a29cad06 100644
--- a/apps/studio/hooks/analytics/useSingleLog.tsx
+++ b/apps/studio/hooks/analytics/useSingleLog.tsx
@@ -1,14 +1,15 @@
import { useQuery } from '@tanstack/react-query'
-import { LOGS_TABLES } from 'components/interfaces/Settings/Logs/Logs.constants'
+
+import { LOGS_TABLES } from '@/components/interfaces/Settings/Logs/Logs.constants'
import type {
LogData,
Logs,
LogsEndpointParams,
QueryType,
-} from 'components/interfaces/Settings/Logs/Logs.types'
-import { genSingleLogQuery } from 'components/interfaces/Settings/Logs/Logs.utils'
-import { get } from 'data/fetchers'
-import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
+} from '@/components/interfaces/Settings/Logs/Logs.types'
+import { genSingleLogQuery } from '@/components/interfaces/Settings/Logs/Logs.utils'
+import { get } from '@/data/fetchers'
+import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
interface SingleLogHook {
data: LogData | undefined
diff --git a/apps/studio/hooks/analytics/useTimeseriesUnixToIso.ts b/apps/studio/hooks/analytics/useTimeseriesUnixToIso.ts
index 8b2304b4ac1..e4442bd7d92 100644
--- a/apps/studio/hooks/analytics/useTimeseriesUnixToIso.ts
+++ b/apps/studio/hooks/analytics/useTimeseriesUnixToIso.ts
@@ -1,8 +1,9 @@
+import { useMemo } from 'react'
+
import {
isUnixMicro,
unixMicroToIsoTimestamp,
-} from 'components/interfaces/Settings/Logs/Logs.utils'
-import { useMemo } from 'react'
+} from '@/components/interfaces/Settings/Logs/Logs.utils'
/**
* Convenience hook for converting timeseries timestamp from unix microsecond to iso
diff --git a/apps/studio/hooks/branches/useBranchMergeDiff.ts b/apps/studio/hooks/branches/useBranchMergeDiff.ts
index 4fc167c40d5..58f9b026eb3 100644
--- a/apps/studio/hooks/branches/useBranchMergeDiff.ts
+++ b/apps/studio/hooks/branches/useBranchMergeDiff.ts
@@ -1,8 +1,9 @@
-import { useIsPgDeltaDiffEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
-import { useBranchDiffQuery } from 'data/branches/branch-diff-query'
-import { useMigrationsQuery } from 'data/database/migrations-query'
import { useMemo } from 'react'
+
import { useEdgeFunctionsDiff, type EdgeFunctionsDiffResult } from './useEdgeFunctionsDiff'
+import { useIsPgDeltaDiffEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useBranchDiffQuery } from '@/data/branches/branch-diff-query'
+import { useMigrationsQuery } from '@/data/database/migrations-query'
interface UseBranchMergeDiffProps {
currentBranchRef?: string
diff --git a/apps/studio/hooks/branches/useEdgeFunctionsDiff.ts b/apps/studio/hooks/branches/useEdgeFunctionsDiff.ts
index c61cbc2c469..a785c080ec9 100644
--- a/apps/studio/hooks/branches/useEdgeFunctionsDiff.ts
+++ b/apps/studio/hooks/branches/useEdgeFunctionsDiff.ts
@@ -1,16 +1,17 @@
+import { basename } from 'path'
import { useQueries, useQueryClient } from '@tanstack/react-query'
+import { useCallback, useMemo } from 'react'
+
import {
getEdgeFunctionBody,
type EdgeFunctionBodyData,
-} from 'data/edge-functions/edge-function-body-query'
+} from '@/data/edge-functions/edge-function-body-query'
import {
useEdgeFunctionsQuery,
type EdgeFunctionsData,
-} from 'data/edge-functions/edge-functions-query'
-import { edgeFunctionsKeys } from 'data/edge-functions/keys'
-import { handleError } from 'data/fetchers'
-import { basename } from 'path'
-import { useCallback, useMemo } from 'react'
+} from '@/data/edge-functions/edge-functions-query'
+import { edgeFunctionsKeys } from '@/data/edge-functions/keys'
+import { handleError } from '@/data/fetchers'
interface UseEdgeFunctionsDiffProps {
currentBranchRef?: string
diff --git a/apps/studio/hooks/custom-content/useCustomContent.test.ts b/apps/studio/hooks/custom-content/useCustomContent.test.ts
index e6ca936f758..043488906ec 100644
--- a/apps/studio/hooks/custom-content/useCustomContent.test.ts
+++ b/apps/studio/hooks/custom-content/useCustomContent.test.ts
@@ -1,4 +1,4 @@
-import { renderHook, cleanup } from '@testing-library/react'
+import { cleanup, renderHook } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
beforeEach(() => {
diff --git a/apps/studio/hooks/forms/useAIOptInForm.ts b/apps/studio/hooks/forms/useAIOptInForm.ts
index 92d88bacd9b..57361a16f26 100644
--- a/apps/studio/hooks/forms/useAIOptInForm.ts
+++ b/apps/studio/hooks/forms/useAIOptInForm.ts
@@ -2,18 +2,19 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useQueryClient } from '@tanstack/react-query'
import { LOCAL_STORAGE_KEYS } from 'common'
-import { useOrganizationUpdateMutation } from 'data/organizations/organization-update-mutation'
-import { invalidateOrganizationsQuery } from 'data/organizations/organizations-query'
-import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
-import { getAiOptInLevel } from 'hooks/misc/useOrgOptedIntoAi'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { OPT_IN_TAGS } from 'lib/constants'
import { useForm } from 'react-hook-form'
import { toast } from 'sonner'
-import type { ResponseError } from 'types'
import * as z from 'zod'
+import { useOrganizationUpdateMutation } from '@/data/organizations/organization-update-mutation'
+import { invalidateOrganizationsQuery } from '@/data/organizations/organizations-query'
+import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
+import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
+import { getAiOptInLevel } from '@/hooks/misc/useOrgOptedIntoAi'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
+import { OPT_IN_TAGS } from '@/lib/constants'
+import type { ResponseError } from '@/types'
+
// Shared schema definition
export const AIOptInSchema = z.object({
aiOptInLevel: z.enum(['disabled', 'schema', 'schema_and_log', 'schema_and_log_and_data'], {
diff --git a/apps/studio/hooks/misc/useCheckEntitlements.ts b/apps/studio/hooks/misc/useCheckEntitlements.ts
index 2c67d235243..881e77886e1 100644
--- a/apps/studio/hooks/misc/useCheckEntitlements.ts
+++ b/apps/studio/hooks/misc/useCheckEntitlements.ts
@@ -1,13 +1,14 @@
+import { useCallback, useMemo } from 'react'
+
+import { useSelectedOrganizationQuery } from './useSelectedOrganization'
import type {
Entitlement,
EntitlementConfig,
EntitlementType,
FeatureKey,
-} from 'data/entitlements/entitlements-query'
-import { useEntitlementsQuery } from 'data/entitlements/entitlements-query'
-import { IS_PLATFORM } from 'lib/constants'
-import { useCallback, useMemo } from 'react'
-import { useSelectedOrganizationQuery } from './useSelectedOrganization'
+} from '@/data/entitlements/entitlements-query'
+import { useEntitlementsQuery } from '@/data/entitlements/entitlements-query'
+import { IS_PLATFORM } from '@/lib/constants'
function isNumericConfig(
config: EntitlementConfig,
diff --git a/apps/studio/hooks/misc/useCheckPermissions.ts b/apps/studio/hooks/misc/useCheckPermissions.ts
index 8e76bea5845..5d77713a96a 100644
--- a/apps/studio/hooks/misc/useCheckPermissions.ts
+++ b/apps/studio/hooks/misc/useCheckPermissions.ts
@@ -1,12 +1,12 @@
+import { useIsLoggedIn, useParams } from 'common'
import jsonLogic from 'json-logic-js'
import { useMemo } from 'react'
-import { useIsLoggedIn, useParams } from 'common'
-import { usePermissionsQuery } from 'data/permissions/permissions-query'
-import { IS_PLATFORM } from 'lib/constants'
-import type { Permission } from 'types'
import { useSelectedOrganizationQuery } from './useSelectedOrganization'
import { useSelectedProjectQuery } from './useSelectedProject'
+import { usePermissionsQuery } from '@/data/permissions/permissions-query'
+import { IS_PLATFORM } from '@/lib/constants'
+import type { Permission } from '@/types'
const toRegexpString = (actionOrResource: string) =>
`^${actionOrResource.replace('.', '\\.').replace('%', '.*')}$`
diff --git a/apps/studio/hooks/misc/useCustomAccessTokenHookDetails.tsx b/apps/studio/hooks/misc/useCustomAccessTokenHookDetails.tsx
index 249412b31f0..8770d2d1e5a 100644
--- a/apps/studio/hooks/misc/useCustomAccessTokenHookDetails.tsx
+++ b/apps/studio/hooks/misc/useCustomAccessTokenHookDetails.tsx
@@ -1,7 +1,8 @@
-import { extractMethod } from 'components/interfaces/Auth/Hooks/hooks.utils'
-import { AuthConfigResponse, useAuthConfigQuery } from 'data/auth/auth-config-query'
import { useMemo } from 'react'
+import { extractMethod } from '@/components/interfaces/Auth/Hooks/hooks.utils'
+import { AuthConfigResponse, useAuthConfigQuery } from '@/data/auth/auth-config-query'
+
function authConfigToCustomAccessTokenHookDetails(authConfig?: AuthConfigResponse) {
if (!authConfig || !authConfig.HOOK_CUSTOM_ACCESS_TOKEN_ENABLED) {
return undefined
diff --git a/apps/studio/hooks/misc/useDashboardHistory.ts b/apps/studio/hooks/misc/useDashboardHistory.ts
index 11da087ace1..34788e18d7f 100644
--- a/apps/studio/hooks/misc/useDashboardHistory.ts
+++ b/apps/studio/hooks/misc/useDashboardHistory.ts
@@ -1,4 +1,5 @@
import { LOCAL_STORAGE_KEYS, useParams } from 'common'
+
import { useLocalStorageQuery } from './useLocalStorage'
type DashboardHistory = { editor?: string; sql?: string }
diff --git a/apps/studio/hooks/misc/useInfiniteScroll.ts b/apps/studio/hooks/misc/useInfiniteScroll.ts
index 0804a8e1308..89ccfb75f02 100644
--- a/apps/studio/hooks/misc/useInfiniteScroll.ts
+++ b/apps/studio/hooks/misc/useInfiniteScroll.ts
@@ -1,6 +1,7 @@
-import { isAtBottom } from 'lib/helpers'
import { UIEvent, useCallback, useRef } from 'react'
+import { isAtBottom } from '@/lib/helpers'
+
interface UseInfiniteScrollOptions {
isLoading?: boolean
isFetchingNextPage?: boolean
diff --git a/apps/studio/hooks/misc/useIsFeatureEnabled.ts b/apps/studio/hooks/misc/useIsFeatureEnabled.ts
index 6811deba42c..44449d21758 100644
--- a/apps/studio/hooks/misc/useIsFeatureEnabled.ts
+++ b/apps/studio/hooks/misc/useIsFeatureEnabled.ts
@@ -1,5 +1,6 @@
import { isFeatureEnabled, type Feature } from 'common'
-import { useProfile } from 'lib/profile'
+
+import { useProfile } from '@/lib/profile'
function useIsFeatureEnabled<T extends Feature[]>(
features: T
diff --git a/apps/studio/hooks/misc/useIsSchemaExposed.ts b/apps/studio/hooks/misc/useIsSchemaExposed.ts
index 1d4b6c777fa..feed1b4a948 100644
--- a/apps/studio/hooks/misc/useIsSchemaExposed.ts
+++ b/apps/studio/hooks/misc/useIsSchemaExposed.ts
@@ -3,7 +3,7 @@ import { useMemo } from 'react'
import {
parseDbSchemaString,
useProjectPostgrestConfigQuery,
-} from 'data/config/project-postgrest-config-query'
+} from '@/data/config/project-postgrest-config-query'
type UseIsSchemaExposedParams = {
projectRef?: string
diff --git a/apps/studio/hooks/misc/useLastSignIn.ts b/apps/studio/hooks/misc/useLastSignIn.ts
index e71f7cb8262..01715542698 100644
--- a/apps/studio/hooks/misc/useLastSignIn.ts
+++ b/apps/studio/hooks/misc/useLastSignIn.ts
@@ -1,4 +1,5 @@
import { LOCAL_STORAGE_KEYS } from 'common'
+
import { useLocalStorage } from './useLocalStorage'
export type LastSignInType = 'github' | 'email' | 'sso' | null
diff --git a/apps/studio/hooks/misc/useLints.ts b/apps/studio/hooks/misc/useLints.ts
index f6564437ae2..42f8cb3ffcb 100644
--- a/apps/studio/hooks/misc/useLints.ts
+++ b/apps/studio/hooks/misc/useLints.ts
@@ -1,5 +1,6 @@
import { useParams } from 'common'
-import { useProjectLintsQuery } from 'data/lint/lint-query'
+
+import { useProjectLintsQuery } from '@/data/lint/lint-query'
/**
* Hook to fetch and filter project lints
diff --git a/apps/studio/hooks/misc/useOrgOptedIntoAi.ts b/apps/studio/hooks/misc/useOrgOptedIntoAi.ts
index ac10c5a6a7e..00ba0a91862 100644
--- a/apps/studio/hooks/misc/useOrgOptedIntoAi.ts
+++ b/apps/studio/hooks/misc/useOrgOptedIntoAi.ts
@@ -1,11 +1,11 @@
import { z } from 'zod'
-import { subscriptionHasHipaaAddon } from 'components/interfaces/Billing/Subscription/Subscription.utils'
-import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
-import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { IS_PLATFORM, OPT_IN_TAGS } from 'lib/constants'
+import { subscriptionHasHipaaAddon } from '@/components/interfaces/Billing/Subscription/Subscription.utils'
+import { useProjectSettingsV2Query } from '@/data/config/project-settings-v2-query'
+import { useOrgSubscriptionQuery } from '@/data/subscriptions/org-subscription-query'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { IS_PLATFORM, OPT_IN_TAGS } from '@/lib/constants'
export const aiOptInLevelSchema = z.enum([
'disabled',
diff --git a/apps/studio/hooks/misc/useOrganizationRestrictions.ts b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
index 510cd12b9ac..af1d892af20 100644
--- a/apps/studio/hooks/misc/useOrganizationRestrictions.ts
+++ b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
@@ -1,11 +1,11 @@
import dayjs from 'dayjs'
import type { ReactNode } from 'react'
-import { RESTRICTION_MESSAGES } from 'components/interfaces/Organization/restriction.constants'
-import { useOverdueInvoicesQuery } from 'data/invoices/invoices-overdue-query'
-import { useOrganizationsQuery } from 'data/organizations/organizations-query'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { useIsFeatureEnabled } from './useIsFeatureEnabled'
+import { RESTRICTION_MESSAGES } from '@/components/interfaces/Organization/restriction.constants'
+import { useOverdueInvoicesQuery } from '@/data/invoices/invoices-overdue-query'
+import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
export type WarningBannerProps = {
variant: 'danger' | 'warning' | 'note'
diff --git a/apps/studio/hooks/misc/useReportDateRange.ts b/apps/studio/hooks/misc/useReportDateRange.ts
index 63c50248dc6..73b4690f029 100644
--- a/apps/studio/hooks/misc/useReportDateRange.ts
+++ b/apps/studio/hooks/misc/useReportDateRange.ts
@@ -1,16 +1,17 @@
+import dayjs from 'dayjs'
+import { createParser, useQueryState } from 'nuqs'
+import { useCallback, useMemo, useState } from 'react'
+
import {
REPORT_DATERANGE_HELPER_LABELS,
REPORTS_DATEPICKER_HELPERS,
ReportsDatetimeHelper,
-} from 'components/interfaces/Reports/Reports.constants'
-import { DatePickerValue } from 'components/interfaces/Settings/Logs/Logs.DatePickers'
-import { maybeShowUpgradePromptIfNotEntitled } from 'components/interfaces/Settings/Logs/Logs.utils'
-import { AnalyticsInterval } from 'data/analytics/constants'
-import dayjs from 'dayjs'
-import { useCheckEntitlements } from 'hooks/misc/useCheckEntitlements'
-import { useCurrentOrgPlan } from 'hooks/misc/useCurrentOrgPlan'
-import { createParser, useQueryState } from 'nuqs'
-import { useCallback, useMemo, useState } from 'react'
+} from '@/components/interfaces/Reports/Reports.constants'
+import { DatePickerValue } from '@/components/interfaces/Settings/Logs/Logs.DatePickers'
+import { maybeShowUpgradePromptIfNotEntitled } from '@/components/interfaces/Settings/Logs/Logs.utils'
+import { AnalyticsInterval } from '@/data/analytics/constants'
+import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'
+import { useCurrentOrgPlan } from '@/hooks/misc/useCurrentOrgPlan'
export const getIntervalGranularity = (from: string, to: string): AnalyticsInterval => {
const diffInDays = dayjs(to).diff(from, 'day', true)
diff --git a/apps/studio/hooks/misc/useSchemasForAi.ts b/apps/studio/hooks/misc/useSchemasForAi.ts
index 5f32ccea672..6bc31602c38 100644
--- a/apps/studio/hooks/misc/useSchemasForAi.ts
+++ b/apps/studio/hooks/misc/useSchemasForAi.ts
@@ -1,7 +1,8 @@
import { LOCAL_STORAGE_KEYS } from 'common'
-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { Dispatch, SetStateAction } from 'react'
+import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
+
/**
* Returns which schemas are ok to be sent to AI.
*/
diff --git a/apps/studio/hooks/misc/useSelectedOrganization.ts b/apps/studio/hooks/misc/useSelectedOrganization.ts
index f7b1c4e7402..b44e3755511 100644
--- a/apps/studio/hooks/misc/useSelectedOrganization.ts
+++ b/apps/studio/hooks/misc/useSelectedOrganization.ts
@@ -1,6 +1,7 @@
import { useIsLoggedIn, useParams } from 'common'
-import { useOrganizationsQuery } from 'data/organizations/organizations-query'
-import { useProjectDetailQuery } from 'data/projects/project-detail-query'
+
+import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
+import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
export function useSelectedOrganizationQuery({ enabled = true } = {}) {
const isLoggedIn = useIsLoggedIn()
diff --git a/apps/studio/hooks/misc/useSelectedProject.ts b/apps/studio/hooks/misc/useSelectedProject.ts
index 48e208b939b..4ea95bc0a8b 100644
--- a/apps/studio/hooks/misc/useSelectedProject.ts
+++ b/apps/studio/hooks/misc/useSelectedProject.ts
@@ -1,6 +1,7 @@
import { useParams } from 'common'
-import { useProjectDetailQuery } from 'data/projects/project-detail-query'
-import { PROJECT_STATUS, PROVIDERS } from 'lib/constants'
+
+import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
+import { PROJECT_STATUS, PROVIDERS } from '@/lib/constants'
export function useSelectedProjectQuery({ enabled = true } = {}) {
const { ref } = useParams()
diff --git a/apps/studio/hooks/misc/useStudioCommandMenuTelemetry.ts b/apps/studio/hooks/misc/useStudioCommandMenuTelemetry.ts
index 922679e85b4..86aa1dd91c1 100644
--- a/apps/studio/hooks/misc/useStudioCommandMenuTelemetry.ts
+++ b/apps/studio/hooks/misc/useStudioCommandMenuTelemetry.ts
@@ -1,14 +1,14 @@
-import { useCallback } from 'react'
-
import { useParams } from 'common'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import type {
CommandMenuClosedEvent,
CommandMenuCommandClickedEvent,
CommandMenuOpenedEvent,
CommandMenuSearchSubmittedEvent,
} from 'common/telemetry-constants'
+import { useCallback } from 'react'
+
+import { useSendEventMutation } from '@/data/telemetry/send-event-mutation'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
export function useStudioCommandMenuTelemetry() {
const { ref: projectRef } = useParams()
diff --git a/apps/studio/hooks/misc/useTableEditorFiltersSort.test.ts b/apps/studio/hooks/misc/useTableEditorFiltersSort.test.ts
index 7e41d580e29..bd12380c08d 100644
--- a/apps/studio/hooks/misc/useTableEditorFiltersSort.test.ts
+++ b/apps/studio/hooks/misc/useTableEditorFiltersSort.test.ts
@@ -2,6 +2,7 @@ import { renderHook } from '@testing-library/react'
import { useRouter } from 'next/router'
import { withNuqsTestingAdapter } from 'nuqs/adapters/testing'
import { beforeAll, describe, expect, it, vi } from 'vitest'
+
import { useTableEditorFiltersSort } from './useTableEditorFiltersSort'
beforeAll(() => {
diff --git a/apps/studio/hooks/misc/useUpgradePrompt.tsx b/apps/studio/hooks/misc/useUpgradePrompt.tsx
index a6126f9a3ef..df6b6b00402 100644
--- a/apps/studio/hooks/misc/useUpgradePrompt.tsx
+++ b/apps/studio/hooks/misc/useUpgradePrompt.tsx
@@ -1,6 +1,7 @@
-import { maybeShowUpgradePromptIfNotEntitled } from 'components/interfaces/Settings/Logs/Logs.utils'
import { useEffect, useState } from 'react'
+
import { useCheckEntitlements } from './useCheckEntitlements'
+import { maybeShowUpgradePromptIfNotEntitled } from '@/components/interfaces/Settings/Logs/Logs.utils'
export const useUpgradePrompt = (from: string) => {
const [showUpgradePrompt, setShowUpgradePrompt] = useState(false)
diff --git a/apps/studio/hooks/misc/withAuth.tsx b/apps/studio/hooks/misc/withAuth.tsx
index bf5712eb27f..0088f9f9a08 100644
--- a/apps/studio/hooks/misc/withAuth.tsx
+++ b/apps/studio/hooks/misc/withAuth.tsx
@@ -1,13 +1,14 @@
import { useAuth } from 'common'
-import { SessionTimeoutModal } from 'components/interfaces/SignIn/SessionTimeoutModal'
-import { usePermissionsQuery } from 'data/permissions/permissions-query'
-import { useAuthenticatorAssuranceLevelQuery } from 'data/profile/mfa-authenticator-assurance-level-query'
-import { useSignOut } from 'lib/auth'
-import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
import { useRouter } from 'next/router'
import { ComponentType, useCallback, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
-import { isNextPageWithLayout, type NextPageWithLayout } from 'types'
+
+import { SessionTimeoutModal } from '@/components/interfaces/SignIn/SessionTimeoutModal'
+import { usePermissionsQuery } from '@/data/permissions/permissions-query'
+import { useAuthenticatorAssuranceLevelQuery } from '@/data/profile/mfa-authenticator-assurance-level-query'
+import { useSignOut } from '@/lib/auth'
+import { BASE_PATH, IS_PLATFORM } from '@/lib/constants'
+import { isNextPageWithLayout, type NextPageWithLayout } from '@/types'
const MAX_TIMEOUT = 10000 // 10 seconds
diff --git a/apps/studio/hooks/ui/useConfirmOnClose.tsx b/apps/studio/hooks/ui/useConfirmOnClose.tsx
index ecf8efbcee1..7e19dc2a61b 100644
--- a/apps/studio/hooks/ui/useConfirmOnClose.tsx
+++ b/apps/studio/hooks/ui/useConfirmOnClose.tsx
@@ -1,4 +1,5 @@
import { useCallback, useMemo, useState } from 'react'
+
import useLatest from '../misc/useLatest'
export interface ConfirmOnCloseModalProps {
diff --git a/apps/studio/hooks/ui/useCsvFileDrop.ts b/apps/studio/hooks/ui/useCsvFileDrop.ts
index 26119d23135..549be2126a7 100644
--- a/apps/studio/hooks/ui/useCsvFileDrop.ts
+++ b/apps/studio/hooks/ui/useCsvFileDrop.ts
@@ -1,7 +1,8 @@
import { type ImportDataFileDroppedEvent } from 'common/telemetry-constants'
-import { flagInvalidFileImport } from 'components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.utils'
import { useCallback, useState, type DragEvent } from 'react'
+import { flagInvalidFileImport } from '@/components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.utils'
+
interface UseCsvFileDropOptions {
enabled: boolean
onFileDropped: (file: File) => void
diff --git a/apps/studio/hooks/ui/useFlag.ts b/apps/studio/hooks/ui/useFlag.ts
index 3a72a29d848..7957d542006 100644
--- a/apps/studio/hooks/ui/useFlag.ts
+++ b/apps/studio/hooks/ui/useFlag.ts
@@ -1,7 +1,8 @@
import * as Sentry from '@sentry/nextjs'
import { IS_PLATFORM, useFeatureFlags } from 'common'
-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
-import { trackFeatureFlag } from 'lib/posthog'
+
+import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
+import { trackFeatureFlag } from '@/lib/posthog'
const isObjectEmpty = (obj: Object) => {
return Object.keys(obj).length === 0
diff --git a/apps/studio/hooks/ui/useUrlState.ts b/apps/studio/hooks/ui/useUrlState.ts
index 30af2d8a2bf..919b5f2a843 100644
--- a/apps/studio/hooks/ui/useUrlState.ts
+++ b/apps/studio/hooks/ui/useUrlState.ts
@@ -1,6 +1,7 @@
-import useLatest from 'hooks/misc/useLatest'
import { useRouter } from 'next/router'
-import { type Dispatch, type SetStateAction, useCallback, useMemo } from 'react'
+import { useCallback, useMemo, type Dispatch, type SetStateAction } from 'react'
+
+import useLatest from '@/hooks/misc/useLatest'
export type UrlStateParams = {
[k: string]: string | string[] | undefined
diff --git a/apps/studio/hooks/use-check-latest-deploy.tsx b/apps/studio/hooks/use-check-latest-deploy.tsx
index fe19496d035..dbd0fa0f4c5 100644
--- a/apps/studio/hooks/use-check-latest-deploy.tsx
+++ b/apps/studio/hooks/use-check-latest-deploy.tsx
@@ -1,11 +1,12 @@
import { IS_PLATFORM } from 'common'
-import { useDeploymentCommitQuery } from 'data/utils/deployment-commit-query'
import dayjs from 'dayjs'
import { useRouter } from 'next/router'
import { useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
import { Button, StatusIcon } from 'ui'
+import { useDeploymentCommitQuery } from '@/data/utils/deployment-commit-query'
+
const DeployCheckToast = ({ id }: { id: string | number }) => {
const router = useRouter()
diff --git a/apps/studio/hooks/useProtectedSchemas.ts b/apps/studio/hooks/useProtectedSchemas.ts
index 4d72705d697..a2b898918eb 100644
--- a/apps/studio/hooks/useProtectedSchemas.ts
+++ b/apps/studio/hooks/useProtectedSchemas.ts
@@ -1,17 +1,17 @@
import { QUEUES_SCHEMA } from '@supabase/pg-meta'
+import { uniq, uniqBy } from 'lodash'
+import { useMemo } from 'react'
+
+import { useSelectedProjectQuery } from './misc/useSelectedProject'
import {
SUPABASE_TARGET_SCHEMA_OPTION,
WRAPPERS,
-} from 'components/interfaces/Integrations/Wrappers/Wrappers.constants'
+} from '@/components/interfaces/Integrations/Wrappers/Wrappers.constants'
import {
convertKVStringArrayToJson,
wrapperMetaComparator,
-} from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
-import { useFDWsQuery } from 'data/fdw/fdws-query'
-import { uniq, uniqBy } from 'lodash'
-import { useMemo } from 'react'
-
-import { useSelectedProjectQuery } from './misc/useSelectedProject'
+} from '@/components/interfaces/Integrations/Wrappers/Wrappers.utils'
+import { useFDWsQuery } from '@/data/fdw/fdws-query'
/**
* A list of system schemas that users should not interact with
diff --git a/prettier.config.mjs b/prettier.config.mjs
index 3b1892de864..3c6c58a505a 100644
--- a/prettier.config.mjs
+++ b/prettier.config.mjs
@@ -28,7 +28,7 @@ if (process.env.SORT_IMPORTS !== 'false') {
options = { ...options, ...sortImportsOptions }
} else {
options.overrides.push({
- files: 'apps/studio/components/**/*.{js,jsx,ts,tsx}',
+ files: 'apps/studio/{components,hooks}/**/*.{js,jsx,ts,tsx}',
options: sortImportsOptions,
})
}