If you have a buss of bass (or drums, etc.), you may want to compress first to "glue" the parts together, and then EQ. To add, sometimes you may find it helpful to EQ>Compress>EQ, as there are times where the Compressor will bring out some frequencies you were trying to cut in the first instance of the EQ.
The best advice is to try both ways and use your ears to determine what order will suffice.
While there isn't really right and wrong, I'm quite certain that the general answer is EQ first. Assuming that you use a hi- and lo-pass on every track (which is what everyone should do), you're always gonna EQ first and compress after that (even if it's only the hi- and lo-pass). Why would you want to boost frequencies that you don't want in the mix? Whenever you have your unedited track and you need to cut frequencies, you really should do it before compressing it. However, you can still use a EQ after the compression, if you need to correct the effect of the compression.
So, the scenario described above (EQ - Compress - EQ...) is quite a normal scenario.
But if you use subtractive EQ do it before compressing.
Also, a handy quote from "Guide to Mixing" by Nick Thomas:
"The first thing you need to know when setting up a compressor is that, if you are also using EQ in your signal chain, the compressor typically comes after the EQ. This is because EQ, particularly extreme boosts or cuts, can change thedynamic structure of music. So, if you EQ after compressing, you may change the dynamic structure of the music, partially undoing the work that you did shaping this same dynamic structure with compressor."
However, if you feel like you're getting better results by using compression first, then go for it (obviously).
And conversely sometimes EQ can "enhance" the noise floor of some analogue equipment so eqing first is preferable before for example
going into a valve compressor. As mentioned dependent on the goals at hand, seems to have been covered in full.