There is no CBP immigration check at domestic airports or terminals within the airport. There may be random CBP checks while boarding the flight going to the US mainland. This is normal and does not happen every day. This same random check happens on the US mainland airports as well. If you are landing in Puerto Rico as your port-of-entry to the US via an international flight, then, yes, there will be a CBP immigration check and you will have to present a valid US visa to enter.