elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Some errors emitted by elm-make do not respect the --report=json flag #111

Closed lookyhooky closed 8 years ago

lookyhooky commented 8 years ago

I am using Node 6.2.2, Elm 0.17.1

Some errors in elm-make do not respect the --report=json flag. The regular error messages are sent directly to stderr.

I admit total ignorance in Haskell, though one instance of the issue appears to be in the function printError in the BuildManager module. It must not be the only culprit because the syntax errors below are not included in printError.

Here are a few of the types of errors that create the issue:

This file uses 0.16 syntax

-- Main.elm
module Main where

-- Rest of file...

Executing elm-make --report=json Main.elm returns the message below rather than json.

 -- SYNTAX PROBLEM ----------------------------------------------------- Main.elm

I ran into something unexpected when parsing your code!

1| module Main where
               ^
I am looking for one of the following things:

    something like `exposing (..)` which replaced `where` in 0.17
    whitespace

This file misspells exposing as Fexposing

-- Main.elm
module Main exposing (..)

import Html Fexposing (..)

-- Rest of file...

Executing elm-make --report=json Main.elm returns the message below rather than json.

-- SYNTAX PROBLEM ----------------------------------------------------- Main.elm

I need a fresh line to start a new declaration. This means a new line that
starts with stuff, not with spaces or comments.

3| import Html Fexposing (..)
               ^
I am looking for one of the following things:

    reserved word `as`
    reserved word `exposing`
    whitespace

This file tries to import an uninstalled module

-- Main.elm
module Main exposing (..)

import Unknown -- Some uninstalled module
import Html exposing (..)

-- Rest of file...

Executing elm-make --report=json Main.elm returns the message below rather than json.

I cannot find module 'Unknown'.

Module 'Main' is trying to import it.

Potential problems could be:
  * Misspelled the module name
  * Need to add a source directory or new dependency to elm-package.json
process-bot commented 8 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 8 years ago

This is covered by https://github.com/elm-lang/elm-make/issues/98