My feeling has always been that non-competes are ok as long as it is an entirely separate agreement from employment. For example, you can sign a contract for $100,000 that you won’t work in field x for 2 years. If you decide to work in the field, you give up that money.
The unfair thing is making it just a part of the standard employment contract.