Skip to content

Commit ab652cd

Browse files
authored
chore: Prevent importing from gsAdmin & gsApp (#87666)
1 parent 501c7a5 commit ab652cd

File tree

3 files changed

+83
-12
lines changed

3 files changed

+83
-12
lines changed

eslint.config.mjs

+81-9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ invariant(react.configs.flat, 'For typescript');
3737
invariant(react.configs.flat.recommended, 'For typescript');
3838
invariant(react.configs.flat['jsx-runtime'], 'For typescript');
3939

40-
const restrictedImportPatterns = [
41-
{
42-
group: ['sentry/components/devtoolbar/*'],
43-
message: 'Do not depend on toolbar internals',
44-
},
45-
];
46-
4740
const restrictedImportPaths = [
4841
{
4942
name: '@testing-library/react',
@@ -264,7 +257,23 @@ export default typescript.config([
264257
'no-proto': 'error',
265258
'no-restricted-imports': [
266259
'error',
267-
{patterns: restrictedImportPatterns, paths: restrictedImportPaths},
260+
{
261+
patterns: [
262+
{
263+
group: ['admin/*'],
264+
message: 'Do not import gsAdmin into sentry',
265+
},
266+
{
267+
group: ['getsentry/*'],
268+
message: 'Do not import gsApp into sentry',
269+
},
270+
{
271+
group: ['sentry/components/devtoolbar/*'],
272+
message: 'Do not depend on toolbar internals',
273+
},
274+
],
275+
paths: restrictedImportPaths,
276+
},
268277
],
269278
'no-return-assign': 'error',
270279
'no-script-url': 'error',
@@ -697,6 +706,16 @@ export default typescript.config([
697706
'no-restricted-imports': [
698707
'error',
699708
{
709+
patterns: [
710+
{
711+
group: ['admin/*'],
712+
message: 'Do not import gsAdmin into sentry',
713+
},
714+
{
715+
group: ['getsentry/*'],
716+
message: 'Do not import gsApp into sentry',
717+
},
718+
],
700719
paths: [
701720
...restrictedImportPaths,
702721
{
@@ -722,7 +741,20 @@ export default typescript.config([
722741
'no-restricted-imports': [
723742
'error',
724743
{
725-
patterns: restrictedImportPatterns,
744+
patterns: [
745+
{
746+
group: ['admin/*'],
747+
message: 'Do not import gsAdmin into sentry',
748+
},
749+
{
750+
group: ['getsentry/*'],
751+
message: 'Do not import gsApp into sentry',
752+
},
753+
{
754+
group: ['sentry/components/devtoolbar/*'],
755+
message: 'Do not depend on toolbar internals',
756+
},
757+
],
726758
paths: [
727759
...restrictedImportPaths,
728760
{
@@ -751,4 +783,44 @@ export default typescript.config([
751783
'no-console': 'off',
752784
},
753785
},
786+
{
787+
name: 'files/gsApp',
788+
files: ['static/gsApp/**/*.{js,mjs,ts,jsx,tsx}'],
789+
rules: {
790+
'no-restricted-imports': [
791+
'error',
792+
{
793+
patterns: [
794+
{
795+
group: ['admin/*'],
796+
message: 'Do not import gsAdmin into gsApp',
797+
},
798+
{
799+
group: ['sentry/components/devtoolbar/*'],
800+
message: 'Do not depend on toolbar internals',
801+
},
802+
],
803+
paths: restrictedImportPaths,
804+
},
805+
],
806+
},
807+
},
808+
{
809+
name: 'files/gsAdmin',
810+
files: ['static/gsAdmin/**/*.{js,mjs,ts,jsx,tsx}'],
811+
rules: {
812+
'no-restricted-imports': [
813+
'error',
814+
{
815+
patterns: [
816+
{
817+
group: ['sentry/components/devtoolbar/*'],
818+
message: 'Do not depend on toolbar internals',
819+
},
820+
],
821+
paths: restrictedImportPaths,
822+
},
823+
],
824+
},
825+
},
754826
]);

static/app/components/nav/primary/help.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import useMutateUserOptions from 'sentry/utils/useMutateUserOptions';
1111
import useOrganization from 'sentry/utils/useOrganization';
1212
import {activateZendesk, zendeskIsLoaded} from 'sentry/utils/zendesk';
1313

14-
import trackGetsentryAnalytics from 'getsentry/utils/trackGetsentryAnalytics';
15-
1614
function getContactSupportItem({
1715
organization,
1816
}: {
@@ -30,7 +28,7 @@ function getContactSupportItem({
3028
label: t('Contact Support'),
3129
onAction() {
3230
activateZendesk();
33-
trackGetsentryAnalytics('zendesk_link.clicked', {
31+
trackAnalytics('zendesk_link.clicked', {
3432
organization,
3533
source: 'sidebar',
3634
});

static/app/views/explore/spans/spansTab.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import {
6565
import {useOnboardingProject} from 'sentry/views/insights/common/queries/useOnboardingProject';
6666
import {Onboarding} from 'sentry/views/performance/onboarding';
6767

68+
// eslint-disable-next-line no-restricted-imports
6869
import QuotaExceededAlert from 'getsentry/components/performance/quotaExceededAlert';
6970

7071
export type SpanTabProps = {

0 commit comments

Comments
 (0)