google / google/go-jsonnet

jsonnetfmt sorts imports weirdly

Open
#655 2 comments 0 reactions 0 assignees View on GitHub
enhancement formatter
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

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"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.