You have to check the NEC. The NEC has certian types of wire that can be used in a wall etc. Also when you hardwire into the box you are taking an SP, SP-2, SP-3 or an SJ etc. type wire and having it permanently connected and I think that may be an issue. Those types of cables are intended for portable or pendant usage.
I think its NEC Article 400 for Flexible Cords and Cables
A licensed Electrician or a Code Authority would be more knowledgeable than me.
400.7 Uses Permitted.
(A) Uses. Flexible cords and cables shall be used only for
the following:
(1) Pendants
(2) Wiring of luminaires (fixtures)
(3) Connection of portable lamps, portable and mobile
signs, or appliances
(4) Elevator cables
(5) Wiring of cranes and hoists
(6) Connection of utilization equipment to facilitate frequent
interchange
(7) Prevention of the transmission of noise or vibration
(8) Appliances where the fastening means and mechanical
connections are specifically designed to permit
ready removal for maintenance and repair, and the
appliance is intended or identified for flexible cord
connection
(9) Data processing cables as permitted by 645.5
(10) Connection of moving parts
(11) Temporary wiring as permitted in 527.4( B ) and
527.4©
( B ) Attachment Plugs. Where used as permitted in
400.7(A)(3), (A)(6), and (A)(8), each flexible cord shall be
equipped with an attachment plug and shall be energized
from a receptacle outlet.
Exception: As permitted in 368.8.
400.8 Uses Not Permitted. Unless specifically permitted
in 400.7, flexible cords and cables shall not be used for the
following:
(1) As a substitute for the fixed wiring of a structure
(2) Where run through holes in walls, structural ceilings,
suspended ceilings, dropped ceilings, or floors
(3) Where run through doorways, windows, or similar
openings
(4) Where attached to building surfaces
Exception: Flexible cord and cable shall be permitted to
be attached to building surfaces in accordance with the
provisions of 368.8.
(5) Where concealed by walls, floors, or ceilings or located
above suspended or dropped ceilings
(6) Where installed in raceways, except as otherwise
Again I am no expert but I THINK it may be something a Code Authority would be concerned with.