diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js index 34e5336efa645..495fcd8f7f551 100644 --- a/superset-frontend/.eslintrc.js +++ b/superset-frontend/.eslintrc.js @@ -108,7 +108,7 @@ module.exports = { 'no-prototype-builtins': 0, 'no-restricted-properties': 0, 'no-restricted-imports': [ - 'error', + 'warn', { paths: [ { @@ -116,6 +116,12 @@ module.exports = { message: 'Please import Ant components from the index of common/components', }, + { + name: '@superset-ui/core', + importNames: ['supersetTheme'], + message: + 'Please use the theme directly from the ThemeProvider rather than importing supersetTheme.', + }, ], }, ], diff --git a/superset-frontend/spec/helpers/theming.ts b/superset-frontend/spec/helpers/theming.ts index 9815e34899494..e364b413457f9 100644 --- a/superset-frontend/spec/helpers/theming.ts +++ b/superset-frontend/spec/helpers/theming.ts @@ -17,6 +17,7 @@ * under the License. */ import { shallow as enzymeShallow, mount as enzymeMount } from 'enzyme'; +// eslint-disable-next-line no-restricted-imports import { supersetTheme } from '@superset-ui/core'; import { ReactElement } from 'react'; import { ProviderWrapper } from './ProviderWrapper'; diff --git a/superset-frontend/src/common/components/.eslintrc b/superset-frontend/src/common/components/.eslintrc index e7c30d4809b56..586abc67e8d22 100644 --- a/superset-frontend/src/common/components/.eslintrc +++ b/superset-frontend/src/common/components/.eslintrc @@ -18,6 +18,17 @@ */ { "rules": { - "no-restricted-imports": 0 + "no-restricted-imports": [ + "warn", + { + "paths": [ + { + "name": "@superset-ui/core", + "importNames": ["supersetTheme"], + "message": "Please use the theme directly from the ThemeProvider rather than importing supersetTheme." + } + ] + } + ] } } diff --git a/superset-frontend/src/components/.eslintrc b/superset-frontend/src/components/.eslintrc index e7c30d4809b56..a01df155ac687 100644 --- a/superset-frontend/src/components/.eslintrc +++ b/superset-frontend/src/components/.eslintrc @@ -18,6 +18,19 @@ */ { "rules": { - "no-restricted-imports": 0 + "no-restricted-imports": [ + "warn", + { + "paths": [ + { + "name": "@superset-ui/core", + "importNames": [ + "supersetTheme" + ], + "message": "Please use the theme directly from the ThemeProvider rather than importing supersetTheme." + } + ] + } + ] } } diff --git a/superset-frontend/src/preamble.ts b/superset-frontend/src/preamble.ts index 8fad06599e732..da2fac3f75fec 100644 --- a/superset-frontend/src/preamble.ts +++ b/superset-frontend/src/preamble.ts @@ -19,6 +19,7 @@ import { setConfig as setHotLoaderConfig } from 'react-hot-loader'; import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'; import moment from 'moment'; +// eslint-disable-next-line no-restricted-imports import { configure, supersetTheme } from '@superset-ui/core'; import { merge } from 'lodash'; import setupClient from './setup/setupClient';