Skip to content

[prettier-plugin-pkg] add option to ignore sorting scripts #466

Closed

Description

@Shinigami92

@JounQin would you consider such an option?

In the original repo nothing happens so far 🙁 and as their repo is written JS, it is hard for me to add stuff to their repo.

keithamus/sort-package-json#359 (comment)


here we could just allow options and allow to ignore sort scripts:

const format = (properties: ObjectProperty[]) => {

might be a lot easier

and then I could switch away from prettier-plugin-packagejson in all my projects, even company-work

Activity

  1. JounQin commented on Jun 4, 2025

    @JounQin
    Member

    I'm open to it because sometimes I also want no scripts sorting actually, but I just ignore them. 😅

    This would also be useful when there are comment and pre/post(#403) scripts.

    So I think an option named sortScripts: boolean default as true would be fine for such cases.

  2. changed the title [-]add option to ignore sorting scripts[/-] [+][prettier-plugin-pkg] add option to ignore sorting scripts[/+] on Jun 5, 2025
  3. Shinigami92 commented on Jun 5, 2025

    @Shinigami92
    MemberAuthor

    If we want later to e.g. also sort contributors and maintainers, but some of us prefer to order them in chronological order, I would suggest something like packageIgnoreSort: ["scripts", "contributors", "maintainers"]

    Are you fine with that?

  4. JounQin commented on Jun 5, 2025

    @JounQin
    Member

    Good idea! Although package prefix is a bit redundant?

    {
      "overrides": [
        {
          "files": "package.json",
          "options": {
            "ignoreSort": ["scripts", "contributors", "maintainers"],
          },
        },
      ],
    }
  5. JounQin commented on Jun 6, 2025

    @JounQin
    Member

    @Shinigami92 Do you want to work on this for v0.21.0?

  6. Shinigami92 commented on Jun 6, 2025

    @Shinigami92
    MemberAuthor

    If I find time today or tomorrow yes, otherwise I'm fine with a 0.22 🤷

    I have a meeting this evening and currently need some couch break an cat cuddles

  7. self-assigned this
    on Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions