One confusing thing here is that SRAM themselves, that I know of at least, have never made or warranted a 10 speed 11-42 1x setup. So you're not going to hear from them or their product documentation that any SRAM RD will work here.
There are two questions. One is capacity, which is the total amount of slack the RD is capable of taking up. Different cage lengths are what gives you your different amounts of capacity. SRAM doesn't publish actual capacity numbers like Shimano does; they make you infer it from looking at their Compatibility Map documents. Because you're using a 1x, the capacity you need is simple to calculate: it's large cog tooth count minus small cog tooth count. For 2x or 3x, you're adding to that number the difference between the large ring and the small ring. So by looking at the Compatibility Map, we see that you actually only need a medium cage, since their capacity is sufficient for use with a 14t difference in front (42/28 double) plus a 21t difference in back (11-32 cassette). So at least 35t total capacity, whereas you only need 31t. Long cage would still work, but you don't get any benefit from it here other than versatility if you want to change things later, and the drawbacks are weight, ground clearance, and arguably shifting performance.
Note that sometimes things can get awkward when one flirts with maxing out the total capacity of a rear derailer on a 1x, because then you're riding with the cage pulled all the way forward when in your big cog, which tends to add friction and decrease shifting performance. Here it should be fine, this setup with medium cage is more or less a known quantity (Wolf Tooth and OneUp both say it's a go with their 42t conversion cogs, for example) but in other cases I'd be cautioning that putting it all together is still going to be a bit of an experiment. Also note that chain growth is a factor that has to be managed on some full suspension bikes.
The other issue is largest cog clearance. SRAM says the max for their 10-speed derailers is 36. In practice lots of people run them with 42t cassettes, either ones that come that way or are modded with aftermarket large cogs. It's possible that to get the pulley/cog gap required you may need to swap in an extra-long B-tension screw, which is just an M4x0.7 bolt. Note that SRAM 1x setups need kind of a lot of clearance here. I'm always a little baffled about the physics involved that makes a bigger gap work better, but it's true. In theory since you're putting the clearance out extra far here, shifting performance may suffer at the other end of the cassette, but in practice that doesn't seem to be much of an issue.