mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Typescript: Fixing typescript strict error, and separate check from publishing (#29679)
* Typescript: Fixing typescript string error, and seperate check from publishing * now should pass
This commit is contained in:
parent
9668c172b3
commit
a7afab4b8a
@ -43,7 +43,7 @@
|
||||
"typecheck": "tsc --noEmit && yarn run packages:typecheck",
|
||||
"plugins:build-bundled": "grafana-toolkit plugin:bundle-managed",
|
||||
"watch": "yarn start -d watch,start core:start --watchTheme",
|
||||
"ci:test-frontend": "yarn run prettier:check && yarn run typecheck && yarn run lint && yarn run test:ci && yarn grafana-toolkit node-version-check"
|
||||
"ci:test-frontend": "yarn run prettier:check && yarn run typecheck && yarn run lint && yarn run test:ci && yarn grafana-toolkit node-version-check && ./scripts/ci-check-strict.sh"
|
||||
},
|
||||
"grafana": {
|
||||
"whatsNewUrl": "https://grafana.com/docs/grafana/latest/guides/whats-new-in-v7-3/",
|
||||
|
@ -58,7 +58,7 @@ class GraphElement {
|
||||
annotations: object[];
|
||||
panel: any;
|
||||
plot: any;
|
||||
sortedSeries: any[];
|
||||
sortedSeries?: any[];
|
||||
data: any[];
|
||||
panelWidth: number;
|
||||
eventManager: EventManager;
|
||||
|
@ -52,10 +52,10 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
|
||||
data: Partial<ShowData> = {};
|
||||
|
||||
fontSizes: any[];
|
||||
fontSizes: any[] = [];
|
||||
fieldNames: string[] = [];
|
||||
|
||||
invalidGaugeRange: boolean;
|
||||
invalidGaugeRange = false;
|
||||
panel: any;
|
||||
events: any;
|
||||
valueNameOptions: any[] = [
|
||||
|
13
scripts/ci-check-strict.sh
Executable file
13
scripts/ci-check-strict.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=579
|
||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
|
||||
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
echo -e "Typescript strict errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,12 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=580
|
||||
DIRECTIVES_LIMIT=172
|
||||
CONTROLLERS_LIMIT=139
|
||||
|
||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
|
||||
DIRECTIVES="$(grep -r -o directive public/app/ | wc -l)"
|
||||
CONTROLLERS="$(grep -r -oP 'class .*Ctrl' public/app/ | wc -l)"
|
||||
@ -14,21 +8,6 @@ STORIES_COUNT="$(find ./packages/grafana-ui/src/components -name "*.story.tsx" |
|
||||
MDX_COUNT="$(find ./packages/grafana-ui/src/components -name "*.mdx" | wc -l)"
|
||||
LEGACY_FORMS="$(grep -r -oP 'LegacyForms;' public/app | wc -l)"
|
||||
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
echo -e "Typescript strict errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$DIRECTIVES" -gt $DIRECTIVES_LIMIT ]; then
|
||||
echo -e "Directive count $DIRECTIVES exceeded $DIRECTIVES_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$CONTROLLERS" -gt $CONTROLLERS_LIMIT ]; then
|
||||
echo -e "Controllers count $CONTROLLERS exceeded $CONTROLLERS_LIMIT so failing build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "Typescript errors: $ERROR_COUNT"
|
||||
echo -e "Directives: $DIRECTIVES"
|
||||
echo -e "Controllers: $CONTROLLERS"
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Publishing CI Metrics"
|
||||
|
||||
data=""
|
||||
|
||||
for ((i = 1; i <= $#; i++ )); do
|
||||
remainder="${!i}"
|
||||
# Find everything until last = character (= is included in the result)
|
||||
# This allows to add tags to metric names
|
||||
metricName=$(grep -o "\(.*\)=" <<< "$remainder")
|
||||
# Get the metric value
|
||||
value=${remainder#"$metricName"}
|
||||
# Remove remaining = character from metric name
|
||||
metricName=${metricName%?};
|
||||
|
||||
|
||||
if [ -n "$data" ]; then
|
||||
data="$data,"
|
||||
fi
|
||||
data=''$data'{"name": "'${metricName}'", "value": '${value}', "interval": 60, "mtype": "gauge", "time": '$(date +%s)'}'
|
||||
done
|
||||
|
||||
echo "Publishing metrics:"
|
||||
echo "$data"
|
||||
curl "https://6371:$GRAFANA_MISC_STATS_API_KEY@graphite-us-central1.grafana.net/metrics" \
|
||||
-H 'Content-type: application/json' \
|
||||
-d "[$data]"
|
Loading…
Reference in New Issue
Block a user