Haha funny this question popped up here now. Yesterday I was implementing a "sort imports" feature for elm-light (Elm plugin for Light Table). I was pondering the same thing. Ended up implementing it like this: - Project modules first (sorted alphabetically) - The External modules sorted alphabetically
I guess I need to make this configurable until a de-facto std emerges. An easy option would be if elm-format did it, but elm-format doesn't to the best of my knowledge (and IMHO shouldn't have to) have knowledge about your project. So sorting alpahbetically no problem. I'd vote for something simple, you probably won't and shouldn't have a ton of imports in a module anyway. On Friday, 2 September 2016 01:54:35 UTC+2, John Bugner wrote: > > Is there a "right" (de-jure or de-facto) way to order imports? If not, > then how do you order them? > > As I see it, there's two kinds of imports: > (1) local imports (Main, Engine, EnginePart, etc) > (2) and standard imports (List, Dict, Maybe, etc) > > I put the local imports first, then an empty line, then the standard > imports. > > And, is there a right way to order each import within its set? That is, > should one try to "logically" order them, like having 'import List' come > before 'import Array', because the former is more "basic" than the latter? > Or should they just be in alphabetical order? > > I prefer to logically order imports; I try to order them consistently in > every project, but it doesn't always happen. > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.