The link you provided to demonstrate the problem also gives you the solution:
> Moral of the story: > > Always use 3 equals unless you have a good reason to use 2.
Tools like ESLint make it easy to enforce this (and to only allow == in the few cases where those good reasons apply).