thenare not allowed. Just remove it.
if true; then; echo "Hi"; fi
if true; then echo "Hi"; fi
then keywords should not be followed by semicolons. It's not valid shell syntax.
You can follow them directly with a line break or another command.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.