I asked Qatada about spitting, in the mosque. He said: I heard Anas b. Malik say: I heard the Messenger of Allah ﷺ say: Spitting in the mosque is a sin, and its expiation is that it should be buried.
سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ التَّفْلُ فِي الْمَسْجِدِ خَطِيئَةٌ وَكَفَّارَتُهَا دَفْنُهَا