The 31s WILL fit the 87 and later trucks(for I have put them in several), but the posts/terminals are somewhat close to the hood, therefore a piece of tire-sidewall, thick plastic, mud-flap, or the like should either be zip-tied over the HOT posts, or riveted/screwed to the bottom side of the hood in the area over the battery.
Actually, this is good practice on any battery in any vehicle.
You can also re-mount the battery trays lower.
Or, a big hammer can be used to re-arrange the ribs under the hood.