Is it really that the electrical energy consumed by a resistor totally transform to heat energy?
If you run the resistor hot enough, some of the energy will be converted to light rather than heat. Although it is probably converted from electrical energy to heat, and then the thermal vibrations of the material generate light, so it's not a direct conversion from electrical to light.

This is exactly how incandescent light bulbs work.

If you want an example of a direct conversion from electrical to light, then you can argue that an LED is a type of nonlinear resistor, and that it really does convert the energy of a pair of charge carriers in an electrical potential to light through the radiative recombination process.