Skip to content

Commit f39a5a5

Browse files
authored
chore: Guard against bad imports related to devtoolbar (#75030)
The toolbar is a little world, we shouldn't import from it (but it's re-using things from all over sentry!) Also, there's some specific spots that it shouldn't be importing from. Right now just queryClient, but over time that list will probably grow as they get further apart. The getsentry version of this is getsentry/getsentry#14747
1 parent 2e59e02 commit f39a5a5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.eslintrc.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ module.exports = {
2626
'error',
2727
{additionalHooks: '(useEffectAfterFirstRender|useMemoWithPrevious)'},
2828
],
29+
'no-restricted-imports': [
30+
'error',
31+
{
32+
patterns: [
33+
{
34+
group: ['sentry/components/devtoolbar/*'],
35+
message: 'Do not depend on toolbar internals',
36+
},
37+
],
38+
},
39+
],
2940

3041
// TODO(@anonrig): Remove this from eslint-sentry-config
3142
'space-infix-ops': 'off',
@@ -44,6 +55,23 @@ module.exports = {
4455
// and formatting these files.
4556
ignorePatterns: ['*.json'],
4657
overrides: [
58+
{
59+
files: ['static/app/components/devtoolbar/**/*.{ts,tsx}'],
60+
rules: {
61+
'no-restricted-imports': [
62+
'error',
63+
{
64+
paths: [
65+
{
66+
name: 'sentry/utils/queryClient',
67+
message:
68+
'Import from `@tanstack/react-query` and `./hooks/useFetchApiData` or `./hooks/useFetchInfiniteApiData` instead.',
69+
},
70+
],
71+
},
72+
],
73+
},
74+
},
4775
{
4876
files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'],
4977
extends: ['plugin:testing-library/react', 'sentry-app/strict'],

0 commit comments

Comments
 (0)