Skip to content

Commit 1f7565e

Browse files
ref(utils): Remove default / reexports from utils.jsx (#13581)
- The defaults export was not used by getsentry (as the comment mentioned), in fact, it is not even exported in the SentryApp global at all. - The re-exports were not used.
1 parent e359085 commit 1f7565e

File tree

8 files changed

+44
-76
lines changed

8 files changed

+44
-76
lines changed

src/sentry/static/sentry/app/components/events/eventEntries.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from 'react-emotion';
44

55
import {analytics} from 'app/utils/analytics';
66
import {logException} from 'app/utils/logging';
7+
import {objectIsEmpty} from 'app/utils';
78
import {t} from 'app/locale';
89
import BreadcrumbsInterface from 'app/components/events/interfaces/breadcrumbs';
910
import CspInterface from 'app/components/events/interfaces/csp';
@@ -29,7 +30,6 @@ import SentryTypes from 'app/sentryTypes';
2930
import StacktraceInterface from 'app/components/events/interfaces/stacktrace';
3031
import TemplateInterface from 'app/components/events/interfaces/template';
3132
import ThreadsInterface from 'app/components/events/interfaces/threads';
32-
import utils from 'app/utils';
3333
import withApi from 'app/utils/withApi';
3434
import withOrganization from 'app/utils/withOrganization';
3535

@@ -141,7 +141,7 @@ class EventEntries extends React.Component {
141141
const features = organization ? new Set(organization.features) : new Set();
142142

143143
const hasContext =
144-
event && (!utils.objectIsEmpty(event.user) || !utils.objectIsEmpty(event.contexts));
144+
event && (!objectIsEmpty(event.user) || !objectIsEmpty(event.contexts));
145145

146146
if (!event) {
147147
return (
@@ -153,7 +153,7 @@ class EventEntries extends React.Component {
153153

154154
return (
155155
<div className="entries">
156-
{!utils.objectIsEmpty(event.errors) && <EventErrors event={event} />}{' '}
156+
{!objectIsEmpty(event.errors) && <EventErrors event={event} />}{' '}
157157
{!isShare && !!group.firstRelease && (
158158
<EventCause event={event} orgId={orgId} projectId={project.slug} />
159159
)}
@@ -174,14 +174,14 @@ class EventEntries extends React.Component {
174174
/>
175175
{this.renderEntries()}
176176
{hasContext && <EventContexts group={group} event={event} />}
177-
{!utils.objectIsEmpty(event.context) && <EventExtraData event={event} />}
178-
{!utils.objectIsEmpty(event.packages) && <EventPackageData event={event} />}
179-
{!utils.objectIsEmpty(event.device) && <EventDevice event={event} />}
177+
{!objectIsEmpty(event.context) && <EventExtraData event={event} />}
178+
{!objectIsEmpty(event.packages) && <EventPackageData event={event} />}
179+
{!objectIsEmpty(event.device) && <EventDevice event={event} />}
180180
{!isShare && features.has('event-attachments') && (
181181
<EventAttachments event={event} orgId={orgId} projectId={project.slug} />
182182
)}
183-
{!utils.objectIsEmpty(event.sdk) && <EventSdk event={event} />}
184-
{!utils.objectIsEmpty(event.sdk) && event.sdk.upstream.isNewer && (
183+
{!objectIsEmpty(event.sdk) && <EventSdk event={event} />}
184+
{!objectIsEmpty(event.sdk) && event.sdk.upstream.isNewer && (
185185
<div className="alert-block alert-info box">
186186
<span className="icon-exclamation" />
187187
{t(

src/sentry/static/sentry/app/components/events/userFeedback.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import styled from 'react-emotion';
44

5+
import {nl2br, escape} from 'app/utils';
56
import {t} from 'app/locale';
67
import ActivityAuthor from 'app/components/activity/author';
78
import ActivityItem from 'app/components/activity/item';
89
import Clipboard from 'app/components/clipboard';
910
import InlineSvg from 'app/components/inlineSvg';
1011
import Link from 'app/components/links/link';
1112
import space from 'app/styles/space';
12-
import utils from 'app/utils';
1313

1414
class EventUserFeedback extends React.Component {
1515
static propTypes = {
@@ -50,7 +50,7 @@ class EventUserFeedback extends React.Component {
5050
>
5151
<p
5252
dangerouslySetInnerHTML={{
53-
__html: utils.nl2br(utils.escape(report.comments)),
53+
__html: nl2br(escape(report.comments)),
5454
}}
5555
/>
5656
</ActivityItem>

src/sentry/static/sentry/app/components/pagination.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import {browserHistory} from 'react-router';
12
import PropTypes from 'prop-types';
23
import React from 'react';
3-
import {browserHistory} from 'react-router';
44
import {css} from 'react-emotion';
55

6-
import utils from 'app/utils';
76
import {t} from 'app/locale';
7+
import parseLinkHeader from 'app/utils/parseLinkHeader';
88

99
const streamCss = css`
1010
margin: 20px 0 0 0;
@@ -48,7 +48,7 @@ export default class Pagination extends React.Component {
4848
const path = this.props.to || location.pathname;
4949
const query = location.query;
5050

51-
const links = utils.parseLinkHeader(pageLinks);
51+
const links = parseLinkHeader(pageLinks);
5252

5353
let previousPageClassName = 'btn btn-default btn-lg prev';
5454
if (links.previous.results === false) {

src/sentry/static/sentry/app/utils.jsx

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import _ from 'lodash';
22

3-
// import/export sub-utils
4-
import parseLinkHeader from 'app/utils/parseLinkHeader';
5-
import PendingChangeQueue from 'app/utils/pendingChangeQueue';
6-
import CursorPoller from 'app/utils/cursorPoller';
7-
import StreamManager from 'app/utils/streamManager';
8-
93
function arrayIsEqual(arr, other, deep) {
104
// if the other array is a falsy value, return
115
if (!arr && !other) {
@@ -280,31 +274,3 @@ export function deepFreeze(object) {
280274

281275
return Object.freeze(object);
282276
}
283-
284-
// re-export under utils
285-
export {parseLinkHeader, PendingChangeQueue, CursorPoller};
286-
287-
// backwards compatible default export for use w/ getsentry (exported
288-
// as a single object w/ function refs for consumption by getsentry)
289-
export default {
290-
sortArray,
291-
objectIsEmpty,
292-
defined,
293-
nl2br,
294-
isUrl,
295-
escape,
296-
percent,
297-
toTitleCase,
298-
intcomma,
299-
valueIsEqual,
300-
parseLinkHeader,
301-
buildUserId,
302-
buildTeamId,
303-
descopeFeatureName,
304-
305-
// external imports
306-
objectToArray,
307-
PendingChangeQueue,
308-
StreamManager,
309-
CursorPoller,
310-
};

src/sentry/static/sentry/app/views/organizationEvents/events.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import * as Sentry from '@sentry/browser';
21
import {Flex} from 'grid-emotion';
2+
import {browserHistory} from 'react-router';
33
import {isEqual} from 'lodash';
44
import PropTypes from 'prop-types';
55
import React from 'react';
6+
import * as Sentry from '@sentry/browser';
67
import styled from 'react-emotion';
7-
import {browserHistory} from 'react-router';
88

9-
import {addErrorMessage} from 'app/actionCreators/indicator';
109
import {Panel} from 'app/components/panels';
10+
import {addErrorMessage} from 'app/actionCreators/indicator';
1111
import {t} from 'app/locale';
1212
import AsyncComponent from 'app/components/asyncComponent';
1313
import AsyncView from 'app/views/asyncView';
1414
import Feature from 'app/components/acl/feature';
1515
import Pagination from 'app/components/pagination';
1616
import SentryTypes from 'app/sentryTypes';
17-
import utils from 'app/utils';
17+
import parseLinkHeader from 'app/utils/parseLinkHeader';
1818
import withOrganization from 'app/utils/withOrganization';
1919

2020
import {getParams} from './utils/getParams';
2121
import EventsChart from './eventsChart';
2222
import EventsTable from './eventsTable';
2323

2424
const parseRowFromLinks = (links, numRows) => {
25-
links = utils.parseLinkHeader(links);
25+
links = parseLinkHeader(links);
2626
if (!links.previous.results) {
2727
return `1-${numRows}`;
2828
}
@@ -171,7 +171,7 @@ class OrganizationEvents extends AsyncView {
171171
const {organization, location, router} = this.props;
172172
const {error, loading, reloading, events, eventsPageLinks} = this.state;
173173
const parsedLinks =
174-
!loading && !error && eventsPageLinks ? utils.parseLinkHeader(eventsPageLinks) : {};
174+
!loading && !error && eventsPageLinks ? parseLinkHeader(eventsPageLinks) : {};
175175

176176
return (
177177
<React.Fragment>

src/sentry/static/sentry/app/views/organizationEventsV2/eventModalContent.jsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1+
import PropTypes from 'prop-types';
12
import React from 'react';
23
import styled from 'react-emotion';
3-
import PropTypes from 'prop-types';
44

5+
import {INTERFACES} from 'app/components/events/eventEntries';
6+
import {getMessage, getTitle} from 'app/utils/events';
7+
import {objectIsEmpty, toTitleCase} from 'app/utils';
58
import {t} from 'app/locale';
6-
import SentryTypes from 'app/sentryTypes';
79
import DateTime from 'app/components/dateTime';
810
import ErrorBoundary from 'app/components/errorBoundary';
9-
import ExternalLink from 'app/components/links/externalLink';
1011
import EventDataSection from 'app/components/events/eventDataSection';
1112
import EventDevice from 'app/components/events/device';
1213
import EventExtraData from 'app/components/events/extraData';
1314
import EventPackageData from 'app/components/events/packageData';
15+
import ExternalLink from 'app/components/links/externalLink';
1416
import FileSize from 'app/components/fileSize';
1517
import NavTabs from 'app/components/navTabs';
16-
import space from 'app/styles/space';
18+
import SentryTypes from 'app/sentryTypes';
1719
import getDynamicText from 'app/utils/getDynamicText';
18-
import utils from 'app/utils';
19-
import {getMessage, getTitle} from 'app/utils/events';
20+
import space from 'app/styles/space';
2021

21-
import {INTERFACES} from 'app/components/events/eventEntries';
22-
import TagsTable from './tagsTable';
2322
import LinkedIssuePreview from './linkedIssuePreview';
23+
import TagsTable from './tagsTable';
2424

2525
const OTHER_SECTIONS = {
2626
context: EventExtraData,
@@ -101,13 +101,13 @@ const EventModalContent = props => {
101101
onTabChange(type);
102102
}}
103103
>
104-
{utils.toTitleCase(type)}
104+
{toTitleCase(type)}
105105
</a>
106106
</li>
107107
);
108108
})}
109109
{Object.keys(OTHER_SECTIONS).map(section => {
110-
if (utils.objectIsEmpty(event[section])) {
110+
if (objectIsEmpty(event[section])) {
111111
return null;
112112
}
113113
const classname = section === activeTab ? 'active' : null;
@@ -120,7 +120,7 @@ const EventModalContent = props => {
120120
onTabChange(section);
121121
}}
122122
>
123-
{utils.toTitleCase(section)}
123+
{toTitleCase(section)}
124124
</a>
125125
</li>
126126
);

src/sentry/static/sentry/app/views/organizationReleases/detail/groupList.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1+
import {isEqual} from 'lodash';
12
import PropTypes from 'prop-types';
23
import React from 'react';
3-
import createReactClass from 'create-react-class';
44
import Reflux from 'reflux';
5-
import {isEqual} from 'lodash';
5+
import createReactClass from 'create-react-class';
66
import qs from 'query-string';
77

8-
import SentryTypes from 'app/sentryTypes';
8+
import {Panel, PanelBody} from 'app/components/panels';
99
import {fetchOrgMembers, indexMembersByProject} from 'app/actionCreators/members';
10+
import {t} from 'app/locale';
11+
import EmptyStateWarning from 'app/components/emptyStateWarning';
1012
import GroupStore from 'app/stores/groupStore';
1113
import LoadingError from 'app/components/loadingError';
1214
import LoadingIndicator from 'app/components/loadingIndicator';
15+
import SentryTypes from 'app/sentryTypes';
1316
import StreamGroup from 'app/components/stream/group';
14-
import utils from 'app/utils';
17+
import StreamManager from 'app/utils/streamManager';
1518
import withApi from 'app/utils/withApi';
16-
import {t} from 'app/locale';
17-
import EmptyStateWarning from 'app/components/emptyStateWarning';
18-
import {Panel, PanelBody} from 'app/components/panels';
1919

2020
import GroupListHeader from './groupListHeader';
2121

@@ -55,7 +55,7 @@ const GroupList = createReactClass({
5555
},
5656

5757
componentWillMount() {
58-
this._streamManager = new utils.StreamManager(GroupStore);
58+
this._streamManager = new StreamManager(GroupStore);
5959

6060
this.fetchData();
6161
},

src/sentry/static/sentry/app/views/organizationStream/overview.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import qs from 'query-string';
1111
import {Client} from 'app/api';
1212
import {Panel, PanelBody} from 'app/components/panels';
1313
import {analytics} from 'app/utils/analytics';
14+
import {defined} from 'app/utils';
1415
import {
1516
deleteSavedSearch,
1617
fetchSavedSearches,
@@ -22,6 +23,7 @@ import {fetchOrganizationTags, fetchTagValues} from 'app/actionCreators/tags';
2223
import {getUtcDateString} from 'app/utils/dates';
2324
import {t} from 'app/locale';
2425
import ConfigStore from 'app/stores/configStore';
26+
import CursorPoller from 'app/utils/cursorPoller';
2527
import EmptyStateWarning from 'app/components/emptyStateWarning';
2628
import ErrorRobot from 'app/components/errorRobot';
2729
import GroupStore from 'app/stores/groupStore';
@@ -32,10 +34,10 @@ import ProcessingIssueList from 'app/components/stream/processingIssueList';
3234
import SelectedGroupStore from 'app/stores/selectedGroupStore';
3335
import SentryTypes from 'app/sentryTypes';
3436
import StreamGroup from 'app/components/stream/group';
37+
import StreamManager from 'app/utils/streamManager';
3538
import TagStore from 'app/stores/tagStore';
3639
import parseApiError from 'app/utils/parseApiError';
3740
import parseLinkHeader from 'app/utils/parseLinkHeader';
38-
import utils from 'app/utils';
3941
import withGlobalSelection from 'app/utils/withGlobalSelection';
4042
import withOrganization from 'app/utils/withOrganization';
4143
import withSavedSearches from 'app/utils/withSavedSearches';
@@ -94,8 +96,8 @@ const OrganizationStream = createReactClass({
9496

9597
componentDidMount() {
9698
this.api = new Client();
97-
this._streamManager = new utils.StreamManager(GroupStore);
98-
this._poller = new utils.CursorPoller({
99+
this._streamManager = new StreamManager(GroupStore);
100+
this._poller = new CursorPoller({
99101
success: this.onRealtimePoll,
100102
});
101103

@@ -231,7 +233,7 @@ const OrganizationStream = createReactClass({
231233
}
232234

233235
// only include defined values.
234-
return pickBy(params, v => utils.defined(v));
236+
return pickBy(params, v => defined(v));
235237
},
236238

237239
getFeatures() {

0 commit comments

Comments
 (0)