There are zoning laws (barring anomalies like Houston). Datacenters are generally only built in areas zoned industrial. The problem is there’s often some type of residential construction on an adjacent residential-zoned parcel. The zoning usually doesn’t require any kind of buffer between the residential and industrially-zoned area.