Skip to content

jsonnetfmt sorts imports weirdly #655

Open
@dwgillies-bluescape

Description

@dwgillies-bluescape

Let's say I have a seet of imports

service = import "./service.jsonnet"
serviceAddOn = import "./service-add-on.jsonnet"

Well, with jsonnefmt it comes out sorted as :

serviceAddOn = import "./service-add-on.jsonnet"
service = import "./service.jsonnet"

This is because "-" comes before "." in the ASCII alphabet. However, if you would simply drop the '.jsonnet' from each file name before sorting them, it would come out in what most people perceive as the correct order :

service = import "./service.jsonnet"
serviceAddOn = import "./service-add-on.jsonnet"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions