diff --git a/.eslintrc b/.eslintrc index 2109968b124..55587fa73e3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -49,6 +49,14 @@ "importNames": ["Trans", "t"], "message": "Please import from app/core/internationalization instead", }, + { + "name": "react-router-dom", + "message": "Please import from react-router-dom-v5-compat instead" + }, + { + "name": "react-router", + "message": "Please import from react-router-dom-v5-compat instead" + } ], }, ], diff --git a/public/app/features/explore/spec/helper/setup.tsx b/public/app/features/explore/spec/helper/setup.tsx index 95343074143..00f596e1413 100644 --- a/public/app/features/explore/spec/helper/setup.tsx +++ b/public/app/features/explore/spec/helper/setup.tsx @@ -4,6 +4,7 @@ import { createMemoryHistory } from 'history'; import { fromPairs } from 'lodash'; import { stringify } from 'querystring'; import { Provider } from 'react-redux'; +// eslint-disable-next-line no-restricted-imports import { Route, Router } from 'react-router-dom'; import { of } from 'rxjs'; import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock'; diff --git a/public/app/routes/RoutesWrapper.tsx b/public/app/routes/RoutesWrapper.tsx index c65dcc9e1b4..0d486fffc05 100644 --- a/public/app/routes/RoutesWrapper.tsx +++ b/public/app/routes/RoutesWrapper.tsx @@ -1,5 +1,6 @@ import { css } from '@emotion/css'; import { ComponentType } from 'react'; +// eslint-disable-next-line no-restricted-imports import { Router } from 'react-router-dom'; import { CompatRouter } from 'react-router-dom-v5-compat'; diff --git a/public/test/helpers/TestProvider.tsx b/public/test/helpers/TestProvider.tsx index 2e7f21043dc..adedcfdaf60 100644 --- a/public/test/helpers/TestProvider.tsx +++ b/public/test/helpers/TestProvider.tsx @@ -1,6 +1,7 @@ import { Store } from '@reduxjs/toolkit'; import * as React from 'react'; import { Provider } from 'react-redux'; +// eslint-disable-next-line no-restricted-imports import { Router } from 'react-router-dom'; import { CompatRouter } from 'react-router-dom-v5-compat'; import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock'; diff --git a/public/test/test-utils.tsx b/public/test/test-utils.tsx index 2dbc22267d5..3ec03531c99 100644 --- a/public/test/test-utils.tsx +++ b/public/test/test-utils.tsx @@ -5,6 +5,7 @@ import { createMemoryHistory, MemoryHistoryBuildOptions } from 'history'; import { Fragment, PropsWithChildren } from 'react'; import * as React from 'react'; import { Provider } from 'react-redux'; +// eslint-disable-next-line no-restricted-imports import { Router } from 'react-router-dom'; import { CompatRouter } from 'react-router-dom-v5-compat'; import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';