Edit: TLDR: If you're going to enforce 'not being evil' with threat of supernatural execution, then you gotta take over the whole country first.
If you're a dictator, you can do whatever you want because you make the laws.
You don't
need to do that. The universe is based on action and reaction, not laws and morals. If you're a person with superpowers alone in a otherwise normal universe, you can do anything you want because no one can stop you. If you're a person with superpowers among others, you have to worry about
them, because they can stop you.
Thus, in a universe where the justice league, etc work, you would need to stay on their good side. You also need to avoid pissing off the governments too much, as the JL likes to listen to them and might pressure them into going after you. Keeping those in mind, you can do whatever you want.
You don't
need to follow the legal system, you only need to worry about pissing off the US government or the JL. The JL has a sort of 'minimum threshold', below which they'll probably ignore you, so if you don't do anything really overt or really evil they probably won't do anything to you on their own volition. And since the government at least
somewhat listens to the people, you have much less to worry about if you do things that are technically illegal but not necessarily against the desires of the populace. See: Gravyen killing Klarion. 100% Illegal, he murdered someone, but a huge portion of the population completely supports what he did, and the other part is only somewhat caught up about it.
So yes, you can go around using Detect Evil on people and then enslaving them in a coat, so long as you do one of the following:
1: Hide your actions or your identity to some degree, so that no one knows you're doing them and thus no one will stop you, or at the very least you stay off the JL's radar.
2: Target people who are publicly reviled so that no one is particularly inclined to go after you, even if you're breaking the law.
That's it.
Edit: see also:
Batman(in some universes). Vigilante, he breaks the law. But in many cases, the police
work with him or at the very least don't make anything more than a bare-minimum, token effort to catch him.
Also, pretty much every other superhero in any universe where they don't act with government oversight and aren't a member of the police. All vigilantes, all breaking the law, but in many cases the police actively work
with them and help them.