My mid-2011 iMac is still going strong after giving an SSD transplant two years ago. Unfortunately, it’s on the deprecated list, and won’t get Mojave.
I was thinking I might be able to last another two years, because most apps will typically support the current MacOS version and at least one previous version. But many modern Mac apps will drop support past that.
But then I realized the feature that may drive me to get a new iMac in Fall of 2019: Marzipan! There are a number of iPad apps that I’d love to have on my Macs, and that may be what does me in.
(Side note: I don’t actually use my iMac that much these days. I also have a 2015 Macbook Pro, and that’s the Mac I usually turn to. But I like having an always on Mac I can reach from anywhere.)