Chern–Simons formulation of three-dimensional gravity with torsion and nonmetricity