As far as the cord cap on the NM. Is it rated for NM?
Either way,I would install a rec.
It does not Have to be cord/plug connected.
BUT,If it is, There are rules.

Regard to location: 422.16(B)(2)(4):
Shall be in the space occupied by the appliance or adjacent to.
(5) must be accessible.
(NEC-2008)