Is it true that those old porcelain sockets are no longer allowed for closets?

I am just wondering because I have them in my closet with a switch outside the closet and I was told to replace them with a glass shaded fixture. Someone else said a recessed fixture is te code.

Is this worth doing?