I try to get things that'll take rechargable lithium batteries as much as possible. My flashlights and emergency lights all take rechargables which I recharge when it gets down to 50% and I have a spare set of batteries for each in the refrigerator for long-term storage and like Ren said, I keep them at 90% charge. I got a couple small 20,000 Mah battery packs and I'm planning to get a 50W folding solar panel to charge those and my laptop.
I have very few devices that take AA batteries, for those I use low discharge NH batteries (Enloops) to avoid leakage.
For gun stuff, I keep a spare set or two of batteries for each. I change them every one, two, or three years depending on how much I use them. I scribble the dates on a piece of paper that I leave in my safe.
Use quality batteries from a proven source, there are counterfeit lithium batteries out there.