From 67443c5d46f2ef658266e4b7db709e28876ed491 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Thu, 25 Jul 2024 15:50:32 -0700 Subject: [PATCH] chore: Guard against bad imports related to devtoolbar --- .eslintrc.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 288e497b178120..6343a9af7b98da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,6 +26,17 @@ module.exports = { 'error', {additionalHooks: '(useEffectAfterFirstRender|useMemoWithPrevious)'}, ], + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + group: ['sentry/components/devtoolbar/*'], + message: 'Do not depend on toolbar internals', + }, + ], + }, + ], // TODO(@anonrig): Remove this from eslint-sentry-config 'space-infix-ops': 'off', @@ -44,6 +55,23 @@ module.exports = { // and formatting these files. ignorePatterns: ['*.json'], overrides: [ + { + files: ['static/app/components/devtoolbar/**/*.{ts,tsx}'], + rules: { + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'sentry/utils/queryClient', + message: + 'Import from `@tanstack/react-query` and `./hooks/useFetchApiData` or `./hooks/useFetchInfiniteApiData` instead.', + }, + ], + }, + ], + }, + }, { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], extends: ['plugin:testing-library/react', 'sentry-app/strict'],