Can anyone get linter-elm-make working on Atom?

271 views
Skip to first unread message

Rupert Smith

unread,
Sep 28, 2016, 6:50:16 AM9/28/16
to Elm Discuss
My proejct structure is like this:

/
- elm-pacakge.json
- /elm-stuff
- /src
 - /elm
  - lots of elm files

However, when running linter-elm-make it will say "Error, I cannot find module 'Log'" - perhaps a "source-directories" needs to be added to elm-package.json to locate it? So I try adding source directories like this:

    "source-directories": [
        "src/elm"
        ,"src/elm/log"
        ,...
    ],

But still no joy. What is the format of the source-directories? Can I do things like "src/elm/**"?

OvermindDL1

unread,
Sep 28, 2016, 11:42:32 AM9/28/16
to Elm Discuss
It works fine for me (also get Atom's elmjutsu plugin, made by same person as linter-elm-make and they work wonderfully together).

So first of all the src directory in elm-package.json should be as it normally is in elm-package.json, the root directory of all your elm source, mine for example is:
```json
    "source-directories": [
        "web/elm"
    ],
```
In linter-elm-make I also have 'Lint as you type' enabled, 'Always compile main' enabled (be sure to set your project main file(s) as per linter-elm-make instructions!  I.E. open the file, open command pallete, type 'main' and choose "Linter Elm Make: Set Main Paths".  With that it works wonderfully and real-time for me (and again, get elmjutsu).

Rupert Smith

unread,
Sep 28, 2016, 2:49:26 PM9/28/16
to Elm Discuss
On Wednesday, September 28, 2016 at 4:42:32 PM UTC+1, OvermindDL1 wrote:
It works fine for me (also get Atom's elmjutsu plugin, made by same person as linter-elm-make and they work wonderfully together).

So first of all the src directory in elm-package.json should be as it normally is in elm-package.json, the root directory of all your elm source, mine for example is:
```json
    "source-directories": [
        "web/elm"
    ],
```

Do you have just one source directory with all .elm files in it?

I was not that clear in describing my project structure, its actually like this: 

/
- elm-pacakge.json
- /elm-stuff
- /src
 - /elm
  - /log
  - /accounts
  - /whatever

That is, the .elm files are all within /src/elm but in sub-directories underneath that.

I have not done the Set Main Paths part of the setup, I will try that thanks.

OvermindDL1

unread,
Sep 28, 2016, 4:20:45 PM9/28/16
to Elm Discuss
On Wednesday, September 28, 2016 at 12:49:26 PM UTC-6, Rupert Smith wrote:
That is, the .elm files are all within /src/elm but in sub-directories underneath that.

Yep, exactly that but it is `/web/elm` for me, I have only one file per 'application' (since I have multiple main entrance points) and whole subdirectory trees underneath with one main subdirectory per app + one general helper and large trees underneath each of those.

Duane Johnson

unread,
Sep 28, 2016, 11:22:10 PM9/28/16
to elm-d...@googlegroups.com

On Wed, Sep 28, 2016 at 4:50 AM, 'Rupert Smith' via Elm Discuss <elm-d...@googlegroups.com> wrote:
However, when running linter-elm-make it will say "Error, I cannot find module 'Log'" - perhaps a "source-directories" needs to be added to elm-package.json to locate it?

As a low-cost check, it sometimes helps to wipe your elm-stuff directory and try anew. Sometimes things can get messed up in there.

Rupert Smith

unread,
Sep 29, 2016, 4:23:51 AM9/29/16
to Elm Discuss
On Wednesday, September 28, 2016 at 4:42:32 PM UTC+1, OvermindDL1 wrote:
(also get Atom's elmjutsu plugin, made by same person as linter-elm-make and they work wonderfully together).

That looks very useful. Hopefully one day someone will add 'extract function' and 'inline function' auto refactorings too.

Rupert Smith

unread,
Sep 29, 2016, 5:24:30 AM9/29/16
to Elm Discuss
On Wednesday, September 28, 2016 at 4:42:32 PM UTC+1, OvermindDL1 wrote:
It works fine for me (also get Atom's elmjutsu plugin, made by same person as linter-elm-make and they work wonderfully together).

So first of all the src directory in elm-package.json should be as it normally is in elm-package.json, the root directory of all your elm source, mine for example is:
```json
    "source-directories": [
        "web/elm"
    ],
```
In linter-elm-make I also have 'Lint as you type' enabled, 'Always compile main' enabled (be sure to set your project main file(s) as per linter-elm-make instructions!  I.E. open the file, open command pallete, type 'main' and choose "Linter Elm Make: Set Main Paths".  With that it works wonderfully and real-time for me (and again, get elmjutsu).

Thanks for the advice. I tried all the above, also setting a 'work directory'. It still doesn't work... perhaps I just need to add more stuff to Main Paths? or can one even set /src/**/*.elm as the main path?

Here is an example project set up with linter-elm-make that is not working:

Magnus Rundberget

unread,
Sep 29, 2016, 10:19:01 AM9/29/16
to Elm Discuss
Hi !

Have you tried running `elm-make src/elm/Main.elm --output /dev/null` on your project ?
I'm getting all kind of errors due to erroneous module naming all over the place.

in Main.elm you try to import Main.Types, but Types.elm lives in the root folder (src/elm) so it should be named Types in it's module declaration and when importing it from Main it should be import Types.
... and so on and so on

Maybe you used to have a Main folder at some point ?


bottom line. Make sure your project can build on the command line, then I'm sure the atom plugin will be much more cooperative !

-magnus

halohalospecial

unread,
Sep 29, 2016, 10:31:38 AM9/29/16
to Elm Discuss
Hi!  I cloned https://github.com/rupertlssmith/thesett_style_lab and I think the problem is that your directories are in lowercase (e.g. "menu" instead of "Menu").  Can you try renaming them?

Rupert Smith

unread,
Sep 29, 2016, 11:11:10 AM9/29/16
to Elm Discuss
On Thursday, September 29, 2016 at 3:19:01 PM UTC+1, Magnus Rundberget wrote:
Have you tried running `elm-make src/elm/Main.elm --output /dev/null` on your project ?

I did try that and noted that it fails.

It succeeds during the grunt build when elm-make is invoked, because all of the .elm files are passed to it explicitly.

I was not aware that directory name/structure has to exactly match the module name/structure in Elm. Is that officially required by the language or just a convention that one has to adopt to use linter-elm-make?

On Thursday, September 29, 2016 at 3:31:38 PM UTC+1, halohalospecial wrote:
Hi!  I cloned https://github.com/rupertlssmith/thesett_style_lab and I think the problem is that your directories are in lowercase (e.g. "menu" instead of "Menu").  Can you try renaming them?

Thanks. You are right, renaming the directory to Menu instead of menu did help to find Menu.Types, but also the problems noted by Magnus above need to be sorted too. 

So I have quite a lot of moving and renaming to do to try and get this to work...

OvermindDL1

unread,
Sep 29, 2016, 2:06:05 PM9/29/16
to Elm Discuss
On Thursday, September 29, 2016 at 9:11:10 AM UTC-6, Rupert Smith wrote:
I was not aware that directory name/structure has to exactly match the module name/structure in Elm. Is that officially required by the language or just a convention that one has to adopt to use linter-elm-make?..

As far as I've seen that is language mandated. `elm-make` I'm pretty sure yelled at me when it did not match.
Reply all
Reply to author
Forward
0 new messages