feat(linting): restrict direct use of supersetTheme in favor of ThemeProvider (#17001)
* feat: restrict direct use of supersetTheme * allowing a couple of safe instances of supersetTheme
This commit is contained in:
parent
66b0877445
commit
5f73ca85d5
|
|
@ -108,7 +108,7 @@ module.exports = {
|
||||||
'no-prototype-builtins': 0,
|
'no-prototype-builtins': 0,
|
||||||
'no-restricted-properties': 0,
|
'no-restricted-properties': 0,
|
||||||
'no-restricted-imports': [
|
'no-restricted-imports': [
|
||||||
'error',
|
'warn',
|
||||||
{
|
{
|
||||||
paths: [
|
paths: [
|
||||||
{
|
{
|
||||||
|
|
@ -116,6 +116,12 @@ module.exports = {
|
||||||
message:
|
message:
|
||||||
'Please import Ant components from the index of common/components',
|
'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.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { shallow as enzymeShallow, mount as enzymeMount } from 'enzyme';
|
import { shallow as enzymeShallow, mount as enzymeMount } from 'enzyme';
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { supersetTheme } from '@superset-ui/core';
|
import { supersetTheme } from '@superset-ui/core';
|
||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
import { ProviderWrapper } from './ProviderWrapper';
|
import { ProviderWrapper } from './ProviderWrapper';
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,17 @@
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"rules": {
|
"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."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,19 @@
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"rules": {
|
"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."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
import { setConfig as setHotLoaderConfig } from 'react-hot-loader';
|
import { setConfig as setHotLoaderConfig } from 'react-hot-loader';
|
||||||
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
|
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { configure, supersetTheme } from '@superset-ui/core';
|
import { configure, supersetTheme } from '@superset-ui/core';
|
||||||
import { merge } from 'lodash';
|
import { merge } from 'lodash';
|
||||||
import setupClient from './setup/setupClient';
|
import setupClient from './setup/setupClient';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue