mirror of
https://github.com/numtide/treefmt.git
synced 2024-09-11 17:07:44 +03:00
Add elm-format example
This commit is contained in:
parent
42a861105c
commit
02271a2ef2
@ -19,6 +19,7 @@ devshell.mkShell {
|
||||
clang
|
||||
|
||||
# Code formatters
|
||||
elmPackages.elm-format
|
||||
haskellPackages.ormolu
|
||||
haskellPackages.cabal-install
|
||||
haskellPackages.ghc
|
||||
|
24
examples/monorepo/elm/elm.json
Normal file
24
examples/monorepo/elm/elm.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "application",
|
||||
"source-directories": [
|
||||
"src"
|
||||
],
|
||||
"elm-version": "0.19.1",
|
||||
"dependencies": {
|
||||
"direct": {
|
||||
"elm/browser": "1.0.2",
|
||||
"elm/core": "1.0.5",
|
||||
"elm/html": "1.0.0"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/json": "1.1.3",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/url": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.2"
|
||||
}
|
||||
},
|
||||
"test-dependencies": {
|
||||
"direct": {},
|
||||
"indirect": {}
|
||||
}
|
||||
}
|
31
examples/monorepo/elm/src/Main.elm
Normal file
31
examples/monorepo/elm/src/Main.elm
Normal file
@ -0,0 +1,31 @@
|
||||
module Main exposing (Msg(..), main, update, view)
|
||||
|
||||
import Browser
|
||||
import Html exposing (Html, button, div, text)
|
||||
import Html.Events exposing (onClick)
|
||||
|
||||
|
||||
main =
|
||||
Browser.sandbox { init = 0, update = update, view = view }
|
||||
|
||||
|
||||
type Msg
|
||||
= Increment
|
||||
| Decrement
|
||||
|
||||
|
||||
update msg model =
|
||||
case msg of
|
||||
Increment ->
|
||||
model + 1
|
||||
|
||||
Decrement ->
|
||||
model - 1
|
||||
|
||||
|
||||
view model =
|
||||
div []
|
||||
[ button [ onClick Decrement ] [ text "-" ]
|
||||
, div [] [ text (String.fromInt model) ]
|
||||
, button [ onClick Increment ] [ text "+" ]
|
||||
]
|
@ -17,3 +17,8 @@ includes = [ "rust/" ]
|
||||
excludes = []
|
||||
command = "cargo"
|
||||
options = [ "fmt", "--" ]
|
||||
|
||||
[formatters.elm-format]
|
||||
files = [ "*.elm" ]
|
||||
command = "elm-format"
|
||||
options = [ "--yes" ]
|
||||
|
Loading…
Reference in New Issue
Block a user