An appeals court has declared a New York law that allowed noncitizens to vote in local elections as unconstitutional.