I'd say 3DS to Switch was the best one for the reason that a lot of people didn't even realize that a hardware transition was on the way and instead believed that Switch was not a successor to the 3DS, but only to the Wii U. On the same note, Wii U to Switch was among the worst ones, first and foremost owed to the fact that the Wii U was on its death bed in its fourth year already.
As a general rule, any hardware transition of any console manufacturer runs a lot more smoothly when the current console has good third party support and is followed up by a new console that has either a strong first party lineup in its first year, a good third party lineup or, ideally, a combination of both. Whenever the games are there, hardware specifications matter little.
Rating each hardware transition of Nintendo with a simple Thump Up, Thump Sideways, Thump Down system, we get the following:
NES to SNES: Thumb Up. First and third party support for both consoles was great during the transition. The NES got goodies late, the SNES early.
SNES to N64: Thump Sideways. While the SNES coasted off into the sunset in decent fashion, the N64's early period was plagued was sparse releases and many delays.
N64 to GC: Thump Down. The N64's final year was bad, the GC's heavy hitters arrived a little too late and still felt rushed regardless.
GC to Wii: Thump Sideways. The Wii started strong, but clearly at the cost of the GC.
Wii to Wii U: Thump Down. Nintendo shorthanded the Wii and it ultimately still amounted to nothing much for the Wii U.
Wii U to Switch: Thump Sideways. While the Wii U was left to die for Switch to prosper (and rightly so), this isn't the ideal way to go from one generation to the next one.
GB to GBA: Thump Up. The GB's long run ended on a high note with two Zelda games, the GBA was flooded with games right away.
GBA to DS: Thump Up. During the year of transition, the GBA's lineup was notably better than the DS's, but the DS had a slot for GBA cartridges, so overall it was still positive despite the DS being rushed a bit.
DS to 3DS: Thump Sideways. Can't complain on the DS side, but the 3DS was a misfire early on.
3DS to Switch: Thump Up. Touched on in the first sentence of this post already. The 3DS had an extended period of continued first and third party while Switch's first year first party lineup was so strong that it makes one forget or forgive how damn bad third party support for it was.
In summary, Nintendo's track record covers the bases pretty evenly, making it easy to predict that the transition from Switch to its successor will be good at least on the Switch side. Worst case is something akin to the transition from DS to 3DS.
The transitions I rated with Thump Sideways did go two ways, the more positive outcome being the scenario of bad current console leading into good new console rather than the other way around.