Generally, discussion of characters in terms of "flaws" is hopelessly confused. There are real flaws, the kind that normal people have. If you believe realism or tolerance for humanity or both are desirable, these are the well-written characters. You might call them great characters if you find yourself invested in their struggles with their flaws, because their struggle speaks to your own life.
This is not quite the same as liking them. A character like this might in fact arouse many mixed emotions, which is usually an unpleasant. This may seem the opposite of good writing, or entertainment. But reallly, can anyone really explain how a roller coaster doesn't mix quite unpleasant emotions into a whole that many regard as entertaining?
A tragic hero can come to a bad end, and insofar as we identify with him or her, how can that be entertaining? See Aristotle for a start on this answer.
On the other hand, there are fake flaws, like Kirk's caring too much for his ship. Or crew. (Was the distinction really that clear?) In particular, the flaws of villains are generally fake, because the great villains of today possess one overwhelming virtue: They are strong. Winners are strong. Winners are the people you want to identify with. Sure the villainous might get their comeuppance at the end, to resolve any interior issues with any residual morality. But til then you get to identify with their acting out all the impulses we must suppress, or face the consequences.
Villains of this sort exemplify the kind of moral values upheld by businessmen and all the different kinds of people who support empire. As might be expected then, the businessmen who make TV and movies, and the businessmen who buy ads, and their employess, official and unofficial, therefore tend rather to extol this kind of villainy. And antiheroes are favored as well.
If you look at the ratings and audiences, it is not quite so obvious that flaws are so highly regarded by the majority of audiences. There are plenty of reactionary heroes, but, is it really true that they have flaws? In fact, I'm not at all sure that many even have fake flaws, the kind that really turn out to be disguised virtues needed for victory, the only true value...for some.
There is an esthetic divide. Some people dislike anything about reality, or about losing, or about pretty much any human being they cannot personally identify with (both fictional and real, sad to say.) These people tend to sharply reject any real flaws in both heroes and villains. Other people tend to prefer reality, and at some level prefer that even their entertainment on some level should connect them to others, instead of leading them to self-absorbed daydreams.
Heroes and villains with fake flaws or none, whose appeal lies in their badassery, their coolness, are more apt nowadays to be hailed as great characters, aping the semiofficial views of the commercial media.
However I must note that even on a technical level, the distortions of plot and dialogue required to make the hero/villain (there's not really a distinction for this kind of writing) so badass, so cool, generally are Rube Goldberg devices. It is hard to see how anyone can defend that kind of writing in good faith. Which is why the confusion about "flaws" is so essential, lest discussion imply your or my taste is inferior.
On the one hand, the honest proponents will clearly say that reality means that morals are an obstacle. On the other, the honest proponents will clearly say that the implication of an inferior taste and misunderstanding of humanity (or worse, deficiency) is indeed implied.