I use i3wm, and to map cap lock to escape, I run:
setxkbmap -option caps:swapescape
This works fine, but sometimes while hitting the F1 key, my pinky can accidentally hit the Escape key, which turns on CapsLock.
Gnome has a very nice way to do this, where Shift + Escape = CapsLock. Hitting Escape on its own will do nothing.
I have a ZSA Voyager and my escape key is on my left thumb, beside the space key.
For the life of me though I can’t imagine why anyone is still using CAPSLOCK, vbU.