0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00
posthog/bin/check-typescript-strict
Karl-Aksel Puulmann a978b28a68
Run typescript with strict in CI, allow no new errors (#3050)
* Verify no new typescript code breaks "strict" compilation

With this we have a file containing all current errors. As the code
changes, we should not add more errors here.

* remove some lines to show a failure

* Add total count to script

* Update blacklist after rebase

* Remove some fails on purpose.

* Attempt a reorder

* Add missing file

* Update script to write typegen

* Refresh list

* Attempt to use normal tsc

* update blacklist

* Store all errors

* echo for typegen

* Add check command

* typegen 3 times

* typegen 4 times

* typegen 6 times

* typegen 10 times

* remove debug code

* Update kea typegen to latest

* Remove hacks
2021-01-22 16:36:30 +02:00

24 lines
695 B
Bash
Executable File

#!/bin/bash
echo "Refreshing typegen and running 'tsc -p tsconfig.strict.json'..."
echo ""
yarn typegen:write &> /dev/null
ALL_ERRORS=$(yarn typescript:check --strict 2> /dev/null | grep error | grep frontend)
ERRORS_COUNT=$(echo "${ALL_ERRORS}" | wc -l)
NEW_ERRORS=$(echo "${ALL_ERRORS}" | grep --invert-match --fixed-strings --file=.ts-strict-blacklist)
NEW_ERRORS_COUNT="$(echo "${NEW_ERRORS}" | wc -l)"
echo "In total there are ${ERRORS_COUNT} typescript errors."
if test -z "${NEW_ERRORS}"
then
echo "No new typescript errors found in this PR! 🚀"
exit 0
else
echo "Found ${NEW_ERRORS_COUNT} new typescript errors in this PR! 💥"
echo "${NEW_ERRORS}"
exit 1
fi