The US Constitution trumps state law. The Founding Fathers did not envision political parties when they created the Electoral College.  Those state laws and party pledges have never been litigated, and would be unlikely to stand up in court. There have been unfaithful electors in the past. The election goes to the House of Representatives, only if a candidate fails to receive the 270 electoral votes hahaha