Typically it is stripped back to where it enters the enclosure. There is a code minimum, 1/4", but no maximum. It could be argued that leaving most of the sheathing on is poor workmanship.
Sometimes I leave an inch or two to write the circuit ID on the sheath.
312.5 Cabinets, Cutout Boxes, and Meter Socket Enclosures Conductors entering enclosures within the scope of this article shall be
protected from abrasion and shall comply with 312.5(A) through (C).
C) Cables. Where cable is used, each cable shall be secured to the
cabinet, cutout box, or meter socket enclosure.
Exception: Cables with entirely nonmetallic sheaths shall be permitted
to enter the top of a surface-mounted enclosure through one or more
nonflexible raceways not less than 450 mm (18 in.) and not more than
3.0 m (10 ft) in length, provided all of the following conditions are met:
a) Each cable is fastened within 300 mm (12 in.), measured along the sheath, of the outer end of the raceway.
b) The raceway extends directly above the enclosure and does not penetrate a structural ceiling.
c) A fitting is provided on each end of the raceway to protect the cable(s) from abrasion and the fittings remain accessible after
d) The raceway is sealed or plugged at the outer end using approved means so as to prevent access to the enclosure through the raceway.
e) The cable sheath is continuous through the raceway and extends into the enclosure beyond the fitting not less than 6 mm (¼ in.).
f) The raceway is fastened at its outer end and at other points in accordance with the applicable article.
g) Where installed as conduit or tubing, the allowable cable fill does not exceed that permitted for complete conduit or tubing systems
by Table 1 of Chapter 9 of this Code and all applicable notes thereto.