How to tell if an electronic component is counterfeit?
Except for blantantly obvious counterfeits where the manufacturer name is misspelled (yes, that has actually happened), it is difficult for you to tell.  The best way to avoid this problem is to use reputable suppliers, like Mouser, DigiKey, Element-14, etc.

There is no way I'd ever buy parts from Alibaba.  There is a reason some sites have such low prices.  Think about it.  How can someone sell you small quantities of parts for less than places like Mouser that buy in bulk directly from the manufacturers?  These are parts they got as "surplus" from companies that supposedly bought more than they needed (sometimes that's legit, but sometimes these parts were abused or failed tests, which is why the company that bought them is dumping them), knockoff parts made to lower quality standards to cut costs, outright frauds, or even parts that "fell off a truck" in Asia someplace.