Here in the United States stores do NOT have the right to search your bags. They would have to have a probable cause, a warrant, or for you to give consent to search your bags.
I personally find this at times to be judging consumers, and I refuse to show my bags on the way out of Fry's Electronics for example. They cannot stop you, for they are then withholding you without a cause, and if they restrain you, well then that would be assault.
You, however, are talking about Costco, which is different for you pay a fee to shop there. They may have bag checks written in part of the subscription contract.
With all this said, all stores still do of course hold the right to kick you off their property, just be aware of this.
It's a personal choice, and in some cases you may have to go through a huge hassle when you could have taken the few seconds to show your goods on the way out. Just be aware of that.