avh4/elm-format

Use elm-tooling.json to determine where .elm files are

avh4 opened this issue · 2 comments

avh4 commented

The spec for elm-tooling.json defines the entrypoints folders where .elm files are located. Maybe elm-format should have a way to use that file if present, or if requested, to determine where to search for files to format or validate.

Note that currently elm-tooling.json does not have a way to specify where test files are located (see elm-tooling/elm-tooling-cli#17).

The spec for elm-tooling.json defines the entrypoints folders where .elm files are located

No, it’s not folders – it’s the entrypoint files themselves. Like "./src/Main.elm" or "./src/Admin/Main.elm".

I haven’t posted my plans yet, but I’m currently exploring removing "entrypoints" from the spec. Currently, only the language server is using "entrypoints", and I think it doesn’t need it: elm-tooling/elm-language-server#623. (Also there are some details about the "entrypoints" spec that I don’t like, but I won’t go into that right now.) An idea I have is that going forward, all new stuff in elm-tooling.json should be put inside "x-tool-name": { "stuff": true } until more than one tool needs that information – then we can figure out a spec. So you could do { "x-elm-format": { "entrypointFolders": [...] } } or something (if that’s what you need – see below).

To understand better why you’d like to use "entrypoints" in elm-tooling.json – is it so that users can run just elm-format with no arguments to format everything, instead of elm-format src tests etc?

avh4 commented

Ah, thanks for the details. That sounds good.

I made the issue just to take note of considering what elm-format should do, if anything, for elm-tooling.json. (I was thinking about it after seeing a thread on the Elm Slack today.) I misunderstood what entrypoints was, so my idea here doesn't really make sense. I'll close this issues, and a new one can be opened in the future if there's a new idea that does make sense.