The distance to the sidewall isn't a problem so long as you toe them in. The distance to the rear wall might be. When the distance from the baffle to the rear wall is 1/4 wavelength you'll get a reflected wave cancellation null. With 18 inches of spacing and the 16 inch cab depth the resulting 34 inch baffle to wall distance is 1/4 wavelength at 100Hz, not where you want a null. Tight to the wall the null would be at 200Hz, where it would be far less severe. The exception to putting the cab tight to the wall would be if the room is boomy, in which case the distance to the rear wall can be used to put the null at the same frequency as the room mode, taming the boom.
Bill Fitzmaurice Loudspeaker Design
The Laws of Physics aren't swayed by opinion.