Browse Source

perf: reduce barrel file usages (#71158)

Reduces the barrel file usages across the repository. Instead of
`sentry/types`, this PR replaces ~100 usages with `sentry/types/XXXX`

Remaining usages:

```
Checked 5505 files in 834ms. No fixes needed.
Found 776 errors.
```
Yagiz Nizipli 9 months ago
parent
commit
430df91671

+ 1 - 1
static/app/chartcuterie/performance.tsx

@@ -3,7 +3,7 @@ import {transformToLineSeries} from 'sentry/components/charts/lineChart';
 import getBreakpointChartOptionsFromData, {
   type EventBreakpointChartData,
 } from 'sentry/components/events/eventStatisticalDetector/breakpointChartOptions';
-import type {EventsStatsSeries} from 'sentry/types';
+import type {EventsStatsSeries} from 'sentry/types/organization';
 import {transformStatsResponse} from 'sentry/utils/profiling/hooks/utils';
 import {lightTheme as theme} from 'sentry/utils/theme';
 import type {NormalizedTrendsTransaction} from 'sentry/views/performance/trends/types';

+ 2 - 1
static/app/components/assigneeBadge.stories.tsx

@@ -3,7 +3,8 @@ import {uuid4} from '@sentry/utils';
 
 import {AssigneeBadge} from 'sentry/components/assigneeBadge';
 import storyBook from 'sentry/stories/storyBook';
-import type {Actor, Team} from 'sentry/types';
+import type {Actor} from 'sentry/types/core';
+import type {Team} from 'sentry/types/organization';
 import {useUser} from 'sentry/utils/useUser';
 import {useUserTeams} from 'sentry/utils/useUserTeams';
 

+ 2 - 1
static/app/components/assigneeBadge.tsx

@@ -10,7 +10,8 @@ import Placeholder from 'sentry/components/placeholder';
 import {Tooltip} from 'sentry/components/tooltip';
 import {t, tct} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import type {Actor, SuggestedOwnerReason} from 'sentry/types';
+import type {Actor} from 'sentry/types/core';
+import type {SuggestedOwnerReason} from 'sentry/types/group';
 import {lightTheme as theme} from 'sentry/utils/theme';
 
 type AssigneeBadgeProps = {

+ 1 - 1
static/app/components/assistant/getGuidesContent.tsx

@@ -3,7 +3,7 @@ import ExternalLink from 'sentry/components/links/externalLink';
 import Link from 'sentry/components/links/link';
 import {t, tct} from 'sentry/locale';
 import ConfigStore from 'sentry/stores/configStore';
-import type {Organization} from 'sentry/types';
+import type {Organization} from 'sentry/types/organization';
 
 export default function getGuidesContent(
   organization: Organization | null

+ 1 - 1
static/app/components/charts/optionSelector.tsx

@@ -85,10 +85,10 @@ function OptionSelector({
   function isOptionDisabled(option) {
     return (
       // Option is explicitly marked as disabled
-      option.disabled ||
       // The user has reached the maximum number of selections (3), and the option hasn't
       // yet been selected. These options should be disabled to visually indicate that the
       // user has reached the max.
+      option.disabled ||
       (multiple && selected.length === 3 && !selected.includes(option.value))
     );
   }

+ 1 - 1
static/app/components/events/interfaces/crashContent/exception/utils.tsx

@@ -21,10 +21,10 @@ export function isFrameFilenamePathlike(frame: Frame): boolean {
 
   return (
     // If all filenames are anonymous, we do not want to show this alert
+    // If all absolute paths do not have a file extension, we do not want to show this alert
     (frame.filename === '<anonymous>' && frame.inApp) ||
     // If all function names are on the blocklist, we do not want to show this alert
     fileNameBlocklist.includes(frame.function ?? '') ||
-    // If all absolute paths do not have a file extension, we do not want to show this alert
     (!!frame.absPath && !getFileExtension(filename))
   );
 }

+ 1 - 1
static/app/components/feedback/feedbackItem/feedbackActivitySection.tsx

@@ -5,8 +5,8 @@ import useFeedbackCache from 'sentry/components/feedback/useFeedbackCache';
 import useMutateActivity from 'sentry/components/feedback/useMutateActivity';
 import {t} from 'sentry/locale';
 import type {Group, GroupActivity, GroupActivityNote, User} from 'sentry/types';
-import {GroupActivityType} from 'sentry/types';
 import type {NoteType} from 'sentry/types/alerts';
+import {GroupActivityType} from 'sentry/types/group';
 import type {FeedbackIssue} from 'sentry/utils/feedback/types';
 import {uniqueId} from 'sentry/utils/guid';
 import useOrganization from 'sentry/utils/useOrganization';

+ 1 - 1
static/app/components/modals/inviteMembersModal/useInviteModal.tsx

@@ -5,7 +5,7 @@ import type {
   NormalizedInvite,
 } from 'sentry/components/modals/inviteMembersModal/types';
 import {t} from 'sentry/locale';
-import type {Member, Organization} from 'sentry/types';
+import type {Member, Organization} from 'sentry/types/organization';
 import {trackAnalytics} from 'sentry/utils/analytics';
 import {uniqueId} from 'sentry/utils/guid';
 import {useApiQuery} from 'sentry/utils/queryClient';

+ 1 - 1
static/app/components/onboardingWizard/taskConfig.tsx

@@ -18,7 +18,7 @@ import type {
   Organization,
   Project,
 } from 'sentry/types';
-import {OnboardingTaskKey} from 'sentry/types';
+import {OnboardingTaskKey} from 'sentry/types/onboarding';
 import {isDemoWalkthrough} from 'sentry/utils/demoMode';
 import EventWaiter from 'sentry/utils/eventWaiter';
 import withApi from 'sentry/utils/withApi';

+ 1 - 1
static/app/components/organizations/pageFilters/pageFilterPinIndicator.tsx

@@ -3,7 +3,7 @@ import styled from '@emotion/styled';
 import {IconLock} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import type {PinnedPageFilter} from 'sentry/types';
+import type {PinnedPageFilter} from 'sentry/types/core';
 import usePageFilters from 'sentry/utils/usePageFilters';
 
 type Props = {

Some files were not shown because too many files changed in this diff