Skip to content

Commit

Permalink
ref(rr6): Vendor legacy react-router 3 types
Browse files Browse the repository at this point in the history
This will help us rip out react router 3.
  • Loading branch information
evanpurkhiser committed Aug 27, 2024
1 parent f6006f6 commit 3de43da
Show file tree
Hide file tree
Showing 263 changed files with 407 additions and 329 deletions.
3 changes: 1 addition & 2 deletions static/app/actionCreators/navigation.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type {InjectedRouter} from 'react-router';

import {initializeOrg} from 'sentry-test/initializeOrg';

import {openModal} from 'sentry/actionCreators/modal';
import {navigateTo} from 'sentry/actionCreators/navigation';
import ConfigStore from 'sentry/stores/configStore';
import ProjectsStore from 'sentry/stores/projectsStore';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import type {Config} from 'sentry/types/system';

jest.mock('sentry/actionCreators/modal');
Expand Down
2 changes: 1 addition & 1 deletion static/app/actionCreators/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {InjectedRouter} from 'react-router';
import type {Location} from 'history';

import {openModal} from 'sentry/actionCreators/modal';
import ContextPickerModal from 'sentry/components/contextPickerModal';
import ProjectsStore from 'sentry/stores/projectsStore';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import replaceRouterParams from 'sentry/utils/replaceRouterParams';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';

Expand Down
2 changes: 1 addition & 1 deletion static/app/actionCreators/pageFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type {InjectedRouter} from 'react-router';
import * as Sentry from '@sentry/react';
import type {Location} from 'history';
import isInteger from 'lodash/isInteger';
Expand All @@ -24,6 +23,7 @@ import {
import OrganizationStore from 'sentry/stores/organizationStore';
import PageFiltersStore from 'sentry/stores/pageFiltersStore';
import type {DateString, PageFilters, PinnedPageFilter} from 'sentry/types/core';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import type {Environment, MinimalProject, Project} from 'sentry/types/project';
import {defined} from 'sentry/utils';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/asyncComponentSearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component} from 'react';
import type {WithRouterProps} from 'react-router';
import styled from '@emotion/styled';
import debounce from 'lodash/debounce';

import type {Client, ResponseMeta} from 'sentry/api';
import Input from 'sentry/components/input';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import {t} from 'sentry/locale';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
// eslint-disable-next-line no-restricted-imports
import withSentryRouter from 'sentry/utils/withSentryRouter';

Expand Down
2 changes: 1 addition & 1 deletion static/app/components/charts/chartZoom.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from 'react';
import type {InjectedRouter} from 'react-router';
import type {
DataZoomComponentOption,
InsideDataZoomComponentOption,
Expand All @@ -20,6 +19,7 @@ import type {
EChartFinishedHandler,
EChartRestoreHandler,
} from 'sentry/types/echarts';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import {getUtcDateString, getUtcToLocalDateObject} from 'sentry/utils/dates';

const getDate = date =>
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/charts/eventsChart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component, isValidElement} from 'react';
import type {InjectedRouter} from 'react-router';
import type {Theme} from '@emotion/react';
import {withTheme} from '@emotion/react';
import type {
Expand Down Expand Up @@ -30,6 +29,7 @@ import {IconWarning} from 'sentry/icons';
import {t} from 'sentry/locale';
import type {DateString} from 'sentry/types/core';
import type {Series} from 'sentry/types/echarts';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import type {OrganizationSummary} from 'sentry/types/organization';
import {defined} from 'sentry/utils';
import {
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/charts/releaseSeries.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from 'react';
import type {WithRouterProps} from 'react-router';
import type {Theme} from '@emotion/react';
import {withTheme} from '@emotion/react';
import type {Query} from 'history';
Expand All @@ -13,6 +12,7 @@ import MarkLine from 'sentry/components/charts/components/markLine';
import {t} from 'sentry/locale';
import type {DateString} from 'sentry/types/core';
import type {Series} from 'sentry/types/echarts';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import {escape} from 'sentry/utils';
import {getFormattedDate, getUtcDateString} from 'sentry/utils/dates';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/charts/useChartZoom.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {useCallback, useMemo, useState} from 'react';
import type {InjectedRouter} from 'react-router';
import type {
DataZoomComponentOption,
InsideDataZoomComponentOption,
Expand All @@ -20,6 +19,7 @@ import type {
EChartFinishedHandler,
EChartRestoreHandler,
} from 'sentry/types/echarts';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import {getUtcDateString, getUtcToLocalDateObject} from 'sentry/utils/dates';

// TODO: replace usages of ChartZoom with useChartZoom
Expand Down
5 changes: 4 additions & 1 deletion static/app/components/deprecatedAsyncComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from 'react';
import type {RouteComponentProps, RouteContextInterface} from 'react-router';
import * as Sentry from '@sentry/react';
import isEqual from 'lodash/isEqual';

Expand All @@ -10,6 +9,10 @@ import LoadingError from 'sentry/components/loadingError';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import {t} from 'sentry/locale';
import {SentryPropTypeValidators} from 'sentry/sentryPropTypeValidators';
import type {
RouteComponentProps,
RouteContextInterface,
} from 'sentry/types/legacyReactRouter';
import {metric} from 'sentry/utils/analytics';
import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes';
import PermissionDenied from 'sentry/views/permissionDenied';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/forms/jsonForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Component, Fragment} from 'react';
import type {WithRouterProps} from 'react-router';
import * as Sentry from '@sentry/react';
import scrollToElement from 'scroll-to-element';

import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import {defined} from 'sentry/utils';
import {sanitizeQuerySelector} from 'sentry/utils/sanitizeQuerySelector';
// eslint-disable-next-line no-restricted-imports
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/issues/groupList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component, Fragment} from 'react';
import type {WithRouterProps} from 'react-router';
import styled from '@emotion/styled';
import isEqual from 'lodash/isEqual';
import omit from 'lodash/omit';
Expand All @@ -22,6 +21,7 @@ import {t} from 'sentry/locale';
import GroupStore from 'sentry/stores/groupStore';
import {space} from 'sentry/styles/space';
import type {Group} from 'sentry/types/group';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import {browserHistory} from 'sentry/utils/browserHistory';
import withApi from 'sentry/utils/withApi';
// eslint-disable-next-line no-restricted-imports
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {useEffect, useState} from 'react';
import type {InjectedRouter} from 'react-router';
import {css} from '@emotion/react';
import styled from '@emotion/styled';
import type {Location} from 'history';
Expand All @@ -15,6 +14,7 @@ import LoadingError from 'sentry/components/loadingError';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {SelectValue} from 'sentry/types/core';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import {useApiQuery} from 'sentry/utils/queryClient';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/modals/redirectToProject.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component, Fragment} from 'react';
import type {WithRouterProps} from 'react-router';
import styled from '@emotion/styled';

import type {ModalRenderProps} from 'sentry/actionCreators/modal';
import {LinkButton} from 'sentry/components/button';
import Text from 'sentry/components/text';
import {t, tct} from 'sentry/locale';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import recreateRoute from 'sentry/utils/recreateRoute';
// eslint-disable-next-line no-restricted-imports
import withSentryRouter from 'sentry/utils/withSentryRouter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {useEffect, useMemo, useState} from 'react';
import type {InjectedRouter} from 'react-router';
import {css} from '@emotion/react';
import styled from '@emotion/styled';
import type {Location, Query} from 'history';
Expand All @@ -17,6 +16,7 @@ import SelectControl from 'sentry/components/forms/controls/selectControl';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {DateString, PageFilters, SelectValue} from 'sentry/types/core';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import {MetricsCardinalityProvider} from 'sentry/utils/performance/contexts/metricsCardinality';
import {MEPSettingProvider} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/onboarding/changeRouteModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Fragment, useCallback} from 'react';
import type {RouteComponentProps} from 'react-router';
import type {Location} from 'history';

import type {ModalRenderProps} from 'sentry/actionCreators/modal';
import {Button} from 'sentry/components/button';
import ButtonBar from 'sentry/components/buttonBar';
import {t} from 'sentry/locale';
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';

type Props = {
nextLocation: Location;
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/pickProjectToContinue.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {InjectedRouter} from 'react-router';
import styled from '@emotion/styled';
import type {LocationDescriptor, LocationDescriptorObject} from 'history';

import {openModal} from 'sentry/actionCreators/modal';
import ContextPickerModal from 'sentry/components/contextPickerModal';
import type {InjectedRouter} from 'sentry/types/legacyReactRouter';

type Project = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/redirect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useEffect} from 'react';
import type {InjectedRouter} from 'react-router';

import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
import {useNavigate} from 'sentry/utils/useNavigate';

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/search/sources/apiSource.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from 'react';
import type {WithRouterProps} from 'react-router';
import * as Sentry from '@sentry/react';
import debounce from 'lodash/debounce';

Expand All @@ -15,6 +14,7 @@ import type {
PluginWithProjectList,
SentryApp,
} from 'sentry/types/integrations';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Member, Organization, Team} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import {defined} from 'sentry/utils';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/search/sources/commandSource.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component} from 'react';
import type {PlainRoute} from 'react-router';

import {openHelpSearchModal} from 'sentry/actionCreators/modal';
import {openSudo} from 'sentry/actionCreators/sudoModal';
import Access from 'sentry/components/acl/access';
import {NODE_ENV, USING_CUSTOMER_DOMAIN} from 'sentry/constants';
import {t, toggleLocaleDebug} from 'sentry/locale';
import ConfigStore from 'sentry/stores/configStore';
import type {PlainRoute} from 'sentry/types/legacyReactRouter';
import type {Fuse} from 'sentry/utils/fuzzySearch';
import {createFuzzySearch} from 'sentry/utils/fuzzySearch';

Expand Down
2 changes: 1 addition & 1 deletion static/app/components/search/sources/formSource.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Component} from 'react';
import type {WithRouterProps} from 'react-router';

import {loadSearchMap} from 'sentry/actionCreators/formSearch';
import type {FormSearchField} from 'sentry/stores/formSearchStore';
import FormSearchStore from 'sentry/stores/formSearchStore';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Fuse} from 'sentry/utils/fuzzySearch';
import {createFuzzySearch} from 'sentry/utils/fuzzySearch';
import replaceRouterParams from 'sentry/utils/replaceRouterParams';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/search/sources/helpSource.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Component} from 'react';
import type {WithRouterProps} from 'react-router';
import type {Result as SearchResult} from '@sentry-internal/global-search';
import {SentryGlobalSearch, standardSDKSlug} from '@sentry-internal/global-search';
import dompurify from 'dompurify';
import debounce from 'lodash/debounce';

import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import parseHtmlMarks from 'sentry/utils/parseHtmlMarks';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/search/sources/routeSource.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component} from 'react';
import type {RouteComponentProps} from 'react-router';

import HookStore from 'sentry/stores/hookStore';
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import type {Fuse} from 'sentry/utils/fuzzySearch';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/smartSearchBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {VFC} from 'react';
import {Component, createRef} from 'react';
import type {WithRouterProps} from 'react-router';
import styled from '@emotion/styled';
import * as Sentry from '@sentry/react';
import debounce from 'lodash/debounce';
Expand Down Expand Up @@ -42,6 +41,7 @@ import MemberListStore from 'sentry/stores/memberListStore';
import {space} from 'sentry/styles/space';
import type {Tag, TagCollection} from 'sentry/types/group';
import {SavedSearchType} from 'sentry/types/group';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import type {User} from 'sentry/types/user';
import {defined} from 'sentry/utils';
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/timeRangeSelector/dateRange.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Component} from 'react';
import type {Range} from 'react-date-range';
import type {WithRouterProps} from 'react-router';
import type {Theme} from '@emotion/react';
import {withTheme} from '@emotion/react';
import styled from '@emotion/styled';
Expand All @@ -11,6 +10,7 @@ import Checkbox from 'sentry/components/checkbox';
import {MAX_PICKABLE_DAYS} from 'sentry/constants';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {WithRouterProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import {trackAnalytics} from 'sentry/utils/analytics';
import {
Expand Down
2 changes: 1 addition & 1 deletion static/app/routes.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {RouteComponent} from 'react-router';
import {createRoutes} from 'react-router';

import * as constants from 'sentry/constants';
import {buildRoutes} from 'sentry/routes';
import type {RouteComponent} from 'sentry/types/legacyReactRouter';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';

// Setup a module mock so that we can replace
Expand Down
7 changes: 5 additions & 2 deletions static/app/types/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type {Route, RouteComponentProps, RouteContextInterface} from 'react-router';

import type {ChildrenRenderFn} from 'sentry/components/acl/feature';
import type {Guide} from 'sentry/components/assistant/types';
import type {ButtonProps} from 'sentry/components/button';
Expand All @@ -21,6 +19,11 @@ import type {NavigationItem, NavigationSection} from 'sentry/views/settings/type
import type {ExperimentKey} from './experiments';
import type {Group} from './group';
import type {Integration, IntegrationProvider} from './integrations';
import type {
Route,
RouteComponentProps,
RouteContextInterface,
} from './legacyReactRouter';
import type {Member, Organization} from './organization';
import type {Project} from './project';
import type {User} from './user';
Expand Down
Loading

0 comments on commit 3de43da

Please sign in to comment.