They can only be shiny if they are pre-set in the game's coding meaning that there isnt a 1/1892 chance for a trainer to have a shiny Pokemon. They can only have a shiny Pokemon if it is pre-set. There are only three pre-set NPCs' Pokemon in the main games who have shiny Pokemon. They are only in FR/LG and there is a shiny meowth, espeon, and seaking in trainer tower.
There are also some NPCs who have shiny Pokemon in Pokemon Battle e