I bought some LED lights that have a 3 prong plug. I want to wire them into my roof directly to the positive/negative wires in the light socket. Bunch of questions - Is that a bad idea? Can I connect neutral to ground? I assume that's likely against code? What are the dangers?
NEVER connect neutral to ground!!
Yes, I know you know there's an equipotential bond in the panel which ties them together. But I bet you didn't even know it was called that, or what it does. And you often see slack installations where electricians just spam all neutrals and grounds onto the same bar. That's technically legal in a main panel, but bad form - when neutrals and grounds are rigidly separate, you can clamp a meter around the N-G equipotential bond, and that helps you troubleshoot all sorts of stuff.
The point is, neutral is not ground anywhere else. And ground should never be tied to neutral. Not least, a neutral wire break means the chassis of the thing is energized. This is the problem with 3-prong dryer and range connections, and why they are so needlessly dangerous. If you have any 3-prong dryers or ranges, then do some research on "retrofitting grounds". Or at least convert it to a 4-prong connection with ground disconnected and and fit a GFCI breaker (and label the socket "GFCI Protected / No Equipment Ground").
You are better off with ground disconnected than ground tied to neutral. That's how I install lights in ungrounded locations.
The metal junction box might be grounded. I tie lamp ground to the metal junction box. If it's plastic, obviously, forget that :)
You are allowed to snip the plug off and direct connect
Flexible cords are specifically allowed for luminaires (lights) as long as the entire length of cord is visible/inspectable from the ground (or inside the junction box). NEC 300.6 or 7 or 8, not sure.
However, you need a proper strain relief to enter the junction box with a cord. Big-box and hardware stores tend to do really badly with those; outdoors you need rubber ones that seal around the cord. So I go straight to my friendly neighborhood electrical supply house, with cord in hand, and they fit me up. Electrical supply is found in industrial neighborhoods, not consumer retail areas.
Cheap Cheese junk is no longer permitted in lighting
Everything attached to mains must be UL-listed, or CSA or ETL listed (those are equivalents). CE is not one of those. Code used to not have this requirement for lighting, so it was open season on cheap Chinese... but I believe in 2017 they required light fixtures to also be listed.
If there's any question of interpreting Code, you ask your local town inspector / permit issuer. They are the final word.