chore: remove unused eslintrc (#17860)

* chore: remove unused eslintrc

* remove unused lint

* add comments

* change comments
This commit is contained in:
Yongjie Zhao 2022-01-05 19:31:12 +08:00 committed by GitHub
parent 97a78d3301
commit ceecc7047b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 354 deletions

View File

@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
const packageConfig = require('./package');
const importCoreModules = [];
@ -26,7 +25,7 @@ Object.entries(packageConfig.dependencies).forEach(([pkg]) => {
}
});
// ignore files when running ForkTsCheckerWebpackPlugin
// ignore files in production mode
let ignorePatterns = [];
if (process.env.NODE_ENV === 'production') {
ignorePatterns = [
@ -52,12 +51,14 @@ module.exports = {
},
env: {
browser: true,
node: true,
},
settings: {
'import/resolver': {
webpack: {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
// resolve modules from `/superset_frontend/node_modules` and `/superset_frontend`
moduleDirectory: ['node_modules', '.'],
},
},
// Allow only core/src and core/test, avoid import modules from lib
@ -69,24 +70,6 @@ module.exports = {
},
plugins: ['prettier', 'react', 'file-progress'],
overrides: [
{
files: ['cypress-base/**/*'],
rules: {
'import/no-unresolved': 0,
'global-require': 0,
},
},
{
files: ['webpack*.js'],
env: {
node: true,
},
settings: {
'import/resolver': {
node: {},
},
},
},
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
@ -136,24 +119,6 @@ module.exports = {
'no-nested-ternary': 0,
'no-prototype-builtins': 0,
'no-restricted-properties': 0,
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'antd',
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.',
},
],
},
],
'no-shadow': 0, // re-enable up for discussion
'no-use-before-define': 0, // disabled temporarily
'padded-blocks': 0,
@ -178,7 +143,6 @@ module.exports = {
},
settings: {
'import/resolver': {
webpack: {},
typescript: {},
},
react: {
@ -186,17 +150,6 @@ module.exports = {
},
},
},
{
files: ['*.stories.jsx', '*.stories.tsx'],
rules: {
// this is to keep eslint from complaining about storybook addons,
// since they are included as dev dependencies rather than direct dependencies.
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: true },
],
},
},
{
files: [
'*.test.ts',
@ -239,15 +192,6 @@ module.exports = {
'jest-dom/prefer-to-have-style': 0,
},
},
{
files: './packages/generator-superset/**/*.test.*',
env: {
node: true,
},
rules: {
'jest/expect-expect': 0,
},
},
],
rules: {
camelcase: [
@ -287,7 +231,7 @@ module.exports = {
'no-prototype-builtins': 0,
'no-restricted-properties': 0,
'no-restricted-imports': [
'error',
'warn',
{
paths: [
{
@ -295,6 +239,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.',
},
],
},
],

View File

@ -25,3 +25,4 @@ CHANGELOG.md
*.geojson
*-topo.json
temporary_superset_ui/
storybook-static/

View File

@ -20,6 +20,7 @@
// the project's config changing)
module.exports = (on, config) => {
// eslint-disable-next-line global-require
require('@cypress/code-coverage/task')(on, config);
return config;
};

View File

@ -216,7 +216,6 @@
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-file-progress": "^1.2.0",
"eslint-plugin-import": "^2.24.2",
@ -230,7 +229,6 @@
"eslint-plugin-testing-library": "^3.10.1",
"exports-loader": "^0.7.0",
"fetch-mock": "^7.7.3",
"file-loader": "^6.0.0",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"ignore-styles": "^5.0.1",
"imports-loader": "^3.0.0",
@ -24377,12 +24375,6 @@
"integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=",
"dev": true
},
"node_modules/array-find": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz",
"integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=",
"dev": true
},
"node_modules/array-find-index": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
@ -31901,20 +31893,6 @@
"objectorarray": "^1.0.5"
}
},
"node_modules/enhanced-resolve": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz",
"integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=",
"dev": true,
"dependencies": {
"graceful-fs": "^4.1.2",
"memory-fs": "^0.2.0",
"tapable": "^0.1.8"
},
"engines": {
"node": ">=0.6"
}
},
"node_modules/enquirer": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
@ -32658,65 +32636,6 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"node_modules/eslint-import-resolver-webpack": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.13.2.tgz",
"integrity": "sha512-XodIPyg1OgE2h5BDErz3WJoK7lawxKTJNhgPNafRST6csC/MZC+L5P6kKqsZGRInpbgc02s/WZMrb4uGJzcuRg==",
"dev": true,
"dependencies": {
"array-find": "^1.0.0",
"debug": "^3.2.7",
"enhanced-resolve": "^0.9.1",
"find-root": "^1.1.0",
"has": "^1.0.3",
"interpret": "^1.4.0",
"is-core-module": "^2.7.0",
"is-regex": "^1.1.4",
"lodash": "^4.17.21",
"resolve": "^1.20.0",
"semver": "^5.7.1"
},
"engines": {
"node": ">= 6"
},
"peerDependencies": {
"eslint-plugin-import": ">=1.4.0",
"webpack": ">=1.11.0"
}
},
"node_modules/eslint-import-resolver-webpack/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-import-resolver-webpack/node_modules/interpret": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true,
"engines": {
"node": ">= 0.10"
}
},
"node_modules/eslint-import-resolver-webpack/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"node_modules/eslint-import-resolver-webpack/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true,
"bin": {
"semver": "bin/semver"
}
},
"node_modules/eslint-module-utils": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz",
@ -34333,7 +34252,8 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.0.0.tgz",
"integrity": "sha512-/aMOAYEFXDdjG0wytpTL5YQLfZnnTmLNjn+AIrJ/6HVnTfDqLsVKUUwkDf4I4kgex36BvjuXEn/TX9B/1ESyqQ==",
"devOptional": true,
"optional": true,
"peer": true,
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^2.6.5"
@ -34353,7 +34273,8 @@
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"devOptional": true,
"optional": true,
"peer": true,
"dependencies": {
"minimist": "^1.2.5"
},
@ -34368,7 +34289,8 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"devOptional": true,
"optional": true,
"peer": true,
"dependencies": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
@ -34382,7 +34304,8 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz",
"integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==",
"devOptional": true,
"optional": true,
"peer": true,
"dependencies": {
"@types/json-schema": "^7.0.4",
"ajv": "^6.12.2",
@ -43896,12 +43819,6 @@
"map-or-similar": "^1.5.0"
}
},
"node_modules/memory-fs": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz",
"integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=",
"dev": true
},
"node_modules/meow": {
"version": "8.1.2",
"resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz",
@ -54080,15 +53997,6 @@
"minimist": "^1.1.0"
}
},
"node_modules/tapable": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz",
"integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=",
"dev": true,
"engines": {
"node": ">=0.6"
}
},
"node_modules/tar": {
"version": "4.4.19",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz",
@ -61004,6 +60912,9 @@
"react": "^16.3.0-0"
}
},
"spec": {
"extraneous": true
},
"src": {
"version": "0.0.1",
"extraneous": true
@ -80430,12 +80341,6 @@
"integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=",
"dev": true
},
"array-find": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz",
"integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=",
"dev": true
},
"array-find-index": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
@ -86337,17 +86242,6 @@
"objectorarray": "^1.0.5"
}
},
"enhanced-resolve": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz",
"integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"memory-fs": "^0.2.0",
"tapable": "^0.1.8"
}
},
"enquirer": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
@ -87107,54 +87001,6 @@
}
}
},
"eslint-import-resolver-webpack": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.13.2.tgz",
"integrity": "sha512-XodIPyg1OgE2h5BDErz3WJoK7lawxKTJNhgPNafRST6csC/MZC+L5P6kKqsZGRInpbgc02s/WZMrb4uGJzcuRg==",
"dev": true,
"requires": {
"array-find": "^1.0.0",
"debug": "^3.2.7",
"enhanced-resolve": "^0.9.1",
"find-root": "^1.1.0",
"has": "^1.0.3",
"interpret": "^1.4.0",
"is-core-module": "^2.7.0",
"is-regex": "^1.1.4",
"lodash": "^4.17.21",
"resolve": "^1.20.0",
"semver": "^5.7.1"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"interpret": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true
},
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"eslint-module-utils": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz",
@ -88201,7 +88047,8 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.0.0.tgz",
"integrity": "sha512-/aMOAYEFXDdjG0wytpTL5YQLfZnnTmLNjn+AIrJ/6HVnTfDqLsVKUUwkDf4I4kgex36BvjuXEn/TX9B/1ESyqQ==",
"devOptional": true,
"optional": true,
"peer": true,
"requires": {
"loader-utils": "^2.0.0",
"schema-utils": "^2.6.5"
@ -88211,7 +88058,8 @@
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"devOptional": true,
"optional": true,
"peer": true,
"requires": {
"minimist": "^1.2.5"
}
@ -88220,7 +88068,8 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"devOptional": true,
"optional": true,
"peer": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
@ -88231,7 +88080,8 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz",
"integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==",
"devOptional": true,
"optional": true,
"peer": true,
"requires": {
"@types/json-schema": "^7.0.4",
"ajv": "^6.12.2",
@ -95586,12 +95436,6 @@
"map-or-similar": "^1.5.0"
}
},
"memory-fs": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz",
"integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=",
"dev": true
},
"meow": {
"version": "8.1.2",
"resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz",
@ -103652,12 +103496,6 @@
"minimist": "^1.1.0"
}
},
"tapable": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz",
"integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=",
"dev": true
},
"tar": {
"version": "4.4.19",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz",

View File

@ -276,7 +276,6 @@
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-file-progress": "^1.2.0",
"eslint-plugin-import": "^2.24.2",
@ -290,7 +289,6 @@
"eslint-plugin-testing-library": "^3.10.1",
"exports-loader": "^0.7.0",
"fetch-mock": "^7.7.3",
"file-loader": "^6.0.0",
"fork-ts-checker-webpack-plugin": "^6.3.3",
"ignore-styles": "^5.0.1",
"imports-loader": "^3.0.0",

View File

@ -1,34 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
{
"rules": {
"no-restricted-imports": [
"warn",
{
"paths": [
{
"name": "@superset-ui/core",
"importNames": ["supersetTheme"],
"message": "Please use the theme directly from the ThemeProvider rather than importing supersetTheme."
}
]
}
]
}
}

View File

@ -1,34 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
{
"rules": {
"no-restricted-imports": [
"warn",
{
"paths": [
{
"name": "@superset-ui/core",
"importNames": ["supersetTheme"],
"message": "Please use the theme directly from the ThemeProvider rather than importing supersetTheme."
}
]
}
]
}
}

View File

@ -1,31 +0,0 @@
{
"extends": "prettier",
"plugins": ["prettier"],
"rules": {
"prefer-template": 2,
"new-cap": 2,
"no-restricted-syntax": 2,
"guard-for-in": 2,
"prefer-arrow-callback": 2,
"func-names": 2,
"react/jsx-no-bind": 2,
"no-confusing-arrow": 2,
"jsx-a11y/no-static-element-interactions": 2,
"jsx-a11y/anchor-has-content": 2,
"react/require-default-props": 0,
"no-plusplus": 2,
"no-mixed-operators": 0,
"no-continue": 2,
"no-bitwise": 2,
"no-multi-assign": 2,
"no-restricted-properties": 2,
"no-prototype-builtins": 2,
"class-methods-use-this": 2,
"import/no-named-as-default": 2,
"import/prefer-default-export": 2,
"react/no-unescaped-entities": 2,
"react/no-string-refs": 2,
"react/jsx-indent": 0,
"prettier/prettier": "error"
}
}

View File

@ -115,8 +115,9 @@ const FilterFocusHighlight = React.forwardRef(
dashboardFilters,
);
const focusedNativeFilterId = nativeFilters.focusedFilterId;
if (!(focusedFilterScope || focusedNativeFilterId))
if (!(focusedFilterScope || focusedNativeFilterId)) {
return <div ref={ref} {...otherProps} />;
}
// we use local styles here instead of a conditionally-applied class,
// because adding any conditional class to this container

View File

@ -16,7 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ensureIsArray, makeApi, SupersetClient } from '@superset-ui/core';
import {
ensureIsArray,
makeApi,
SupersetClient,
logging,
} from '@superset-ui/core';
import { SupersetError } from 'src/components/ErrorMessage/types';
import { FeatureFlag, isFeatureEnabled } from '../featureFlags';
import {
@ -82,7 +87,7 @@ export const init = (appConfig?: AppConfig) => {
config = bootstrapData?.common?.conf;
} else {
config = {};
console.warn('asyncEvent: app config data not found');
logging.warn('asyncEvent: app config data not found');
}
}
transport = config.GLOBAL_ASYNC_QUERIES_TRANSPORT || TRANSPORT_POLLING;
@ -91,7 +96,7 @@ export const init = (appConfig?: AppConfig) => {
try {
lastReceivedEventId = localStorage.getItem(LOCALSTORAGE_KEY);
} catch (err) {
console.warn('Failed to fetch last event Id from localStorage');
logging.warn('Failed to fetch last event Id from localStorage');
}
if (transport === TRANSPORT_POLLING) {
@ -132,7 +137,7 @@ export const waitForAsyncData = async (asyncResponse: AsyncEvent) =>
break;
}
default: {
console.warn('received event with status', asyncEvent.status);
logging.warn('received event with status', asyncEvent.status);
}
}
removeListener(jobId);
@ -171,7 +176,7 @@ const setLastId = (asyncEvent: AsyncEvent) => {
try {
localStorage.setItem(LOCALSTORAGE_KEY, lastReceivedEventId as string);
} catch (err) {
console.warn('Error saving event Id to localStorage', err);
logging.warn('Error saving event Id to localStorage', err);
}
};
@ -182,7 +187,7 @@ const loadEventsFromApi = async () => {
const { result: events } = await fetchEvents(eventArgs);
if (events && events.length) await processEvents(events);
} catch (err) {
console.warn(err);
logging.warn(err);
}
}
@ -210,7 +215,7 @@ export const processEvents = async (events: AsyncEvent[]) => {
}, RETRY_DELAY * retriesByJobId[jobId]);
} else {
delete retriesByJobId[jobId];
console.warn('listener not found for job_id', asyncEvent.job_id);
logging.warn('listener not found for job_id', asyncEvent.job_id);
}
}
setLastId(asyncEvent);
@ -229,7 +234,7 @@ const wsConnect = (): void => {
ws = new WebSocket(url);
ws.addEventListener('open', event => {
console.log('WebSocket connected');
logging.log('WebSocket connected');
clearTimeout(wsConnectTimeout);
wsConnectRetries = 0;
});
@ -240,7 +245,7 @@ const wsConnect = (): void => {
if (wsConnectRetries <= wsConnectMaxRetries) {
wsConnect();
} else {
console.warn('WebSocket not available, falling back to async polling');
logging.warn('WebSocket not available, falling back to async polling');
loadEventsFromApi();
}
}, wsConnectErrorDelay);
@ -257,7 +262,7 @@ const wsConnect = (): void => {
events = [JSON.parse(event.data)];
await processEvents(events);
} catch (err) {
console.warn(err);
logging.warn(err);
}
});
};

View File

@ -282,6 +282,7 @@ const config = {
minimizer: [new CssMinimizerPlugin(), '...'],
},
resolve: {
// resolve modules from `/superset_frontend/node_modules` and `/superset_frontend`
modules: ['node_modules', APP_DIR],
alias: {
// TODO: remove alias once React has been upgraaded to v. 17