There is no safe method currently. If you use hacks/cfw and go online, you get banned. It can take a few months, but it happens. Only way to avoid bans is to avoid cfw or to avoid going online when any kind of cfw is used.
If you have a second switch, you can trade locally the pokemon from the offline CFW switch to the offline legit switch without fear of being banned online when you reconnect the legit switch to online. Then it's just a matter of working out the logistics.
Also, all the banning questions are answered in the pinned thread:
https://gbatemp.net/threads/nintendo-switch-banning-hub-warning.508710/