Greg Perry writes about the flawed notion that the Holy Spirit cannot be grieved, quoting Ephesians 4:30. He compiles a list of ways:
So we have a fairly good list of things that grieve the Holy Spirit! So… don’t do them!
Don’t let the sun go down on your anger
Don’t give the devil an opportunity [to do anything he wants but unchecked, unrighteous anger is his foot in the door]
Let no unwholesome word proceed from your mouth
Put away bitterness, wrath, anger, clamor, slander, and malice