Here's the best I could find... I was a little bewildered by this, TBH. I thought, as long as your political beliefs didn't cause a distraction at work to yourself or others, you were safe from being fired. Guess I was wrong. At least on a federal level. Different states have different rules:
There are only a couple of US states that have something along the lines of "or political beliefs" appended to their workplace discrimination laws. In most US states, it's perfectly legal to announce that you're firing all Democrats, effective immediately. In those couple of states you wouldn't want to announce that, though you could still lay them all off and dare them to try to prove it in court (very difficult unless you've explicitly announced).
Why jump to the extreme? There are plenty of people who seemingly behave “normally”, but are internally sympathetic to some abhorrent views. Does that mean they can’t write JavaScript as well as the next person? If I’m privy to their beliefs that I find disagreeable, does that mean I should “out” them, even if their internalized beliefs have no discernible effect on the workplace?
I’m trying to find my place in the conversation as well. More questions bubble up the more I think. Do I really care that my neighbor is racist if I never interact with them?
From the employer's perspective, the definition of "extreme political views" would be the labor rights / pro-union parties (wherever there's not a two-party first-past-the-post system like USA, those often are explicit separate parties) and the communist party, but the working class would very much want that employers don't get to make that decision.
The criteria for too extreme should not be specific to employment. If some organization is considered too bad to exist (e.g. the Nazi party in post-WW2 germany), then it should be dismantled as such, but if the country considers a political movement legitimate enough to participate in elections and gain seats in government, then obviously supporting that organization or membership in it shouldn't be an obstacle for employment as well. I have no idea on what the legal status (if any) of KKK is today in USA, but whatever it is, IMHO it should be the same both for politics and employment.
In France it is illegal to discriminate against an employee because of his political views.
It is not allowed to ask.