jsonlint icon indicating copy to clipboard operation
jsonlint copied to clipboard

Sort keys but not top-level keys

Open vezaynk opened this issue 1 year ago • 1 comments

A package.json looks like this:

{
  "name": "...",
  "dependencies": {
     "a": "...",
     "b": "..."
  }
}

I want to keep the order of name and dependencies, but want to make sure that the list of dependencies are sorted. I think a good approach for this would be to let the --sort-keys flag accept a number, which is the minimum depth at which it begins sorting.

 npx jsonlint -s 1 -i -q package.json

vezaynk avatar Feb 07 '23 17:02 vezaynk