We transferred dry cereal into plastic vertical bins made for such storage because they fit in our RV cupboard very well vs assorted open cereal boxes, plus the infestation issue is fixed. Also use small plastic totes as mentioned above.
After five years of trips short and long, I don't leave anything in the RV unless we're on a trip after living in a hot climate for years. My theory (right or wrong) is that canned and packaged food deteriorates faster in high temps. There's no question that spices do. We clear out all the food at the end of a trip.
There's also the issue of hauling around excess weight in canned goods you "might" use. We usually hit Walmart once or twice a week for milk and fresh meat/produce, and it's easy to add the remaining ingredients.
So I start each trip with the basics like seasonings and condiments I know I'll use often for simple camping meals, plus a couple of weeks worth of ingredients and snacks. I've figured out what might be hard to find on the road, and do stock extras - for example, we like spicy V8 in small cans but it's not always available.