Skip to content

Sort keys but not top-level keys #143

@vezaynk

Description

@vezaynk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions