You adulterous people! Do you not know that friendship with the world is enmity with God? Therefore whoever wishes to be a friend of the world makes himself an enemy of God.

James 4:4

Ray Ortland explains (God’s Unfaithdul Wife):

James is not seeking merely to guard his readers from worldly patterns of behaviour; he is calling them away from even the desire for worldly approval by defining the issue so clearly, strictly and finely that no-one wishing to be God’s friend will allow himself to be drawn after the world, Demas-like, in his affections and aspirations. The Christian who understands and internalizes this warning will live outwardly with a kind of benevolent detachment from the world, enjoying the friendship of God so richly that the hostility of the world will be a small price to pay. Covenant faithfulness, then, is a deeply felt personal preference for the favour of God, at whatever the social cost. Spiritual adultery consists in the lingering wish to retain the world’s favour even as one also wishes to enjoy the benefits of redemption. Such hypocrisy provokes God to jealousy, as James goes on to explain in verse 5.