I had to disclose mental health treatment for depression and anxiety as part of the background check for an AUSA gig (it goes back 7 years IIRC; I had been treated for a couple of years about 3-4 years before law school). What they ask you for is a letter from your medical provider(s) stating any diagnosis and an assessment of whether you suffer from any condition that could affect your ability to do your job (you also sign a waiver allowing your providers to disclose this medical information about you).
As long as your provider can say that your treatment is working, even if you have a diagnosis that requires treatment, I don't see it being an impediment. I know that being on any mental health medications generally disqualifies you from JAG (don't know if a waiver is possible sometimes), but I haven't seen any indication that non-military fed jobs take that approach. No one ever mentioned my treatment to me, and my check didn't take any longer than they usually do.
To be clear, though, I was no longer in treatment and my providers could say I was fine. So I would imagine depression *could* be a problem, but it would have to be severe enough that you couldn't function effectively.
I think bar applications tend to run along similar lines, but depending how the question is asked, don't require disclosing past treatment, but only if you currently suffer from a condition affecting your ability to do your job. Some do, though - I'd check your state bar associate website for the application, which will tell you what they require.
However, I also think there's a general feeling that if you have some kind of mental health issue, it's better to get the help and be healthy, so getting treatment itself shouldn't be held against you.
That said, I think depression/anxiety have become common enough that they often don't raise eyebrows unless your medical providers deem you unfit. I think (fair or not) that there may still be some stigma against bipolar or other more severe conditions.
(Some background checks don't require reporting of situational treatment - like grief counseling or marital counseling - though I think this was my state bar rather than the Feds. I've always wondered if you could make the argument that treatment for
depression in law school is situational! My own issues were more situational than not, but I disclosed them anyway in the lawyers favorite, an abundance of caution.)
I did run into a weird thing where one provider initially claimed that by law she couldn't provide the info I wanted. But I had had to do the same thing for the background check as a student intern at a USAO, so was able to send her a copy of what she'd previously written. Then she was fine with it. I think she was a good example of how psychiatrists can be crazier than their patients.
And just in case it helps to know what level of treatment this was: I had seen a psychologist for talk therapy and a psychiatrist for anti-depressants, which I took for a year or so. (To be honest I think the therapy was much more helpful for me, though I know people for whom the drugs are a godsend.)
If you think it will help you to go see someone, I totally urge you to do so and not worry about its effects on future background checks. First, you may not get to future background checks if you don't take care of yourself now (not even meaning that as dramatic suicide concerns, just that depression can fuck with your ability to perform well and get where you want to be). And second, I think the government generally understands the perverse incentives behind holding mental health treatment against someone in a background check. JAG is obviously different because the military has different concerns.
It's true that there are stories about mental health treatment holding up, usually, C&F - haven't really heard that about non-military federal checks. But I think most of them are now old enough they may not apply so much anymore. And it's not worth fucking around with your mental health. Besides, if you end up seeing a doctor and at the time you're going through a background check that person isn't willing to say you can do the job effectively, I think you have bigger concerns than passing the check.
(Sorry, that's really long!)