clj-commons / formatter

Building blocks and discussion for building a common Clojure code formatter
36 stars 1 forks source link

Reordering ns forms? #3

Open danielcompton opened 5 years ago

danielcompton commented 5 years ago

Do we want to reorder ns forms to follow something like Stuart Sierra’s style guide? (I’m really in favour of this personally).

If we do want to reorder ns forms, what should they look like? What are some of the edge cases that we would face here?

I'm not sure whether we'd want to do line breaks in the way Stuart suggested. This tool would be able to sort namespaces programmatically, not manually in an editor.

This recommendation is slightly different from common practice, but it makes it easier to sort names with editor commands (sort-lines in Emacs).

imrekoszo commented 4 years ago

I'm in favor of the exact style Stuart suggested. Having the linebreaks there means longer forms could fit onto a single line without wrapping/scrolling. Not by much, but I found it does help sometimes.