Counter Offer - my take
I recommend leaving on a good note regardless of counteroffers etc. You never know where if you get to the new employer and the grass isn't any greener. You may have to crawl back. Fortunately I haven't had to do that and really don't know if I could but it is something to think about.
Counteroffers are counter productive. They never get to the root cause and only look good on the surface. I would never trust a manager that offered a counteroffer at the time I made my announcement of leaving. If the issue wasn't resolved beforehand, time of notice is not good. You are marked, regardless and when giving your notice, make sure to be honest and explain why and how you made your decision. Most will understand. My two cents!