For those who want to hide their Content Query Web Parts if they don’t return any data and at the same, who don’t wanna dive into the XSL world, you can just add this code snippet to your pages and VOILÀ.

It’s up to you if you want to set this behavior to every page in your Web Site putting the code in a global JS file, or just for an specific one using a Script Editor Web Part to do the trick.