It’s a mixed bag. Everyone has a different opinion on this.
The main fear is that attaching the battery to the enclosure will eventually cause undue strain on the mounting holes, causing them to crack or break. But this doesn’t always happen, for multiple reasons: 1. enclosure made out of bombproof material 2. battery is small 3. reinforcement around the mounting holes.
TRUTH. People who mount their shit in their enclosure probably also drive slow in the fast lane and don’t know how to use their mirrors…Or eat string cheese whole. Or wear velcro shoes…Or think channel trucks are suspension trucks.
I use either industrial/outside rated velcro or 3M double stick tape. Velcro is thicker if your short on head room, 3M tape makes it a PIA to remove anything.
The theory is that the enclosure is a shield to protect your components, not a structure to hold your components. That being said, I have built boards where I mounted everything in the enclosure and then bolted the enclosure on. In practice its a lot easier to work on a board when you can remove the enclosure and all the components are in place.
For thinks like charge ports and volt meters that normally get mounted/recessed into the enclosure I use quick disconnects so I can fully remove the enclosure.