jfmengels/elm-lint-reporter/1.0.1

NOTE: the latest version is 1.0.2

Reporter

Formats the result of elm-lint in a nice human-readable way.

Types

type alias Error =
{ moduleName : Maybe String
, ruleName : String
, message : String
, details : List String
, range : Range
, hasFix : Bool
}

Contents of an error. Convert the errors from Lint to this type.

type alias File =
{ path : String
, source : String
}

Represents a file.

  • path is the file path
  • source is the raw contents of the file
type alias TextContent =
{ str : String
, color : Maybe ( Int, Int, Int )
, backgroundColor : Maybe ( Int, Int, Int )
}

Represents styled text.

Formatter functions return a list of these, that should be styled in the viewing medium according to the associated colors and joined together without spaces.

Report

type Mode
= Linting
| Fixing

Mode in which elm-lint is running.

formatReport : Mode -> List ( File, List Error ) -> List TextContent

Reports the errors reported by elm-lint in a nice human-readable way.

Fix

formatFixProposal : File -> Error -> String -> List TextContent

Reports a fix proposal for a single error reported by elm-lint in a nice human-readable way.