Publication 519
taxmap/pubs/p519-005.htm#en_us_publink1000244649If you are a nonresident alien in the United States and a bona fide resident of American Samoa or Puerto Rico during the entire tax year, you are taxed, with certain exceptions, according to the rules for resident aliens of the United States. For more information, see
Bona Fide Residents of American Samoa or Puerto Rico in
chapter 5.
If you are a nonresident alien from American Samoa or Puerto Rico who does not qualify as a bona fide resident of American Samoa or Puerto Rico for the entire tax year, you are taxed as a nonresident
alien.
Resident aliens who formerly were bona fide residents of American Samoa or Puerto Rico are taxed according to the rules for resident aliens.