When you add your first dependency (whether it's for dev or not) the new entry (dependencies or devDependencies) is added at the end of the package.json file, but when you remove the last dependency in one of those two sections, the entire file is sorted like the following list, in the case I'm experiencing:
nameversiondependenciesordevDependenciesprivatescriptstypeworkspaces
Is there a reason to do that? I would expect to the the file sorted always or never 🤔