refactor(monorepo): frontend code cleanup after monorepo (#17639)

* chore: frontend cleanup

* remove unused files

* remove stylelint

* arrange tsconfig

* updates
This commit is contained in:
Yongjie Zhao 2021-12-04 10:55:04 +08:00 committed by GitHub
parent 05752e3fe8
commit 4306289bfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 170 deletions

View File

@ -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');

View File

@ -1,8 +0,0 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": ["./src/*"]
}
}
}

View File

@ -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",

View File

@ -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,

View File

@ -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",

View File

@ -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

View File

@ -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": [
@ -33,20 +24,42 @@
],
"@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,
"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/**/*",