Police said nobody was injured in the incident which happened at 1.38am today on Springbank Road, Huddersfield and appealed for any witnesses to come forward.
Officers said a gun was fired through a window of the property. A man, aged 25, was arrested on suspicion of attempted murder, in Leeds this afternoon.
Det Supt Simon Atkinson of West Yorkshire Police’s Protective Services (Crime) department, said: “Inquiries are continuing into the incident and I would appeal to anyone with any information to come forward. This was an isolated incident and local neighbourhood officers are stepping up patrols in the area to offer a reassuring presence to local residents.
“No one was injured during the incident.”
Any witnesses are asked to contact 101 or Crimestoppers on 0800 555111.