Jabir (May Allah be pleased with him) reported:
There were some plots of land lying vacant around the mosque. The people of Banu Salamah decided to move to this land and come nearer to the mosque. The Messenger of Allah (ﷺ) heard about it and said to them, "I have heard that you intend to move near the mosque." They said: "Yes, O Messenger of Allah! We have decided to do that." Thereupon the Messenger of Allah (ﷺ) said, "O Banu Salamah! Stay in your houses, because your footprints (when you come to the mosque) will be recorded." He said this twice. They said: "We would not have liked it, had we moved near the mosque."[Muslim].
App reference: Book 9, Hadith 66
Arabic/English book reference: Book 9, Hadith 1056