In POSIX shell, you can use setset -u -u/ set -o nounset, which will cause the shell to thrown an error when trying to expand an unset variable:
#!/bin/sh
set -u
: "${UNSET_VAR}"
E.g. in Bash, it will thrown an error like unset1.sh: line 3: UNSET_VAR: unbound variable
or using the ${var?message} Parameter Expansion:, which will thrown an error with the given message if the variable is unset.
: "${UNSET_VAR?Unset variable}"
In your case, you should use :? instead of ? to also fail on set but empty variables:
rm -rf -- "${PROJECT_HOME:?PROJECT_HOME empty or unset}"/*
set -u doesn't have an equivalent for erroring on variables set to the empty string.