If the flashlight has a proper forward or reverse clicky switch, the circuit to the battery is open when the light is off, so storing the battery inside the light is the same as storing it outside the light.

If the flashlight has an electronic switch, you will have some parasitic drain, but most well-engineered lights control the parasitic drain pretty well (to the point where it is comparable to the battery’s self-discharge rate). If you recharge the battery of a stored light with a clicky switch annually, you might want to recharge the battery of a stored light with an e-switch every six months. Or, on lights with anodized threads, you can just unscrew the cap a tiny bit to open the circuit and eliminate the parasitic drain.

Anyway, Li-ion batteries have no chance of leaking like alkalines do, so no worries there.