In my kitchen I have these three switches. From left to right they are:

1. Cabinet accent lights
2. Under-cabinet task lights
3. Garbage disposal

[![switches][1]][1]

The middle switch no longer functions properly (it looks like someone banged a pot into it causing something inside to break) so I decided to replace all three with new switches.

When took out the switches, I discovered that the left switch for the cabinet lights is connected to a 12 volt transformer for a low voltage bulb. The transformer, visible in the image above, was tucked behind the three switches.

The weird part is that the left switch was not switching the 120 volt power to the transformer. Instead the transformer was always powered and the switch is switching the 12 volt output of the transformer.

Is this safe to have two line voltage switches and one low voltage switch next to each other in the box? Is it even legal (in Montgomery County, MD) to have the transformer tucked in the box like that? Even if it is safe and legal, would I benefit from changing it to switch the input because that will eliminate phantom draw?

  [1]: https://i.sstatic.net/mdfdm.jpg