Nintendo of America has prepared a very useful video teaching users what they should do before they trade-in or sell their Nintendo Switch.
First, you have to back up your save data with the Save Data Cloud Backup feature for Nintendo Switch Online members. Then, perform a system transfer from your old system to the new system (if you have one). Once that’s done, unlink your Nintendo Account from the old system, and perform a system reset.
That’s all you have to do. Check out the video below for more: