Lightning bolt is 5' wide. In a 10' corridor there's no problems doing it down the middle with 2 1/2 feet on either side of it. 2.5' is not enough room for a medium or small sized creature (unless they were possibly already squeezing) so it would hit ones on both sides..
I don't assume a lightning bolt is literally 5 ft wide any more than I assume all medium creatures are 5 ft wide. Well, I had a rotund half-orc once that may have been close to 5 ft wide but he was the exception.
Squares are an abstraction ... so do what makes sense for your table but I'm not going to double the number of creatures that can be targeted by a line spell simply because of how minis are positioned on a grid.