I found that that form of phrase is used quite often. I thought it could be read as "What are you being .... for?". But I'm still confused about the use of '没事' here and how to properly put it in English.
Do you mean “没事…做什?" If it is the case, then 没事 is short for '没事要做 (without thing that has to be done); or 没事發生(nothing has happened)
没事 means 'for no reason' or 'with no purpose' in this structure.
"没事回來做什?" (for no reason, come back for what?/ why come back for no reason?)
"没事去看醫生做什?" (for no reason, go to see the doctor for what?/ why go see the doctor for no reason?)
It should be' 没事...作什', but '没事...做什?' is also valid because 做 is the modern counterpart of 作 in classical writting for the verb 'to do'
I guess it's a bit akin to, the good old:
the devil will find work for idle hands to do
没事 here means exactly what you probably think it means.
MDBG lists one definition as:
to have nothing to do
In your above question the 没事 basically acts as, 'don't you have anything better to do than to....', 'are you so idle as to...', etc. -or- as you put it What are you being .... for?
'没事‘ = 'everything is ok' is this case. ‘做什么’ equates to 'why' here I think.
Everything is fine, why are you uttering such profanities?