The only issue is then you're at the mercy of whatever parser your formatter uses to construct the AST

Well, if any (common, non-hobby) parser is thrown off by the reformatting, then it's probably not a safe reformatting either way.