TheThere seems to be an official definition that says the order is always m, kg, s, A, K, mol, cd with the appropriate exponents when only base units are used.
https://en.wikipedia.org/wiki/International_System_of_Quantities#Dimensions_of_derived_quantities
I think that derived units can be used more freely.
Also this does not seem to be too stricty used because 1C is usually 1As and not 1sA.
Other possible orderings include alphabetical or by decreasing exponent.
One can also try to use the less confusing notation: if m can be understood as both milli and meter, it might be better to put the other unit first so m is not the prefix.