From 1297bf0115c0a7453226d34c5f63df12b695e739 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 3 Dec 2021 00:04:34 +0800 Subject: [PATCH 1/5] chore: frontend cleanup --- superset-frontend/.storybook/main.js | 2 -- .../packages/superset-ui-demo/.storybook/main.js | 12 ------------ .../packages/superset-ui-demo/tsconfig.json | 16 ---------------- superset-frontend/tsconfig.json | 3 --- 4 files changed, 33 deletions(-) diff --git a/superset-frontend/.storybook/main.js b/superset-frontend/.storybook/main.js index f55c29eac77c0..f5c4fc24fe47d 100644 --- a/superset-frontend/.storybook/main.js +++ b/superset-frontend/.storybook/main.js @@ -16,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -const path = require('path'); - // Superset's webpack.config.js const customConfig = require('../webpack.config.js'); diff --git a/superset-frontend/packages/superset-ui-demo/.storybook/main.js b/superset-frontend/packages/superset-ui-demo/.storybook/main.js index 90ab868100c23..aadae106e328f 100644 --- a/superset-frontend/packages/superset-ui-demo/.storybook/main.js +++ b/superset-frontend/packages/superset-ui-demo/.storybook/main.js @@ -9,8 +9,6 @@ const packages = readdirSync(basePath).filter(name => { return stat.isSymbolicLink(); }); -const rootPath = path.resolve(__dirname, '../../../'); - const PLUGIN_PACKAGES_PATH_REGEXP = new RegExp( `${path.resolve( __dirname, @@ -64,16 +62,6 @@ module.exports = { ), }); - // todo: remove hard code after move storybook to superset repo. - config.resolve.alias['@emotion/styled'] = path.resolve( - rootPath, - './node_modules/@emotion/styled', - ); - config.resolve.alias['@emotion/core'] = path.resolve( - rootPath, - './node_modules/@emotion/core', - ); - config.devtool = 'eval-cheap-module-source-map'; config.devServer = { ...config.devServer, diff --git a/superset-frontend/packages/superset-ui-demo/tsconfig.json b/superset-frontend/packages/superset-ui-demo/tsconfig.json index 094d3c6ffab16..a7983cf472e56 100644 --- a/superset-frontend/packages/superset-ui-demo/tsconfig.json +++ b/superset-frontend/packages/superset-ui-demo/tsconfig.json @@ -6,28 +6,12 @@ "rootDir": "../../", "emitDeclarationOnly": false, "sourceMap": true, - "allowSyntheticDefaultImports": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": false, "noEmit": false, "baseUrl": "../../", - "paths": { - "@superset-ui/core": ["./packages/superset-ui-core/src"], - "@superset-ui/chart-controls": [ - "./packages/superset-ui-chart-controls/src" - ], - "@superset-ui/legacy-plugin-chart-*": [ - "./plugins/legacy-plugin-chart-*/src" - ], - "@superset-ui/legacy-preset-chart-*": [ - "./plugins/legacy-preset-chart-*/src" - ], - "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], - "@superset-ui/preset-chart-*": ["./plugins/preset-chart-*/src"], - } }, - "exclude": ["node_modules"], "include": [ "storybook", "../**/src", diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index 7ff2c262b6bf5..6f2a2702e961a 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -33,9 +33,6 @@ ], "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], "@superset-ui/preset-chart-*": ["./plugins/preset-chart-*/src"], - // for supressing errors caused by incompatible @types/react when `npm link` - // Ref: https://github.com/Microsoft/typescript/issues/6496#issuecomment-384786222 - "react": ["./node_modules/@types/react", "react"] }, "skipLibCheck": true, "sourceMap": true, From 78e67f6d6d226983d0a26f36a7ae64320ff9e79c Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 3 Dec 2021 10:43:19 +0800 Subject: [PATCH 2/5] remove unused files --- superset-frontend/jsconfig.json | 8 -- superset-frontend/scripts/check_license.sh | 90 ---------------------- 2 files changed, 98 deletions(-) delete mode 100644 superset-frontend/jsconfig.json delete mode 100755 superset-frontend/scripts/check_license.sh diff --git a/superset-frontend/jsconfig.json b/superset-frontend/jsconfig.json deleted file mode 100644 index af4aef66f1fd8..0000000000000 --- a/superset-frontend/jsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "src/*": ["./src/*"] - } - } -} diff --git a/superset-frontend/scripts/check_license.sh b/superset-frontend/scripts/check_license.sh deleted file mode 100755 index 9d2026e523ff9..0000000000000 --- a/superset-frontend/scripts/check_license.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - - -acquire_rat_jar () { - - URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" - - JAR="$rat_jar" - - # Download rat launch jar if it hasn't been downloaded yet - if [ ! -f "$JAR" ]; then - # Download - printf "Attempting to fetch rat\n" - JAR_DL="${JAR}.part" - if [ $(command -v curl) ]; then - curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR" - elif [ $(command -v wget) ]; then - wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR" - else - printf "You do not have curl or wget installed, please install rat manually.\n" - exit -1 - fi - fi - - unzip -tq "$JAR" &> /dev/null - if [ $? -ne 0 ]; then - # We failed to download - rm "$JAR" - printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n" - exit -1 - fi - printf "Done downloading.\n" -} - -# Go to the project root directory -FWDIR="$(cd "`dirname "$0"`"/..; pwd)" -cd "$FWDIR" - -TMP_DIR=/tmp - -if test -x "$JAVA_HOME/bin/java"; then - declare java_cmd="$JAVA_HOME/bin/java" -else - declare java_cmd=java -fi - -export RAT_VERSION=0.13 -export rat_jar="${TMP_DIR}"/lib/apache-rat-${RAT_VERSION}.jar -mkdir -p ${TMP_DIR}/lib - - -[[ -f "$rat_jar" ]] || acquire_rat_jar || { - echo "Download failed. Obtain the rat jar manually and place it at $rat_jar" - exit 1 -} - -echo "Running license checks. This can take a while." -echo "$FWDIR"/.rat-excludes -$java_cmd -jar "$rat_jar" -E "$FWDIR"/.rat-excludes -d "$FWDIR" > rat-results.txt - -if [ $? -ne 0 ]; then - echo "RAT exited abnormally" - exit 1 -fi - -ERRORS="$(cat rat-results.txt | grep -e "??")" - -if test ! -z "$ERRORS"; then - echo >&2 "Could not find Apache license headers in the following files:" - echo >&2 "$ERRORS" - exit 1 -else - echo -e "RAT checks passed." -fi From ddbf371ea706b923e1b10cd406d2a18d0a241a34 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 3 Dec 2021 11:15:14 +0800 Subject: [PATCH 3/5] remove stylelint --- superset-frontend/package.json | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/superset-frontend/package.json b/superset-frontend/package.json index ff3c428d88f5b..b72640d802459 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -72,23 +72,6 @@ "last 3 safari versions", "last 3 edge versions" ], - "stylelint": { - "rules": { - "block-opening-brace-space-before": "always", - "no-missing-end-of-source-newline": "never", - "rule-empty-line-before": [ - "always", - { - "except": [ - "first-nested" - ], - "ignore": [ - "after-comment" - ] - } - ] - } - }, "dependencies": { "@ant-design/icons": "^4.2.2", "@babel/runtime-corejs3": "^7.12.5", From 3b29a9692dfa3605594cc1acd5305683c8730938 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 3 Dec 2021 12:08:14 +0800 Subject: [PATCH 4/5] arrange tsconfig --- superset-frontend/tsconfig.json | 60 +++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index 6f2a2702e961a..a05d0e4888cd9 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -1,25 +1,16 @@ { "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": true, - "baseUrl": ".", - "composite": true, - "declaration": true, - "declarationMap": true, - "esModuleInterop": false, - "forceConsistentCasingInFileNames": true, - "importHelpers": false, - "jsx": "preserve", - "lib": ["dom", "dom.iterable", "esnext"], - "module": "esnext", - "moduleResolution": "node", - "noEmitOnError": true, + /* Type Checking */ "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, - "outDir": "./dist", - "pretty": true, + "strictNullChecks": true, + + /* Modules */ + "baseUrl": ".", + "module": "esnext", + "moduleResolution": "node", "paths": { "@superset-ui/core": ["./packages/superset-ui-core/src"], "@superset-ui/chart-controls": [ @@ -34,16 +25,41 @@ "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], "@superset-ui/preset-chart-*": ["./plugins/preset-chart-*/src"], }, - "skipLibCheck": true, - "sourceMap": true, - "strictNullChecks": true, - "suppressImplicitAnyIndexErrors": true, - "target": "esnext", "types": [ "@emotion/react/types/css-prop", "jest", "@testing-library/jest-dom" - ] + ], + + /* Emit */ + "declaration": true, + "declarationMap": true, + "importHelpers": false, + "noEmitOnError": true, + "outDir": "./dist", + "sourceMap": true, + + /* JavaScript Support */ + "allowJs": true, + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, + "esModuleInterop": false, + "forceConsistentCasingInFileNames": true, + + /* Backwards Compatibility */ + "suppressImplicitAnyIndexErrors": true, + + /* Language and Environment */ + "target": "esnext", + "jsx": "preserve", + "lib": ["dom", "dom.iterable", "esnext"], + + /* Projects */ + "composite": true, + + /* Completeness */ + "skipLibCheck": true, }, "include": [ "./src/**/*", From a713e53a423488e30ef1c9e3cb84d7a964b19d3d Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 3 Dec 2021 12:08:44 +0800 Subject: [PATCH 5/5] updates --- superset-frontend/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index a05d0e4888cd9..a891fc62d7bfb 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -59,7 +59,7 @@ "composite": true, /* Completeness */ - "skipLibCheck": true, + "skipLibCheck": true }, "include": [ "./src/**/*",