weavejester / cljfmt

A tool for formatting Clojure code
Eclipse Public License 1.0
1.1k stars 120 forks source link

Configurable namespace sorting #268

Open hxegon opened 2 years ago

hxegon commented 2 years ago

I'd like to sort the namespaces in a non-alphabetical way: clojure core libraries first, followed by external namespaces, and then internal namespaces. Feels like it'd be simple to add on top of #251, after that's merged I can take a crack at it.

Thinking it could be configured by either:

This would let me do that while opening it up to whatever order people would like, and could default to alphabetical sorting

sirmspencer commented 2 years ago

I had issues with regex in edn when testing some things with indentation rules. Maybe something like

{:clojure       :top
 :project-ns :bottom}

or just using prefix instead of full regex in the config

[{:prefix "clojure" :order 0}
 {:prefix "my.proj" :order 10}