You may not have to declare your non-US income if you qualify for an early residency termination date. This is the the last day that you are physically present in the United States (July 1 in this example). To qualify for early residency termination date, your tax home the remainder of the calendar year should be in the foreign country X.